Game Development Community

How do i specify a player?

by Makaan · in Technical Issues · 08/03/2006 (5:23 pm) · 1 replies

I know this a really basic thing, but I don't know how to refer to a certain player in script. Let's say, I'm playing and I want to send a private message to 1 person through the chatHud using the messageAll command. In script, how would I make the message go to 1 specified player and nobody else? I tried using messageClient(%client, '', 'message'); but how do I define who %client is? What if I wanted %client to be myself? I'm sure the solution is really simple but if you could please help me I'd be very glad.
Thanks!

About the author


#1
08/03/2006 (5:38 pm)
Every client is added to a simgroup called ClientGroup when they join a server, so just look through it and compare whatever data you are looking for to find the clients you want. Remember this only exists and should be accesed in server script.
for(%i = 0; %i < ClientGroup.getCount(); %i++){
%client = ClientGroup.getObject(%i);
if(%client == stuffI'mlookingfor)
dostuff;
}
If you need a reference to "yourself", any client that sends a commandToServer sends along a reference to what client it is as well. For finding anyone else... well you need to figure how you want to search/select them.