03.03.2014, 14:22
Can somebody test this for me with friend? All I want to know is if 2 or more players are in same car only they will get message and not other ppl - only ppl in same car.. I can't test with my friends cuz I can't port forward (idk why).
pawn Код:
public OnPlayerText(playerid, text[])
{
if(IsPlayerInAnyVehicle(playerid))
{
new car = GetPlayerVehicleID(playerid);
new str[150], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(str, sizeof(str), "%s(%d) [CAR]: %s", name, playerid, text);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i)) continue;
if(!IsPlayerInVehicle(i, car)) continue;
SendClientMessage(i, 0xFFFF00FF, str);
return 0;
}
}
else //They aren't in a car...
{
return 0;
}
return 1;
}