Author Topic: Does every client have a number?  (Read 2505 times)

I'm trying to create a mod, and I need some way of the clients having their own numbers. When a client joins a server, if they're the 2nd one to connect, do they get their own "client number" set to 2 or something? Or if they're the 3rd one to connect, do they get a client number set to 3? Does this already exist? Or do I need to find some other way to do this?


        thanks,

              Reinforcements

Use BL_ID, because the only number they get is their object number and group number.
Object number does not save.
Group number will go lower if someone left who joined before them.

Actually, i think there's something like a client number in the client-sided recieve chat message command. %a variable (%a,%b,%c,%fmsg, ETC.)
A friend said that %a is the client - but it always returns a number for some reason.

he also said %b and %c were empty.

Or you could give each object a spot in an array and their index is their number.

Or you could give them a variable attached to thier object when they connect

Group number will go lower if someone left who joined before them.
Thats fine, I think thats the kinda of thing I'm looking for. So with this "group number" thing, every client has a number, the host would have 0, and the next person to join would have 1. Correct?

Yes. I believe Chrono is speaking of clientGroup?

You can get an obkect from the group using clientGroup.getObject(#);
You can get how many clients there are with clientGroup.getCount();
So if clientGroup.getCount() is 5 then you could get the client objects using clientGroup.getObject(0), clientGroup.getObject(1) ... clientGroup.getObject(4)
If you want to get all of them, then you can use a for loop

Yes. I believe Chrono is speaking of clientGroup?

You can get an obkect from the group using clientGroup.getObject(#);
You can get how many clients there are with clientGroup.getCount();
So if clientGroup.getCount() is 5 then you could get the client objects using clientGroup.getObject(0), clientGroup.getObject(1) ... clientGroup.getObject(4)
If you want to get all of them, then you can use a for loop
How would I check which number a certain client is? Like %client.getClientGroupNumber(); or something?

I've already made this mod, it's called a server id, just use %client.bl_id, since that will almost never change.

Im not sure. You would probably have to loop through it to get a certain BL_ID or something.

Code: [Select]
for(&i=0; &i<clientGroup.getCount(); %i++)
{
   if(clientGroup.getObject(%i),bl_id==100)
   {
       echo("Found him");
   }
}
I've already made this mod, it's called a server id, just use %client.bl_id, since that will almost never be changed...
And I think he wants to have a numerical value for everyone (like 0 1 2 3 and not 3605, 11240, 18043, etc etc)

Im not sure. You would probably have to loop through it to get a certain BL_ID or something.

Code: [Select]
for(&i=0; &i<clientGroup.getCount(); %i++)
{
   if(clientGroup.getObject(%i),bl_id==100)
   {
       echo("Found him");
   }
}
And I think he wants to have a numerical value for everyone (like 0 1 2 3 and not 3605, 11240, 18043, etc etc)

Well, I'm thinking he means, if your the 300th player to join his server, your ''server id'' would be 300, which is what i made.

It writes a players ''server id'' to a text file, and I use %client.getServerId(); to get the client's ''server id''.

If I'm wrong OP, tell me.

And I think he wants to have a numerical value for everyone (like 0 1 2 3 and not 3605, 11240, 18043, etc etc)
yes, thats exactly what I want! :D
Well, I'm thinking he means, if your the 300th player to join his server, your ''server id'' would be 300, which is what i made.

It writes a players ''server id'' to a text file, and I use %client.getServerId(); to get the client's ''server id''.

If I'm wrong OP, tell me.
is that(in bold) a standard function, or did you make it yourself?

yes, thats exactly what I want! :Dis that(in bold) a standard function, or did you make it yourself?

Made that myself.

Made that myself.
Actualy, now that I think of it. That wont work... Let me explain exactly what I want.

I make a server, my "clientNumber" is 0(I'm the host). Someone else joins, they have a "client number" of 1. Yet another player joins, he has a "client number" of 2. Then the guy with the client number of 1 leaves the server. Now the guy with the client number of 2 gets "shifted down" to 1. This is what I was trying to do, but now that I think of it...I think theres a better way to accomplish what I'm trying to do.

If any of you have ever RP-ed, you may know that trying to pick out the message that the person that your RP-ing with could be easier...So I'm making a mod s everyone talks in one color. Now that I think of it, I think it would be better to assign a variable to the client when he joins my server. A variable that would be used to determine the color they talk in(a hex number). That way, if your used to "so-and-so" talking in blue and someone leaves and the numbers get shifted, the color wont change.(if the client has their own "color" variable). I appreciate you guys posting to help me by the way ^_^. Do you think this is a better way of doing it?

Actualy, now that I think of it. That wont work... Let me explain exactly what I want.

I make a server, my "clientNumber" is 0(I'm the host). Someone else joins, they have a "client number" of 1. Yet another player joins, he has a "client number" of 2. Then the guy with the client number of 1 leaves the server. Now the guy with the client number of 2 gets "shifted down" to 1. This is what I was trying to do, but now that I think of it...I think theres a better way to accomplish what I'm trying to do.

If any of you have ever RP-ed, you may know that trying to pick out the message that the person that your RP-ing with could be easier...So I'm making a mod s everyone talks in one color. Now that I think of it, I think it would be better to assign a variable to the client when he joins my server. A variable that would be used to determine the color they talk in(a hex number). That way, if your used to "so-and-so" talking in blue and someone leaves and the numbers get shifted, the color wont change.(if the client has their own "color" variable). I appreciate you guys posting to help me by the way ^_^. Do you think this is a better way of doing it?

Oh, lol, you should probably use the color hex way.

Oh, lol, you should probably use the color hex way.
How would you get a random hex number?