18.05.2020, 08:51
Firs you must get if player state if he is driver or passenger
Get player name and the state when sending a message
Now loop then get player vehicle id before sending message so it'll only send to those who's in the car
This is just a sample! don't just copy and paste.
pawn Code:
new pstate[128];
switch(GetPlayerState(playerid))
{
case PLAYER_STATE_DRIVER: pstate = "Driver";
case PLAYER_STATE_PASSENGER: pstate = "Passenger";
}
pawn Code:
new pname[MAX_PLAYER_NAME+1], msg[128];
GetPlayerName(playerid, pname, sizeof pname);
//format for sending message with player state and name and message
format(msg, 128, "%s %s (%d): %s", pstate, pname, playerid, msg);
pawn Code:
for(new i = 0; i < MAX_PLAYERS; i++) {
if(IsPlayerInVehicle(i, GetPlayerVehicleID(playerid)))
{
SendClientMessage(i, -1, msg);
}
}