SA-MP Forums Archive
AFK Manager.. - 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 Manager.. (/showthread.php?tid=347294)



AFK Manager.. - Dr0gIraN - 01.06.2012

Hello!I would like to ask how you can do when a player is AFK with the put "ESC" for some time him teleport somewhere?

Sorry for my bad English!


Re: AFK Manager.. - TzAkS. - 01.06.2012

Do you have a afk sistem?
If you have it add to the script where it`s set him afk,SetPlayerPos..


Re: AFK Manager.. - OsamaBg - 01.06.2012

asks for idle time
If a player came up with alt + tab or ESC after 1 minute to transfer zone in the AFК


Re: AFK Manager.. - Sandiel - 01.06.2012

For this you'll need ZCMD, and sscanf.
Place this in OnPlayerConnect
Code:
 PlayerInfo[playerid][pAfk] = 0;
The command that a player uses to go Afk.
Code:
COMMAND:afk(playerid, params[])
{
	new Float;originalX, Float:originalY, Float:originalZ;
	if(PlayerInfo[playerid][pAfk] == 0)
	{
	    GetPlayerPos(playerid, originalX, originalY, originalZ);
		PlayerInfo[playerid][pAfk] = 1;
		SetPlayerPos(playerid, //pos for the teleport location, your choice);
		new pName[MAX_PLAYER_NAME], str[128];
		GetPlayerName(playerid, pName, sizeof(pName));
		format(str, sizeof(str), "[SERVER]: %s (ID:%d) is now on AFK mode", pName, playerid);
		SendClientMessageToAll(COLOR_YELLOW, str);
		TogglePlayerControllable(playerid, 0);
	}
	else if(PlayerInfo[playerid][pAfk] == 1)
	{
		PlayerInfo[playerid][pAfk] = 0;
		SetPlayerPos(playerid, //pos for the teleport location, your choice);
		new pName[MAX_PLAYER_NAME], str[128];
		GetPlayerName(playerid, pName, sizeof(pName));
		format(str, sizeof(str), "[SERVER]: %s (ID:%d) is now off AFK mode", pName, playerid);
		SendClientMessageToAll(COLOR_YELLOW, str);
		TogglePlayerControllable(playerid, 1);
		SetPlayerPos(playerid, originalX, originalY, originalZ);
	}
	return 1;
}
This is what I understood from your question, hope that I helped you..


Re: AFK Manager.. - TzAkS. - 01.06.2012

Quote:
Originally Posted by Sandiel
View Post
For this you'll need ZCMD, and sscanf.
Place this in OnPlayerConnect
Code:
 PlayerInfo[playerid][pAfk] = 0;
The command that a player uses to go Afk.
Code:
COMMAND:afk(playerid, params[])
{
	if(PlayerInfo[playerid][pAfk] == 0)
	{
		PlayerInfo[playerid][pAfk] = 1;
		SetPlayerPos(playerid, //pos for the teleport location, your choice);
		new pName[MAX_PLAYER_NAME], str[128];
		GetPlayerName(playerid, pName, sizeof(pName));
		format(str, sizeof(str), "[SERVER]: %s (ID:%d) is now on AFK mode", pName, playerid);
		SendClientMessageToAll(COLOR_YELLOW, str);
		TogglePlayerControllable(playerid, 0);
	}
	else if(PlayerInfo[playerid][pAfk] == 1)
	{
		PlayerInfo[playerid][pAfk] = 0;
		SetPlayerPos(playerid, //pos for the teleport location, your choice);
		new pName[MAX_PLAYER_NAME], str[128];
		GetPlayerName(playerid, pName, sizeof(pName));
		format(str, sizeof(str), "[SERVER]: %s (ID:%d) is now off AFK mode", pName, playerid);
		SendClientMessageToAll(COLOR_YELLOW, str);
		TogglePlayerControllable(playerid, 1);
	}
	return 1;
}
This is what I understood from your question, hope that I helped you..
If you wanna help him,post all the script,that`s just the commands..

Try this FS and set when player is AFK to teleport him..

https://sampforum.blast.hk/showthread.php?tid=189884


Re: AFK Manager.. - Sandiel - 01.06.2012

Quote:
Originally Posted by TzAkS.
View Post
If you wanna help him,post all the script,that`s just the commands..

Try this FS and set when player is AFK to teleport him..

https://sampforum.blast.hk/showthread.php?tid=189884
All I got from his topic is that he need an AFK system? it's not automatic, once a player has to go he can /afk and get TP'd to the AFK zone (the zone is editable, he can set it anywhere), if he's back he'll /afk again, and be TP'd back to his original place...