01.06.2012, 12:51
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!
Sorry for my bad English!
PlayerInfo[playerid][pAfk] = 0;
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; }
For this you'll need ZCMD, and sscanf.
Place this in OnPlayerConnect Code:
PlayerInfo[playerid][pAfk] = 0; 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; } |
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 |