04.10.2014, 16:08
Boa tarde. Estou tentando fazer um temporizador para o player ser kickado caso esteja AFK usando 'SetTimerEx'. Cуdigo:
Funзгo TestAway
Mais quando aumento o SetTimerEx para 30 :
//> = Para
O Temporizador vai de 10 > 30
O Temporizador vai de 9 > 39
Algumas PrintScreens:
Comeзando o temporizador: http://i.imgur.com/nVms7Q9.png
Metade do temporizador: http://i.imgur.com/s3TZgZi.png
Ai quando chega em 10 Segundos: http://i.imgur.com/Gs9iXKT.png
Ai ele da umas bugadas e volta pro tempo normal: http://i.imgur.com/c4DAGmJ.png
Oque poderia ser ? . Obrigado!
pawn Код:
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;
}
pawn Код:
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);
}
pawn Код:
SetTimerEx("TestAway", 1000, false, "ii", i, 30)
O Temporizador vai de 10 > 30
O Temporizador vai de 9 > 39
Algumas PrintScreens:
Comeзando o temporizador: http://i.imgur.com/nVms7Q9.png
Metade do temporizador: http://i.imgur.com/s3TZgZi.png
Ai quando chega em 10 Segundos: http://i.imgur.com/Gs9iXKT.png
Ai ele da umas bugadas e volta pro tempo normal: http://i.imgur.com/c4DAGmJ.png
Oque poderia ser ? . Obrigado!