14.11.2012, 02:09
(
Последний раз редактировалось Kreyg; 14.11.2012 в 04:23.
)
Try something like this.
Hope this helps.
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;