13.02.2012, 14:12
Hello,i have a segnaling sysmte,when a player is in a car and press Q or E , the script is sending a message that i am going in left or right...but the system is sending messages to all online on the server.I want it to send these messages only to people who are close to me...You understand.Thank you,here is the code:
pawn Code:
public OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
{
if ( newkeys == KEY_LOOK_RIGHT )
{
if ( IsPlayerInAnyVehicle ( playerid ) )
{
if (antisigspam[playerid] == 0)
{
format ( string, sizeof ( string ), "{E60000}* %s {FFC0CB}is going to the right.", pname( playerid ) );
SendClientMessageToAll( COLOR_PINK, string );
format ( string, sizeof ( string ), "*{FFC0CB}>>>>>>>>>>> {E60000}%s{FFC0CB} >>>>>>>>>>>", pname( playerid ) );
SendClientMessageToAll( COLOR_PINK, string );
antisigspam[playerid] = 1;
SetTimerEx("antispamtimer", ANTISIGSPAM_TIME*1000, false, "d", playerid);
}
else
{
format( string, sizeof ( string ), "Please wait {FFC0CB}%d {E60000}secconds before you signal again!", ANTISIGSPAM_TIME);
SendClientMessage( playerid, COLOR_ULTRARED, string );
}
}
}