SA-MP Forums Archive
Help: How to make... (see topic) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help: How to make... (see topic) (/showthread.php?tid=349635)



Help: How to make... (see topic) - NeroX98 - 09.06.2012

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 !


Re: Help: How to make... (see topic) - MarinacMrcina - 09.06.2012

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


Re: Help: How to make... (see topic) - JhnzRep - 09.06.2012

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


Re: Help: How to make... (see topic) - NeroX98 - 09.06.2012

any easier idea ?


Re: Help: How to make... (see topic) - NeroX98 - 13.11.2012

refresh


Re: Help: How to make... (see topic) - Kreyg - 14.11.2012

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.