SA-MP Forums Archive
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: afk system (/showthread.php?tid=389725)



afk system - SamiHam - 03.11.2012

what is the afk system that when u /afk take u to lv and change word and put near ur name [AFK]_%s


Re: afk system - HarryPotter - 03.11.2012

add this at the top;

Код:
new playerAFK[MAX_PLAYERS];
new playerAFKTime[MAX_PLAYERS];
this OnPlayerConnect

Код:
playerAFKTime[playerid] = 0; playerAFK[playerid] = 0;
and then this to the bottom of ur script:

Код:
CMD:afk(playerid, params[]) {
	if(PlayerInfo[playerid][pAdmin] >= 2) {

		new
		szMessage[36 + MAX_PLAYER_NAME];

		SendClientMessageEx(playerid,COLOR_WHITE,"Listing all AFK players...");
		foreach(Player, i) if(playerAFK[i] != 0 && playerAFKTime[i] > 60) {
			format(szMessage,sizeof(szMessage),"* %s (ID %d), AFK for %d minutes.", GetPlayerNameEx(i), i, playerAFKTime[i] / 60);
			if(PlayerInfo[i][pAdmin] >= 2) SendClientMessageEx(playerid,COLOR_RED,szMessage);
			else SendClientMessageEx(playerid,COLOR_GREY,szMessage);
		}
	}
	else SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use this command.");
	return 1;
}