Sending client message to everybody with a certain variable value
#1

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 on‌duty == 1 telling them that a user would like to be picked up and setting a checkpoint to the loaction of the player.
Reply
#2

pawn Код:
for(new i; i<MAX_PLAYERS; i++)
{
    if(value == 1 && duty == 1)
    {
        SendClientMessage(i, -1, "Message");
    }

}
Reply
#3

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;
}
Reply
#4

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)