Send message to only people in a car
#1

How do I send this to people ONLY if they're in a car?
Код:
            if(PlayerInfo[playerid][pMember] == 11)
		    {
		        format(string, sizeof(string), " %s", text);
		    }
		    else
		    {
		        format(string, sizeof(string), " %s", text);
		    }
	        SendClientMessagel(COLOR_LIGHTGREEN, string);
	        return 0;
I'm thinking?
Код:
            if(PlayerInfo[playerid][pMember] == 11)
		    {
		        format(string, sizeof(string), " %s", text);
		    }
		    else
		    {
		        format(string, sizeof(string), " %s", text);
		    }
                if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER || GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
                {
	        SendClientMessage(COLOR_LIGHTGREEN, string);
	        return 0;
Reply
#2

https://sampwiki.blast.hk/wiki/IsPlayerInVehicle
or
https://sampwiki.blast.hk/wiki/IsPlayerInAnyVehicle
Reply
#3

Example of a loop:
pawn Код:
SendClientMessage( playerid, 0xAAAAAA, "All players that are in any vehicle:" );
for( new i = 0; i < MAX_PLAYERS; i++ )
{
    if( IsPlayerInAnyVehicle( i ) )
    {
        new string[ 128 ];
        GetPlayerName( i, string, sizeof string );
        format( string, sizeof string, "%s", string );
        SendClientMessage( playerid, 0xAAAAAA, string );
    }
}
Will send you who is in vehicle, example .
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)