Player position check
#1

I have code, that checks player position. If player after 30 sec in the same position, the text is appears. How to do, that if player after 30 sec. went away for 1-2 meters also got that text? I tried to use IsPlayerInRangeOfPoint, but thet after every 30 sec. I got that text.

Код:
new Float:AFK_X[MAX_PLAYERS], Float:AFK_Y[MAX_PLAYERS], Float:AFK_Z[MAX_PLAYERS];  

forward UpdatePlayer(playerid);
public UpdatePlayer(playerid)
{
           new Float:x[MAX_PLAYERS], Float:y[MAX_PLAYERS], Float:z[MAX_PLAYERS];
           GetPlayerPos(playerid, x[playerid], y[playerid], z[playerid]);
           if(x[playerid] == AFK_X[playerid] || y[playerid] == AFK_Y[playerid] || z[playerid] == AFK_Z[playerid])
           {
        SetPVarInt(playerid, "AFK", GetPVarInt(playerid, "AFK")+1);
        if(GetPVarInt(playerid, "AFK") > 30)
        {
             new stroka[20];
             format(stroka, 20, "AFK: %d sec", GetPVarInt(playerid, "AFK"));
            SetPlayerChatBubble(playerid, stroka, -1, 20.0, 1100);
        }
            }
            if(x[playerid] != AFK_X[playerid] || y[playerid] != AFK_Y[playerid] || z[playerid] != AFK_Z[playerid])
            {
                 if(GetPVarInt(playerid, "AFK") > 0) return SetPVarInt(playerid, "AFK", 0);
                 GetPlayerPos(playerid, AFK_X[playerid], AFK_Y[playerid], AFK_Z[playerid]);
            }
     return 1;
}
Reply


Messages In This Thread
Player position check - by ,TomY' - 05.08.2018, 18:32
Re: Player position check - by DBZdabIt3Bro7 - 05.08.2018, 18:49
Re: Player position check - by NeXTGoD - 05.08.2018, 18:59
Re: Player position check - by DBZdabIt3Bro7 - 05.08.2018, 19:02
Re: Player position check - by NeXTGoD - 05.08.2018, 19:05
Re: Player position check - by DBZdabIt3Bro7 - 05.08.2018, 19:07
Re: Player position check - by NeXTGoD - 05.08.2018, 19:16
Re: Player position check - by ,TomY' - 05.08.2018, 20:25
Re: Player position check - by DBZdabIt3Bro7 - 05.08.2018, 20:41
Re: Player position check - by ,TomY' - 06.08.2018, 08:14

Forum Jump:


Users browsing this thread: 1 Guest(s)