Sending client message to everybody with a certain variable value - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Sending client message to everybody with a certain variable value (
/showthread.php?tid=329208)
Sending client message to everybody with a certain variable value -
NewerthRoleplay - 27.03.2012
Hi i'd like to have it so that when somebody uses a command it will send a client message to somebody else who has a specific value of a variable. For example when somebody will use the command '/requestcabby' it will send a client message to everybody who has the pJob == TAXI variable and if they have onduty == 1 telling them that a user would like to be picked up and setting a checkpoint to the loaction of the player.
Re: Sending client message to everybody with a certain variable value -
emokidx - 27.03.2012
pawn Код:
for(new i; i<MAX_PLAYERS; i++)
{
if(value == 1 && duty == 1)
{
SendClientMessage(i, -1, "Message");
}
}
Re: Sending client message to everybody with a certain variable value -
antonio112 - 27.03.2012
pawn Код:
CMD:requestcabby(playerid, params[])
{
#pragma unused params
foreach (Player,i) // First thing you have to do, is a loop through all players.
{
if(pJob[i] == TAXI) // Here you check if looped players are in the TAXI Faction
{
if(onduty[i] == 1) // Here you check if they are ON DUTY
{
SendClientMessage(i, 0x489191FF, str); // Here you send them the wanted message
}
}
}
return 1;
}
Re: Sending client message to everybody with a certain variable value -
NewerthRoleplay - 27.03.2012
Quote:
Originally Posted by antonio112
pawn Код:
CMD:requestcabby(playerid, params[]) { #pragma unused params foreach (Player,i) // First thing you have to do, is a loop through all players. { if(pJob[i] == TAXI) // Here you check if looped players are in the TAXI Faction { if(onduty[i] == 1) // Here you check if they are ON DUTY { SendClientMessage(i, 0x489191FF, str); // Here you send them the wanted message } } } return 1; }
|
Thanks +rep