Help me in fixing /setadmin command bug.
#1

when i type /setlevel 2 5. It always returns to the format.



When i even type /setlevel 0 4. It gives me the same results.

here is the code ↓

pawn Код:
//RCON COMMANDS
CMD:setadmin(playerid,params[])
{
    new level, targetid;
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You're not authorized to use that command!");
    if(sscanf(params,"ui",targetid,level)) return SendClientMessage(playerid,-1,"USAGE: /setadmin [playerid] [level]");
    if(level > 4) return SendClientMessage(playerid, COLOR_BRIGHTRED, "SERVER: Maximum Administrator level is 4.");
    if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_BRIGHTRED, "That player is not connected!");
    new MyString[128];
    new TargetString[128];
    format(MyString,sizeof MyString, "Administrator level set.", targetid, level);
    format(TargetString,sizeof TargetString, "You have been promoted to a Administrator. /help for more information");
    SendClientMessage(targetid, COLOR_LIGHTCYAN, TargetString );
    SendClientMessage(playerid, COLOR_GREEN, MyString);
    PlayerInfo[targetid][pAdmin] = level;
    return 1;
}
thank you.
Reply
#2

pawn Код:
CMD:setadmin(playerid,params[])
{
    if(IsPlayerAdmin(playerid))
    {
        new level, targetid;
        if(sscanf(params,"ud", targetid, level))
        {
            SendClientMessage(playerid, -1,"USAGE: /setadmin [playerid] [level]");
            return 1;
        }
        if(level > 4) return SendClientMessage(playerid, COLOR_BRIGHTRED, "SERVER: Maximum Administrator level is 4.");
        if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_BRIGHTRED, "That player is not connected!");
        new MyString[128];
        new TargetString[128];
        format(MyString,sizeof MyString, "Administrator level set.", targetid, level);
        format(TargetString,sizeof TargetString, "You have been promoted to a Administrator. /help for more information");
        SendClientMessage(targetid, COLOR_LIGHTCYAN, TargetString );
        SendClientMessage(playerid, COLOR_GREEN, MyString);
        PlayerInfo[targetid][pAdmin] = level;
        return 1;
    }
    else
    {
        SendClientMessage(playerid, COLOR_RED, "You're not authorized to use that command!");
        return 1;
    }
    return 1;
}
Reply
#3

nothing happened

Reply
#4

The codes work fine with me, I have no idea what is wrong, but try updating your sscanf
Reply
#5

i don't know why it is happining. I have a pm command in gamemode and it also bug like the setadmin command.
Reply
#6

Update your sscanf, lets see if it will do the same after that.
Reply
#7

Let me guess...
Outdated plugins.
Answer: I've already updated the plugins.
Do you recompile the script after updating it?
Answer: Already did.
Then show me your serverlog?

I did these words so that i don't waste my time posting post per post every time i ask it.
Reply
#8

updated my sscanf but nothing happened . but i want to say that /stats [id] is working. ↓

pawn Код:
CMD:stats(playerid,params[])
{
    new id = playerid;

    if(!isnull(params))
        id = strval(params);
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid,COLOR_RED,"Player is not connected");
    new money = PlayerInfo[id][pCash];
    new deaths = PlayerInfo[id][pDeaths];
    new kills = PlayerInfo[id][pKills];
    new warn = PlayerInfo[id][pWarns];
    new string[200];
    format(string,sizeof(string),"%s's Statistics: | Money: %d | Kills: %d | Deaths: %d | Ratio: %0.2f | Warns: %d| Wins: %d | RoundsPlayed: %d | Winning Ratio: %0.2f | ",paName(playerid),money,kills,deaths,Float:kills/Float:deaths,warn);
    SendClientMessage(playerid,COLOR_WHITE,string);
    return 1;
}
Reply
#9



Seriously? You're not even using sscanf at this line so how it will work?

Remove the id=playerid, isnull and id = ...

and replace it with

pawn Код:
new id;
if(sscanf(params, "u", id)) return //Error
You use it wrong.
Reply
#10

Jack, You were right. Just because of not using sscanf in /stats, the whole script was bugged. Thank you +Rep.

Quote:
Originally Posted by _Jake_
Посмотреть сообщение
Let me guess...
Outdated plugins.
Answer: I've already updated the plugins.
Do you recompile the script after updating it?
Answer: Already did.
Then show me your serverlog?

I did these words so that i don't waste my time posting post per post every time i ask it.
LoL, Fortune-Teller
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)