Author Topic: on a function like message all how what do you use instead of (%client)  (Read 1684 times)

I need to know what do i change (%client) to to change to a message all nstead of messGe client thnx

messageAll('', "message");

messageAll('', "message");
thx and do i have to change the function also?

thx and do i have to change the function also?
what? please explain what you are talking about

what? please explain what you are talking about
like

function serverCmdNameofcommand(,'',%client)
Do i leave that part as client?

like

function serverCmdNameofcommand(,'',%client)
Do i leave that part as client?

No. messageAll messages all the clients in the game and there is no need to pass a client argument.

However, the messageAllExcept(); function lets you send a message to everyone except a specified client, and in that case you do need to pass a client variable. For example,

Code: [Select]
$client = findclientbyname("bob");
messageAllExcept($client, '', '\c6Everyone except Bob can see this message.');



Also, in serverCmd functions, the client variable is the first argument passed.

function serverCmdNameofcommand(,'',%client) is incorrect.

function serverCmdNameofcommand(%client, %whatever, %stuff, %you, %want) is the way to go.

No. messageAll messages all the clients in the game and there is no need to pass a client argument.

However, the messageAllExcept(); function lets you send a message to everyone except a specified client, and in that case you do need to pass a client variable. For example,

Code: [Select]
$client = findclientbyname("bob");
messageAllExcept($client, '', '\c6Everyone except Bob can see this message.');



Also, in serverCmd functions, the client variable is the first argument passed.

function serverCmdNameofcommand(,'',%client) is incorrect.

function serverCmdNameofcommand(%client, %whatever, %stuff, %you, %want) is the way to go.

is it posible for like a city rp to do message all police?

is it posible for like a city rp to do message all police?

Yes, but it depends on what identifies someone as a cop.

If all cops have %client.isCop = true; then...

Code: [Select]
for($i=0;$i<ClientGroup.getCount();$i++)
{
   $client = ClientGroup.getObject($i);
   if($client.isCop)
   {
      $client.chatMessage("<color:FFFFFF><font:impact:30>Alert! Someone stole a car!");
   }
}

To get it with the CityRPG add-on

Code: [Select]
for($i=0;$i<ClientGroup.getCount();$i++)
{
   $client = ClientGroup.getObject($i);
   if($client.getJobSO().usepolicecars)
   {
      $client.chatMessage("<color:FFFFFF><font:impact:30>Alert! Someone stole a car!");
   }
}

Yes, but it depends on what identifies someone as a cop.

If all cops have %client.isCop = true; then...

Code: [Select]
for($i=0;$i<ClientGroup.getCount();$i++)
{
   $client = ClientGroup.getObject($i);
   if($client.isCop)
   {
      $client.chatMessage("<color:FFFFFF><font:impact:30>Alert! Someone stole a car!");
   }
}

To get it with the CityRPG add-on

Code: [Select]
for($i=0;$i<ClientGroup.getCount();$i++)
{
   $client = ClientGroup.getObject($i);
   if($client.getJobSO().usepolicecars)
   {
      $client.chatMessage("<color:FFFFFF><font:impact:30>Alert! Someone stole a car!");
   }
}

i was gona do a city rp where it alerts the closest cop and its up to him to alert all other cops is it possible? Sorry if you think im really dumb