HELP WITH /setadmin "URGENTLY" FAST!
#1

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;
}
Reply
#2

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

|RESOLVED|
Reply
#4

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.
Reply
#5

try this.

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

i solved it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)