Blockland Forums > Modification Help

Checking If A Client Does Not Have A Add On

Pages: << < (4/5) > >>

Ipquarx:


--- Quote from: Headcrab Zombie on October 31, 2011, 02:08:06 PM ---No, that will not work

--- End quote ---
Sorry, i made a mistake.
Here:

Client:

--- Code: ---function clientCmdHasMyAddon()
{
    commandToServer('HasAddon');
}

--- End code ---
Server:

--- Code: ---function serverCmdHasAddon(%client)
{
    %client.hasClient = true;
}

--- End code ---
Then you could do a if-else and such.

jes00:


--- Quote from: Ipquarx on October 31, 2011, 04:29:21 PM ---Here:

Client:

--- Code: ---function clientCmdHasMyAddon()
{
    commandToServer('HasAddon');
}

--- End code ---
Server:

--- Code: ---function serverCmdHasAddon(%client)
{
    %client.hasClient = true;
}

--- End code ---
Then you could do a if-else and such.

--- End quote ---
Your way seems a lot more simple but does it work?

Ipquarx:

Yes, I've used it before. it works 100%.
just put this into autoAdminCheck or onConnectRequest (depending if you want no join/leave message or not):

--- Code: ---commandToClient(%client, '', 'HasMyAddon');
if(%client.hasClient == true)
{
    doThis();
}
else
{
    doThat();
}

--- End code ---
UBEREDIT: whut now Headcrab.

Headcrab Zombie:


--- Quote from: jes00 on October 31, 2011, 04:17:00 PM ---As in this?
function gameConnection::autoAdminCheck(%client)
{
   checkVersion(%client);
   return parent::autoAdminCheck(%client);
}

function checkVersion(%client);
{
   if(%client.summoning <= VERSION NUMBER)
   {
   %client.delete("You have version " @ %client.summoning @ " of the Summoning Client, you need a new one.");
   }
}

--- End quote ---
Add schedule(3000,0,checkVersion,%client); to the bottom of the preexisting autoAdminCheck package, there's no need for another package.
%client.summoning will be a bool value, not a version number. 1 if the client has the add-on, undefined if they don't


--- Quote from: jes00 on October 31, 2011, 04:17:00 PM ---Ok, I don't completely understand.

--- End quote ---
When you release the first client, set the version variables on the client and server to equal 1.
When you release the second client, change the version variables to 2, and add 1 to the compatible versions variables, if you want them to be able to use the old version.
When you release the third client, change the version variables to 3, and add 2 to the compatible versions variables (seperated by a tab, \t) if you want them to be able to use the old version


--- Quote from: jes00 on October 31, 2011, 04:32:27 PM ---Your way seems a lot more simple but does it work?

--- End quote ---
It's simpler because it doesn't allow for version checks like the previously posted code does. You wouldn't be able to automatically disconnect the client and give them a download link.


--- Quote from: Ipquarx on October 31, 2011, 04:43:05 PM ---UBEREDIT: whut now Headcrab.

--- End quote ---
Due to latency, your code will always run doThat()
This is why I said to use a schedule, to allow the client time to respond.

otto-san:

I would allow at least three seconds before deciding the client doesn't have the mod.

Pages: << < (4/5) > >>

Go to full version