| Blockland Forums > Modification Help |
| Checking If A Client Does Not Have A Add On |
| << < (5/5) |
| Ipquarx:
Client: --- Code: ---function clientCmdHasMyAddon() { commandToServer('HasAddon', $curversion); } --- End code --- Server: --- Code: ---function serverCmdHasAddon(%client, %version) { if(%version == $modversioncurrent) %client.hasClient = true; else %client.hasClient = false; } --- End code --- And then you can add in the schedule. This will check for the version number. |
| Greek2me:
My code tells you if the client has or doesn't have the mod. Here's a simpler version with the extra stuff removed: Server: --- Code: ---package Slayer_Dependencies_GameConnection { function GameConnection::autoAdminCheck(%client) { //tell the client that Slayer is enabled commandToClient(%client,'Slayer_Handshake',$Slayer::Server::Version); return parent::autoAdminCheck(%client); } }; activatePackage(Slayer_Dependencies_GameConnection); function serverCmdSlayer_Handshake(%client,%version) { %client.slayerVersion = %version; if(%version !$= $Slayer::Server::Version) { for(%i=0; %i < getFieldCount($Slayer::Server::CompatibleVersions); %i++) { if(getField($Slayer::Server::CompatibleVersions,%i) $= %version) { %noReturn = 1; break; } } if(!%noReturn) { //****************The client does not have the mod!****************** //The client also doesn't have the mod if they don't call this serverCmd return; } } //********************The client has the mod!************************** %client.slayer = 1; } --- End code --- Client: --- Code: ---function clientCmdSlayer_Handshake(%version) { if(%version !$= $Slayer::Client::Version) { for(%i=0; %i < getFieldCount($Slayer::Client::CompatibleVersions); %i++) { %f = getField($Slayer::Client::CompatibleVersions,%i); if(%f $= %version) { %clVersion = %f; break; } } } if(%clVersion $= "") %clVersion = $Slayer::Client::Version; commandToServer('Slayer_Handshake',%clVersion); } --- End code --- |
| Ipquarx:
client code does not need to be that complicated. just do the command with the current version. if it doesnt match, then return. |
| otto-san:
What if you have an updated client but there are other client versions that work as well? |
| Navigation |
| Message Index |
| Previous page |