Author Topic: Server IDs Code Help  (Read 3140 times)

function getPlayerID(%client)
{
    for(%a = 0; %a < ClientGroup.getCount(); %a++)
   if(ClientGroup.getObject(%a) == %client)
       return %a;
}
That didnt work...


How are you using it?
I make a server.cs file and put the code there...

I make a server.cs file and put the code there...
You are hopeless.

Code: [Select]
function getPlayerID(%client)
{
    for(%a = 0; %a < ClientGroup.getCount(); %a++)
if(ClientGroup.getObject(%a) == %client)
    return %a;
}

package IDS
{
function gameConnection::autoAdminCheck(%this)
{
messageAll('',"\c7Player ID: "@ getPlayerID(%this) @" has joined the server!");
return parent::autoAdminCheck(%this);
}
};
activatepackage(IDS);

You are hopeless.

Code: [Select]
function getPlayerID(%client)
{
    for(%a = 0; %a < ClientGroup.getCount(); %a++)
if(ClientGroup.getObject(%a) == %client)
    return %a;
}

package IDS
{
function gameConnection::autoAdminCheck(%this)
{
messageAll('',"\c7Player ID: "@ getPlayerID(%this) @" has joined the server!");
return parent::autoAdminCheck(%this);
}
};
activatepackage(IDS);
:o does it actually save the id?

:o does it actually save the id?
I don't think so, but you can always test it. You should be able to read the code and know what it does, if you can't do that, you're going to have a very hard time doing what you want to do.

:o does it actually save the id?

It just increases the count each time and tells them the increased number.

The count will decrease when a client leaves the server, and all the IDs above that client will be lowered.

The count will always be in order that they joined, and it will change so that there are no gaps in the numbers.

Basically what I said but explained differently.