18.09.2011, 14:55
I made this MakeAdmin cmd here:
But the level is the same than the id i put in! i even put the space at sscanf so it wont take the first param but it does! how to fix it?
Код:
CMD:makeadmin(playerid, params[]) { if(IsPlayerAdmin(playerid)) { if(isnull(params)) { SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: /Makeadmin [ID] [Level]"); return 1; } if(!isnumeric(params)) { SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: /Makeadmin [ID] [Level]"); return 1; } new targetid = strval(params); new SendMSG[180]; new SendMSGtoall[180]; new SendMSGtoguy[180]; new Givername[MAX_PLAYER_NAME]; new Receivername[MAX_PLAYER_NAME]; new levelz; sscanf(params," i",levelz); if(levelz > 5) { SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Max admin level is 5!"); return 1; } GetPlayerName(playerid,Givername,sizeof(Givername)); GetPlayerName(targetid,Receivername,sizeof(Receivername)); format(SendMSGtoguy,sizeof(SendMSGtoguy),"{B900EF}Admin %s(%d) has made you an Administrator level %d!",Givername,playerid,levelz); format(SendMSG,sizeof(SendMSG),"{B900EF}You made %s(%d) an Admin level %d!",Receivername,targetid,levelz); format(SendMSGtoall,sizeof(SendMSGtoall),"{B900EF}Admin %s(%d) has made %s(%d) an Admin! Level:%d",Givername,playerid,Receivername,targetid,levelz); SendClientMessage(targetid,COLOR_WHITE,SendMSG); SendClientMessageToAll(COLOR_WHITE,SendMSGtoall); SendClientMessage(targetid,COLOR_WHITE,SendMSGtoguy); AdminLevel[playerid] = levelz; return 1; } else return 0; }