public AntiAway()
{
if(AntiAFK_Ativado == false) return 0;
new Float:X, Float:Y, Float:Z;
new Float:CX, Float:CY, Float:CZ;
for(new i; i < MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i) || pLogado[i] == false) return 0;
GetPlayerPos(i, X, Y, Z);
GetPlayerCameraPos(i, CX, CY, CZ);
if(X == PlayerInfo[i][pPosX] && Y == PlayerInfo[i][pPosY] && Z == PlayerInfo[i][pPosZ]) SetTimerEx("TestAway", 1000, false, "ii", i, 20), Moved[i] = false;
GetPlayerPos(i, PlayerInfo[i][pPosX], PlayerInfo[i][pPosY], PlayerInfo[i][pPosZ]);
GetPlayerCameraPos(i, PlayerInfo[i][pCamX], PlayerInfo[i][pCamY], PlayerInfo[i][pCamZ]);
}
return 1;
}
public TestAway(playerid, TimeTo)
{
if(AntiAFK_Ativado == false)
{
TextDrawHideForPlayer(playerid, Textdraw0);
TextDrawHideForPlayer(playerid, Textdraw1);
PlayerTextDrawHide(playerid, Textdraw2[playerid]);
return 0;
}
if(Moved[playerid] == true)
{
TextDrawHideForPlayer(playerid, Textdraw0);
TextDrawHideForPlayer(playerid, Textdraw1);
PlayerTextDrawHide(playerid, Textdraw2[playerid]);
return 0;
}
new Float:X, Float:Y, Float:Z;
new Float:CX, Float:CY, Float:CZ;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerCameraPos(playerid, CX, CY, CZ);
if(X != PlayerInfo[playerid][pPosX] || Y != PlayerInfo[playerid][pPosY] || Z != PlayerInfo[playerid][pPosZ] || CX != PlayerInfo[playerid][pCamX] || CY != PlayerInfo[playerid][pCamY] || CZ != PlayerInfo[playerid][pCamZ])
{
TextDrawHideForPlayer(playerid, Textdraw0);
TextDrawHideForPlayer(playerid, Textdraw1);
PlayerTextDrawHide(playerid, Textdraw2[playerid]);
return 0;
}
if(TimeTo == 0)
{
SendClientMessage(playerid, VermelhoEscuro, "[ANTI-AFK] | Vocк foi Kickado por estar AFK");
TextDrawHideForPlayer(playerid, Textdraw0);
TextDrawHideForPlayer(playerid, Textdraw1);
PlayerTextDrawHide(playerid, Textdraw2[playerid]);
PlayerTextDrawDestroy(playerid, Textdraw2[playerid]);
Kick(playerid);
return 0;
}
TextDrawShowForPlayer(playerid, Textdraw0);
TextDrawShowForPlayer(playerid, Textdraw1);
format(Motivo, sizeof(Motivo), "%i", TimeTo);
PlayerTextDrawSetString(playerid, Textdraw2[playerid], Motivo);
PlayerTextDrawShow(playerid, Textdraw2[playerid]);
return SetTimerEx("TestAway", 1000, false, "ii", playerid, TimeTo-1);
}
SetTimerEx("TestAway", 1000, false, "ii", i, 30)
Por que nгo utiliza o SetTimerEx com 'true' para ficar em modo repetiзгo, e depois utiliza um 'KillTimer'?
|