27.10.2014, 05:19
My Server Crashes when i /setadmin a Player. Why ?
Here is my /setadmin Code !
Here is my /setadmin Code !
Код:
dcmd_setadmin(playerid,params[]) { new string[128]; new string2[128]; new ID; new cmdreason; if(sscanf(params,"ui",ID,cmdreason)) { SendClientMessage(playerid,COLOR_ERROR,"{CACA00}[INFO]{FFFFFF}: /setadmin (Player Name/ID) (Level)"); return 1; } if(IsSpawned[playerid] != 1) { SendClientMessage(playerid,COLOR_ERROR,"You must be spawned to use any command."); return 1; } if(ID == INVALID_PLAYER_ID) { format(string,sizeof(string),"The player ID (%d) is not connected to the server. You cannot set their administrator level.",ID); SendClientMessage(playerid,COLOR_ERROR,string); return 1; } if(PLAYERLIST_authed[ID] != 1) { format(string,sizeof(string),"%s(%d) is not logged into to the server. You must wait till they login before you set their administrator level.",PlayerName(ID),ID); SendClientMessage(playerid,COLOR_ERROR,string); return 1; } if(AdminLevel[playerid] == 4 && cmdreason >= 5) { SendClientMessage(playerid,COLOR_ERROR,"You can set from 1-4 levels."); return 1; } if(AdminLevel[playerid] == 5 && cmdreason >= 6) { SendClientMessage(playerid,COLOR_ERROR,"You can set from 1-5 levels."); return 1; } if(AdminLevel[ID] > AdminLevel[playerid]) { format(string,sizeof(string),"%s(%d) Level's is more than your Level you can't Set His admin Level",PlayerName(ID),ID); SendClientMessage(playerid,COLOR_ERROR,string); return 1; } if(AdminLevel[ID] == cmdreason) { format(string,sizeof(string),"%s(%d) is already at the Administrator level: %d",PlayerName(ID),ID,cmdreason); SendClientMessage(playerid,COLOR_ERROR,string); return 1; } format(string,sizeof(string),"Administrator %s(%d) have given you Admin Level : %d.",PlayerName(playerid),playerid,cmdreason); SendClientMessage(ID,COLOR_ADMIN,string); AdminLevel[ID] =cmdreason; format(string,sizeof(string),"You have given %s(%d) Admin Level : %d.",PlayerName(ID),ID,cmdreason); SendClientMessage(playerid,COLOR_ADMIN,string); format(string,sizeof(string),"9[ADMIN LEVEL CHANGE] %s(%d) has given %s(%d) the administrator level %d.",PlayerName(playerid),playerid,PlayerName(ID),ID,cmdreason); IRC_GroupSay(gGroupID,IRC_CHANNEL,string); format(string,sizeof(string),"[ADMIN-COMMAND] %s(%d) has used /setadmin on %s(%d)",PlayerName(playerid),playerid,PlayerName(ID),ID); SendClientMessageToAllAdmins(string); format(string2,sizeof(string2),"%s(%d) has given %s(%d) the administrator level %d.",PlayerName(playerid),playerid,PlayerName(ID),ID,cmdreason); AdminLog(string2); return 1; }