21.02.2014, 17:15
Okay but I'm working with OnPlayerText and vehicle windows (open/close) if windows are open we can see text if windows are closed - this supposed to be for vehicle message only (passengers and driver) but I can see my text and from a guy that is writing, but passengers can't see my text neither their own text, here is the code what I've made:
So I want to make if windows are closed and players are talking inside of the car, only they will see text.. how to fix that?
Thanks for help in advance!
pawn Код:
public OnPlayerText(playerid, text[])
{
new vehicleid = GetPlayerVehicleID(playerid);
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, sizeof(Name));
new string[256];
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerInVehicle(i, vehicleid))
{
if(Carinfo[vehicleid][VehWin] == 0) // closed
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
format(string, sizeof(string), "Driver %s: %s",Name,text);
SendClientMessage(i,-1,string);
return 0;
}
else
{
format(string, sizeof(string), "Passenger %s: %s",Name,text);
SendClientMessage(i,-1,string);
return 0;
}
}
if(Carinfo[vehicleid][VehWin] == 1) // opened
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
format(string, sizeof(string), "Driver %s: %s",Name,text);
ProxDetector(8.0, playerid, string, COLOR_DBLUE,COLOR_DBLUE,COLOR_DBLUE,COLOR_DBLUE,COLOR_DBLUE); // Radius need to be checked..
return 0;
}
else
{
format(string, sizeof(string), "Passenger %s: %s",Name,text);
ProxDetector(8.0, playerid, string, COLOR_DBLUE,COLOR_DBLUE,COLOR_DBLUE,COLOR_DBLUE,COLOR_DBLUE); // Radius need to be checked..
return 0;
}
}
}
}
}
return 1;
}
Thanks for help in advance!