SA-MP Forums Archive
[HELP] How to make 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] How to make AFK system??? (/showthread.php?tid=253468)



[HELP] How to make AFK system??? - Type-R - 06.05.2011

Hello, i want to make an AFK system and i don't know how to. I know that there should be Timers that getplayerpos and then after a while get playerpos af if the positions the same player gets kicked, if not the same routine goes on, but could someone give me a hint where to start?


Re: [HELP] How to make AFK system??? - Kobatz - 06.05.2011

Here study this:
Код:
if (strcmp("/afk", cmdtext, true, 10) == 0)
         {
		GameTextForPlayer(playerid, "~g~You are now ~r~Away From Keyboard",5000,3);
		TogglePlayerControllable(playerid,0);
		SetPlayerHealth(playerid,1000000);
		new string[256], pname[MAX_PLAYER_NAME];
		GetPlayerName(playerid, pname, sizeof(pname));
		format(string, sizeof(string), "You are now Away From keyboard %s(/afk)", pname);
		SendClientMessageToAll(COLOR_RED, string);
		return 1;
	}
	if (strcmp("/back", cmdtext, true, 10) == 0)
        {
		GameTextForPlayer(playerid, "~g~You are now ~r~back on keyboard",5000,3);
		TogglePlayerControllable(playerid,1);
		SetPlayerHealth(playerid,100);
		new string[256], pname[MAX_PLAYER_NAME];
		GetPlayerName(playerid, pname, sizeof(pname));
		format(string, sizeof(string), "%s You are now back on keyboard(/back)", pname);
		SendClientMessageToAll(COLOR_RED, string);
		return 1;
	}
Sorry i can't explain you how to make this,i can give you CMD only because i didn't made this.
(I understand it i can make CMD easy i just have to deal with some virus and i don't know how to explain it very well because i'm newbie scripter).

Good luck.


Re: [HELP] How to make AFK system??? - Type-R - 06.05.2011

i'm trying to make an automatic one.


Respuesta: [HELP] How to make AFK system??? - Alex_Obando - 06.05.2011

Download this:
http://solidfiles.com/d/515a1/

pawn Код:
#include OnPlayerPause

public OnPlayerPause(playerid)
{
    new name[MAX_PLAYER_NAME], string[44];
    GetPlayerName(playerid, name, sizeof(name));
    format(string, sizeof(string), "%s is now AFK.",name);
    SendClientMessageToAll(COLOR_GOLD, string);
    return 0;
}
 
public OnPlayerUnPause(playerid)
{
    new name[MAX_PLAYER_NAME], string[44];
    GetPlayerName(playerid, name, sizeof(name));
    format(string, sizeof(string), "%s is BACK.",name);
    SendClientMessageToAll(COLOR_GOLD, string);
    return 0;
}



Re: [HELP] How to make AFK system??? - Type-R - 07.05.2011

I tried doing it like that, but it didn't work