#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; }
Well...How do you want to set yourself as an admin if you're not admin yet :S.And try setting yourself as admin from database
|
Do you have the latest sscanf?
There was a bug with the 'u' specifier which ****** fixed yesterday. |
Well...How do you want to set yourself as an admin if you're not admin yet :S.And try setting yourself as admin from database
|
:S MySQL database is quite hard,you should start with dini if you're a beginner
![]() |
#include <a_samp> #include <streamer> #include <zcmd> #include <foreach> #include <sscanf2> #include <YSI\y_ini>