IsPlayerInRangeOfPoint ?????
#1

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 );
             }
        }
    }
Reply
#2

as fist you have senclientmessagetoall... so that means it sends the msg to all players online so change that to sendclientmessage
Reply
#3

Yes,but sendclientmessage is sending a message only to me ,no? when i press Q and E,i want that people who are close to me to see the message
Reply
#4

yes then you have to define their id but i dont know excactly how... but someone else will know so anyone who knows this post reply here
Reply
#5

Thank you anyway...waiting for replys)
Reply
#6

"SendClientMessage" would be enough!

Or you'd define a new id:

pawn Code:
new targetid;
Combinate it then with the message! Or what do you want?
Reply
#7

Use loop
pawn Code:
public OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
{
    if ( newkeys == KEY_LOOK_RIGHT )
    {
        if ( IsPlayerInAnyVehicle ( playerid ) )
        {
            if (antisigspam[playerid] == 0)
            {
                new Float:pX, Float:pY, Float:pZ;
                GetPlayerPos( playerid, pX, pY, pZ );
                for( new i = 0; i < MAX_PLAYERS; i ++ )
                {
                    if( IsPlayerInRangeOfPoint( i, 7.0, pX, pY, pZ ) )
                    {
                        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 ) );
                        SendClientMessage( i, COLOR_PINK, string ); // Sends the message to the players that are in range of 7 from your position!
                    }
                }
                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 );
             }
        }
    }
    // Rest
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)