SA-MP Forums Archive
makeadmin help! Rep for helping - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: makeadmin help! Rep for helping (/showthread.php?tid=536993)



makeadmin help! Rep for helping - MrCallum - 13.09.2014

Here is my makeadmin command below, when i do it in game it says i am not admin yet in my settings i place myself as admin!

Код:
CMD:makeadmin(playerid,params[])
{
new targetid,level,string[120];
if(sscanf(params,"ui",targetid,level)) return SendClientMessage(playerid,-1,"[ERROR] /makeadmin [PlayerID] [Admin Level]");
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,red,"[ERROR] You are not an admin.");
if(level < 0 || level > 8) return SendClientMessage(playerid,red,"[ERROR] Only level 0-8");
pInfo[targetid][pAdmin] = level;
format(string,sizeof(string),"[ADMIN] %s[%d] has set your Admin level to:%d",GetName(playerid),playerid,level);
SendClientMessage(targetid,-1,string);
return 1;
}
Enum:
Код:
enum PlayerInfo
{
    Pass[129],
    pAdmin,
    pMod,
    pMoney,
    pLevels
}



Re: makeadmin help! Rep for helping - TheNerka - 13.09.2014

if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,red,"[ERROR] You are not an admin.");

Login to RCON Admin


Re: makeadmin help! Rep for helping - ChandraLouis - 13.09.2014

Try mine (havent test it yet):
pawn Код:
CMD:setlevel(playerid, params[])
{
    new ID, levels;
    new pname[100];
    new Nam[100];
    if(!IsPlayerAdmin(playerid))return 0;
    if(sscanf(params,"ui",ID,levels)) return SendClientMessage(playerid,0xFF9900AA, ""COL_GREEN"[Usage]: /setadmin [ID] [Level 1-5]");
    if(levels > 5) return SendClientMessage(playerid,0xFF0000FF,""COL_RED"[Error]: "COL_LIGHTBLUE"Maximal Admin Level is 5.");
    if(!IsPlayerConnected(ID))return SendClientMessage(playerid,-1,""COL_RED"[Error]: The user is not connected or invalid id.");
    if(pInfo[ID][pAdmin] == levels) return SendClientMessage(playerid,0xFF0000FF, ""COL_RED"[Error]: "COL_LIGHTBLUE"The person is already have this admin level.");
    GetPlayerName(playerid,Nam, MAX_PLAYER_NAME);
    GetPlayerName(ID,pname,MAX_PLAYER_NAME);
    format(string, sizeof(string),""COL_LIGHTBLUE"[Promoted]: "COL_GREEN"Administrator %s set your admin level to %d, Congratulations!",Nam,levels);
    SendClientMessage(ID,0xFF9900AA,string);
    format(string, sizeof(string),"[Adm-CMD]: "COL_GREEN"You have set player %s Admin level to level %d!",pname,levels);
    SendClientMessage(playerid,0xFF9900AA,string);
    pInfo[ID][pAdmin] = levels;
    return 1;
}