SA-MP Forums Archive
HELP WITH /setadmin "URGENTLY" FAST! - 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: HELP WITH /setadmin "URGENTLY" FAST! (/showthread.php?tid=544960)



HELP WITH /setadmin "URGENTLY" FAST! - Toxik - 05.11.2014

Okay This is the codes but need fix them They ingame setting Level 1 .. and if im using /setadmin id 1,2,3,4or 5
and if possible Only rcon can set admin Levels
pawn Код:
CMD:setadmin(playerid,params[])
{
    new ID;
//    new Admin;
    new string[128];
    if(PlayerInfo[playerid][Admin] >= 5)
    {
        if(sscanf(params,"ui", ID, Admin)) return SendClientMessage(playerid,-1,"{FF0000}USAGE: {15FF00}/SetAdmin [ID] [Level]");
        if(!IsPlayerConnected(ID)) return SendClientMessage(playerid,-1,"Player is not connected");
        PlayerInfo[ID][Admin] = Admin;
        format(string, sizeof(string), "{FF0000}[INFO]: {15FF00}You gave to {FF0000}%s {15FF00}Admin Level {0066CC}: %i", GetPName(ID), Admin);
        SendClientMessage(playerid, -1, string);
        format(string, sizeof(string), "{FF0000}[INFO]: {15FF00}Admin {FF0000}%s {15FF00}has setted your Admin Level to{0066CC}: %i", GetName(playerid), Admin);
        SendClientMessage(ID, -1, string);
    }
    else
    {
        SendClientMessage(playerid, -1, "You need to be Admin Level 5 !");
    }
    return 1;
}

stock GetPName(playerid)
{
    new Name[24];
    GetPlayerName(playerid, Name,24);
    return Name;
}



Re: HELP WITH /setadmin "URGENTLY" FAST! - Mitchelll - 05.11.2014

I don't understand what you saying. Try to be clear, i may help you right away.


Re: HELP WITH /setadmin "URGENTLY" FAST! - Toxik - 05.11.2014

|RESOLVED|


Respuesta: Re: HELP WITH /setadmin "URGENTLY" FAST! - Spreadhaz - 05.11.2014

Quote:
Originally Posted by Toxik
Посмотреть сообщение
when i try ingame to /setadmin (someones id) (level )
whatever level i put there all time give them lvl 1
Change

// new Admin;

and put

new level;

then replace all "Admin" for set "level", exept in this part: PlayerInfo[ID][Admin]


you will have this:

pawn Код:
CMD:setadmin(playerid,params[])
{
    new ID;
    new level;
    new string[128];
    if(PlayerInfo[playerid][Admin] >= 5)
    {
        if(sscanf(params,"ui", ID, level)) return SendClientMessage(playerid,-1,"{FF0000}USAGE: {15FF00}/SetAdmin [ID] [Level]");
        if(!IsPlayerConnected(ID)) return SendClientMessage(playerid,-1,"Player is not connected");
        PlayerInfo[ID][Admin] = level;
        format(string, sizeof(string), "{FF0000}[INFO]: {15FF00}You gave to {FF0000}%s {15FF00}Admin Level {0066CC}: %i", GetPName(ID), level);
        SendClientMessage(playerid, -1, string);
        format(string, sizeof(string), "{FF0000}[INFO]: {15FF00}Admin {FF0000}%s {15FF00}has setted your Admin Level to{0066CC}: %i", GetName(playerid), level);
        SendClientMessage(ID, -1, string);
    }
    else
    {
        SendClientMessage(playerid, -1, "You need to be Admin Level 5 !");
    }
    return 1;
}

stock GetPName(playerid)
{
    new Name[24];
    GetPlayerName(playerid, Name,24);
    return Name;
}
The problem was, you have not definied nothing because you have // before the new Admin;
Also, you Have PlayerInfo[playerid][Admin], if you are using Admin you should not declare any variable with same name.


Re: HELP WITH /setadmin "URGENTLY" FAST! - Mitchelll - 05.11.2014

try this.

pawn Код:
sscanf(params, "id", ID, level))



Re: HELP WITH /setadmin "URGENTLY" FAST! - Toxik - 05.11.2014

i solved it