Errors in creating advanced AFK kicker - 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: Errors in creating advanced AFK kicker (
/showthread.php?tid=431821)
Errors in creating advanced AFK kicker -
Mattakil - 20.04.2013
Okay so, I tried to make an AFK kicker using this include:
https://sampforum.blast.hk/showthread.php?tid=281590 and I was gonna make it so when you are AFK for 20 minutes, a dialog comes up and you have 30 seconds to click ok or get kicked. The dialog was bugging for some reason so I removed it, pawno is still generating errors for everything, like "KillTimer" Could it be the include?
pawn Код:
public OnPlayerUpdate(playerid)
{
if(IsPlayerAFKing{playerid})
{
SetTimer("afkick", 1200000, false);
else
killTimer(afkick);
}
}
/*public afk()
if(IsPlayerAFKing{playerid})
{
{
ShowPlayerDialog(playerid, AFKmessage, DIALOG_STYLE_MSGBOX, "AFK Kicker", "Are you still here?\nYou have 30 seconds to\nclick the button below or you will be kicked.", "I'm still here!", "");
SetTimer("afkick", 30000, false);
}
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == AFKmessage)
{
if(response)
{
KillTimer(afkick);
}
else
{
KillTimer(afkick);
}*/
public afkick()
{
if(IsPlayerAFKing{playerid})
{
{
new string[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(i, name, sizeof(name));
format(string, sizeof(string), "[AFK]%s was kicked for AFKing.",name);
SendClientMessage(playerid, 0xFF0000AA, "You have been kicked for AFKing too long.");
Kick(playerid);
SendClientMessageToAll(0xFF0000AA,string);
}
}
}
public OnFilterScriptExit()
{
return 1;
}
AW: Errors in creating advanced AFK kicker -
[AK]Nazgul - 20.04.2013
Yeah well you need to assign the SetTimer to a variable, like
pawn Код:
// somewhere on top of your script
new ktimer;
//In onplayerupdate
ktimer = SetTimerEx("afkkick",30000,false,"i",playerid); //settimerex because settimer would always be set only for ID 0
else KillTimer(ktimer)