19.06.2014, 13:14
Hello guys i wanted to ask you whats bad with my simple ban system.Cause when i ban player and he reconnects server crashes.
Код:
if(fexist(UserPath(playerid))) { INI_ParseFile(UserPath(playerid), "LoadUser_data", .bExtra = true, .extra = playerid); if(PlayerInfo[playerid][Banned] == 1) { new pName[MAX_PLAYER_NAME]; GetPlayerName(playerid,pName,sizeof(pName)); SendClientMessageToAll(COL_RED,"Server blocked the connection for %s.Reason: Banned."); SendClientMessage(playerid,COL_RED,"You are banned in this server!"); Kick(playerid); } else { ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"{ff0000}Login","{00ff66} Type your password below to login.","Login","Quit"); } }
Код:
CMD:ban(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid,COL_ADMINGREEN,"This command is only for 3 level admins or higher!"); new reason[60],pName[MAX_PLAYER_NAME],aName[MAX_PLAYER_NAME],targetid,string[200],string0[150],str[100]; if(sscanf(params, "us[64]", targetid, reason)) return SendClientMessage(playerid, COL_ADMINGREEN, ""TCRED"USAGE:"TCADMINGREEN" /ban [PlayerID or Name] [Reason]"); if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,COL_ADMINGREEN,"Player is not connected!"); SavePlayerData(targetid); GetPlayerName(playerid,aName,sizeof(aName)); GetPlayerName(targetid,pName,sizeof(pName)); format(string,sizeof(string),""TCWHITE"["TCRED"%s"TCWHITE"]"TCYELLOW"%s "TCADMINGREEN"banned "TCRED"%s "TCADMINGREEN"from the server.[Reason : "TCRED"%s"TCADMINGREEN"]",AdminRank(playerid),aName,pName,reason); SendClientMessageToAll(COL_LIGHTBLUE,string); format(string0,sizeof(string0),"You have been banned from the server!By: %s. Reason: %s",aName,reason); SendClientMessage(targetid,COL_LIGHTBLUE,string0); format(str,sizeof(str),"[%s]%s banned %s from the server.[Reason : %s]",AdminRank(playerid),aName,pName,reason); print(str); Kick(targetid); PlayerInfo[targetid][Banned] = 1; return 1; }