SA-MP Forums Archive
Send message to only people in a car - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Send message to only people in a car (/showthread.php?tid=225518)



Send message to only people in a car - Zack9764 - 13.02.2011

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;



Re: Send message to only people in a car - XoX - 13.02.2011

https://sampwiki.blast.hk/wiki/IsPlayerInVehicle
or
https://sampwiki.blast.hk/wiki/IsPlayerInAnyVehicle


Re: Send message to only people in a car - Mean - 13.02.2011

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 .