02.04.2012, 15:16
Hello, i have recently made a command which makes a person admin is you /setadmin [ID] [ LEVEL ]
But when im in game and type /setadmin 0 1
It says " That user is not connected " but ID 0 is me
Im really confused here is the command
If you need any other part of the code just reply
If i have included
But when im in game and type /setadmin 0 1
It says " That user is not connected " but ID 0 is me
Im really confused here is the command
If you need any other part of the code just reply
If i have included
Код:
#include <zcmd> #include <sscanf2>
Код:
CMD:setadmin(playerid, params[]) { if(!IsPlayerAdmin(playerid))return 0; //This command only works for rcon if(sscanf(params,"ui",ID,levels)) return SendClientMessage(playerid,0xFF9900AA, "USAGE: /setadmin [ID] [Level 1-4]");//it will show this if you dont use the format properly if(levels > 5) return SendClientMessage(playerid,0xFF0000FF,"LEVELS AVAILABLE 1-5!");//Available levels if(!IsPlayerConnected(ID))return SendClientMessage(playerid,COLOR_PURPLE,"That user is not connected.");//Detect if the id/partofname is connected if(PlayerData[ID][AdminLevel] == levels) return SendClientMessage(playerid,0xFF0000FF, "ERROR: That person is already this admin level!");//Detect if the guy is already the level you setted GetPlayerName(playerid,Nam, MAX_PLAYER_NAME);//define the playerid name GetPlayerName(ID,pname,MAX_PLAYER_NAME);//define the other person name if(levels == 0) { format(str, sizeof(str),"%s has your Admin level to %d on the server. *cry *cry",Nam,levels); SendClientMessage(ID,0xFF9900AA,str); format(str, sizeof(str),"You had set %s Admin level to %d!",pname,levels); SendClientMessage(playerid,0xFF9900AA,str); PlayerData[ID][AdminLevel] = levels;//this sets the player level return 1; } format(str, sizeof(str),"%s has your Admin level to %d on the server.",Nam,levels); SendClientMessage(ID,0xFF9900AA,str); format(str, sizeof(str),"You had set %s Admin level to %d!",pname,levels); SendClientMessage(playerid,0xFF9900AA,str); PlayerData[ID][AdminLevel] = levels; return 1; }