Help: How to make... (see topic)
#1

Hi Scripterzzzz !

I want to ask how can i make to stop the timer when player is on escape menu (when is on desktop or just on the escapemenu) Is there any function ?

I need it for level system that gives 1 exp on 1 min but the problem is that when player is on escape menu or on desktop the exp points keep coming...

Thanks !
Reply
#2

You could make an AFK system that kicks a player if he is AFK after some time
Reply
#3

When a player is tabbed, onplayerupdate is not called. You could work with that somehow.
Reply
#4

any easier idea ?
Reply
#5

refresh
Reply
#6

Try something like this.

pawn Код:
#include<a_samp>

new
      TabTimer[MAX_PLAYERS],
      Tabbed[MAX_PLAYERS]
;

public OnPlayerConnect(playerid)
{
     Tabbed[playerid] = 0;
     return 1;
}

public OnPlayerDisconnect(playerid)
{
    KillTimer(TabTimer[playerid]);
    return 1;
}

public OnPlayerUpdate(playerid)
{
     Tabbed[playerid] = 0;
     return 1;
}

// Put this under where you spawn the player (SpawnPlayer(playerid)) for the first time (NOT IN ONPLAYERSPAWN! if you put it in OnPlayerSpawn, it will start this timer EVERYTIME the player is spawned)

TabTimer[playerid] = SetTimerEx("TabbedCheck", 1000, true, "i", playerid);

// The callback for the timer above.

forward TabbedCheck(playerid);
public TabbedCheck(playerid)
{
     Tabbed[playerid] += 1;
     return 1;
}

// Now, add this right before where the EXP is given. The "30" seen below means if they have been tabbed for 30 or more seconds, they will not gain EXP.

if(Tabbed[playerid] >= 30) return 1;
Hope this helps.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)