Help with Anti AFK system! - 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 with Anti AFK system! (
/showthread.php?tid=488696)
Help with Anti AFK system! -
sniperwars - 18.01.2014
Me and my friend have made this Anti AFK sytem but it doesn't seem to show the dialog.
Here is the code:
pawn Код:
/*Declared New*/
new AFK_Timer[MAX_PLAYERS];
new AFK_Kick_S[MAX_PLAYERS];
new acstring[128];
/*Dialogs*/
#define DIALOG_AFK 11
/*Forwards*/
forward AFK_Kick(playerid);
forward AFK_Bye(playerid);
/*Publics*/
public AFK_Kick(playerid)
{
ShowPlayerDialog(playerid, DIALOG_AFK, DIALOG_STYLE_MSGBOX, "Are you here ?", "This system is checking if you are AFK.\nYou will see this message if you are in-active for 1 minute.\nYou have 20 seconds to press the continue button.", "Continue", "");
AFK_Timer[playerid] = SetTimer("AFK_Bye", 20000, false);
return 1;
}
public AFK_Bye(playerid)
{
format(acstring, sizeof(acstring), "{FF4500}[ANTI CHEAT]{EE0000} %s (%i){FF4500} has been kicked from server. Reason: AFK (Away From Keyboard)", GetName(playerid), playerid);
SendClientMessageToAll(COLOR_ORANGE, acstring);
SetTimer("AntiCheat", 100, false);
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_AFK)
{
if(response)
{
KillTimer(AFK_Timer[playerid]);
KillTimer(AFK_Kick_S[playerid]);
}
}
return 1;
}
I don't know why the dialog doesn't show. Can someone fix this ? A reputation point will be give to the person who fixes this.
Re: Help with Anti AFK system! -
br0adyb0ii - 19.01.2014
Looks like your missing these
pawn Код:
forward AFK_Kick(playerid)
forward AFK_Bye(playerid)
Re: Help with Anti AFK system! -
Riddick94 - 19.01.2014
Quote:
Originally Posted by sniperwars
Me and my friend have made this Anti AFK sytem but it doesn't seem to show the dialog.
Here is the code:
pawn Код:
/*Declared New*/ new AFK_Timer[MAX_PLAYERS]; new AFK_Kick_S[MAX_PLAYERS]; new acstring[128];
/*Dialogs*/ #define DIALOG_AFK 11
/*Forwards*/ forward AntiAFK();
/*Publics*/ public AFK_Kick(playerid) { ShowPlayerDialog(playerid, DIALOG_AFK, DIALOG_STYLE_MSGBOX, "Are you here ?", "This system is checking if you are AFK.\nYou will see this message if you are in-active for 1 minute.\nYou have 20 seconds to press the continue button.", "Continue", ""); AFK_Timer[playerid] = SetTimer("AFK_Bye", 20000, false); return 1; }
public AFK_Bye(playerid) { format(acstring, sizeof(acstring), "{FF4500}[ANTI CHEAT]{EE0000} %s (%i){FF4500} has been kicked from server. Reason: AFK (Away From Keyboard)", GetName(playerid), playerid); SendClientMessageToAll(COLOR_ORANGE, acstring); SetTimer("AntiCheat", 100, false); return 1; }
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == DIALOG_AFK) { if(response) { KillTimer(AFK_Timer[playerid]); KillTimer(AFK_Kick_S[playerid]); } } return 1; }
I don't know why the dialog doesn't show. Can someone fix this ? A reputation point will be give to the person who fixes this.
|
Is that your full code? I hope, that you're actually calling AFK_Kick(playerid); function? If so, make sure that your dialog id is not colliding with different dialog id of yours. Remember, it might be also colliding with dialogid from filterscripts.
Re: Help with Anti AFK system! -
sniperwars - 19.01.2014
Nope, I forgot to add them to the topic. The forwards are there. I don't use filterscripts, everything runs from the gamemode but the dialogs aren't work still.
Edit: I have edited the first post.
Re: Help with Anti AFK system! -
sniperwars - 19.01.2014
Never mind, this has been fixed. Thread can be locked.