16.03.2013, 03:34
I have 4 functions that will kick a player in casse smth happens. I have login kicker, locked server kicked, fps kicker and ping kicker, 2 of them are called in onplayerconnect and i get the message with the kick message with the reason, however the other 2 are called in onplayerupdate and i dont get the message.
I already tried to call Update_FPS_Kicker and Update_Ping_Kicker with a time and it didnt worked either...
Plus in the 4 cases everytime someone is kicked by this 4 function the kick message appears 2 times. Like:
*** P3DRO has left the server (Kicked || Reason: Server Lock)
*** P3DRO has left the server (Kicked || Reason: Server Lock)
Pls help
Код:
public OnPlayerConnect(playerid) { Players[playerid][Kicked] = false; // Login if (!Players[playerid][LogIn]) { // /login <Password> SetTimerEx("Update_Login_Kicker", 30000, 0, "i", playerid); format(cmdstr, 150, "[Account Info] You have 30 Seconds to type /login <Password>"); SendClientMessage(playerid, ACC_COLOR, cmdstr); } // Server Lock if (Server[Lock]) { SetTimerEx("Update_Lock_Kicker", 30000, 0, "i", playerid); SendClientMessage(playerid, SERVER_COLOR, "[Server Info] You have 30 Seconds to type /pass <Password>"); } return 1; } public OnPlayerDisconnect(playerid, reason) { if (!Players[playerid][Kicked]) switch (reason) { case 0: format(cmdstr, 150, "*** %s has left the server (Timeout)", Players[playerid][Name]); case 1: format(cmdstr, 150, "*** %s has left the server (Leaving)", Players[playerid][Name]); case 2: format(cmdstr, 150, "*** %s has left the server (Kicked/Banned)", Players[playerid][Name]); } SendClientMessageToAll(COLOR, cmdstr); return 1; } public OnPlayerUpdate(playerid) { Update_FPS_Kicker(playerid); Update_Ping_Kicker(playerid); return 1; } Update_FPS_Kicker (playerid) { ... if (!Players[playerid][Kicked] && Players[playerid][FPSWarnings] > 50) { format(cmdstr, 150, "*** %s has left the server (Kicked || Reason: Low FPS)", Players[playerid][Name]); SendClientMessageToAll(COLOR, cmdstr); Players[playerid][Kicked] = true; SetTimerEx("KickPlayer", 1, false, "i", playerid); } return 1; } Update_Ping_Kicker (playerid) { ... if (!Players[playerid][Kicked] && Players[playerid][PingWarnings] > 5) { format(cmdstr, 150, "*** %s has left the server (Kicked || Reason: High Ping)", Players[playerid][Name]); SendClientMessageToAll(COLOR, cmdstr); Players[playerid][Kicked] = true; SetTimerEx("KickPlayer", 1, false, "i", playerid); } return 1; } forward Update_Login_Kicker (playerid); public Update_Login_Kicker (playerid) { if (!Players[playerid][Kicked] && !Players[playerid][LogIn]) { format(cmdstr, 150, "*** %s has left the server (Kicked || Reason: Fail Login)", Players[playerid][Name]); SendClientMessageToAll(COLOR, cmdstr); Players[playerid][Kicked] = true; SetTimerEx("KickPlayer", 1, false, "i", playerid); } return 1; } forward Update_Lock_Kicker (playerid); public Update_Lock_Kicker (playerid) { if (!Players[playerid][Kicked] && !Players[playerid][Unlock] && Server[Lock]) { format(cmdstr, 150, "*** %s has left the server (Kicked || Reason: Server Lock)", Players[playerid][Name]); SendClientMessageToAll(COLOR, cmdstr); Players[playerid][Kicked] = true; SetTimerEx("KickPlayer", 1, false, "i", playerid); } return 1; }
Plus in the 4 cases everytime someone is kicked by this 4 function the kick message appears 2 times. Like:
*** P3DRO has left the server (Kicked || Reason: Server Lock)
*** P3DRO has left the server (Kicked || Reason: Server Lock)
Pls help