Whats Wrong ?
#1

Hi guys I make /makeadmin cmd from zcmd but when I do [/makeadmin 0 5] its sets my level to 0 else of 5 , I have same bug with same cmd like on /heal....

Here's my code.
pawn Код:
CMD:makeadmin(playerid, params[])
{
         new string[256],giveid,value;
        new sendername[MAX_PLAYER_NAME];
        new giveplayer[MAX_PLAYER_NAME];
            if (PlayerInfo[playerid][pAdminLevel] >= 4)
            {
        if (sscanf(params, "ui", giveid, value))
        return SendClientMessage(playerid,USAGE,"**USAGE:/MakeAdmin [Playerid/PlayerName] [Level]");

                if (value > 5)
                 return SendClientMessage(playerid, GREY,"* Only levels 0-5 Are allowed!");
                 
             GetPlayerName(playerid, sendername, sizeof(sendername));
             GetPlayerName(giveid, giveplayer, sizeof(giveplayer));
             PlayerInfo[giveid][pAdminLevel] = value ;
             format(string,sizeof(string),"Admin %s has set your Admin Level to %d",sendername,value);
             SendClientMessage(giveid,RED,string);
             format(string,sizeof(string),"You gave %s admin level %d",giveplayer,value);
             SendClientMessage(playerid,RED,string);
             }
        return 1;
}
Reply
#2

Try this version:
pawn Код:
CMD:makeadmin(playerid, params[])
{
    new PlayerID, Level, PlayerN[MAX_PLAYER_NAME], Player2N[MAX_PLAYER_NAME], Str[128];
    if(sscanf(params, "ui", PlayerID, Level)) return SendClientMessage(playerid,USAGE,"**USAGE:/MakeAdmin [Playerid/PlayerName] [Level]");

    if(Level < 0 || Level > 5) return SendClientMessage(playerid, GREY,"* Only levels 0-5 Are allowed!");

    GetPlayerName(playerid, PlayerN, sizeof(PlayerN));
    GetPlayerName(PlayerID, Player2N, sizeof(Player2N));

    PlayerInfo[PlayerID][pAdminLevel] = Level;

    format(Str, sizeof(Str), "Admin: %s(%d) has set your admin level to: %d", PlayerN, playerid, Level); // Person who used the command
    SendClientMessage(PlayerID, red, Str); // Sending Message to the other player

    format(Str, sizeof(Str), "You have given: %s(%d) admin level: %d", Player2N, PlayerID, Level); // Other Player
    SendClientMessage(playerid, red, Str); // Sending Message to the player who used the command
    return 1;
}
Reply
#3

Same Bug:

Check this-

-----------------------------------------------------------------
Reply
#4

Try chaning UI in the sccanf parameter to UD.. not sure really, I and D do the same thing but its still worth a try
Reply
#5

Quote:
Originally Posted by DarrenReeder
Посмотреть сообщение
Try chaning UI in the sccanf parameter to UD.. not sure really, I and D do the same thing but its still worth a try
I try also D...same bug
Reply
#6

*BUMP* please help
Reply
#7

maybe change i to d?
pawn Код:
if (sscanf(params, "ud", giveid, value))
SMALL D
Reply
#8

Quote:
Originally Posted by DRIFT_HUNTER
Посмотреть сообщение
maybe change i to d?
pawn Код:
if (sscanf(params, "ud", giveid, value))
SMALL D
Ye Not working too...
Reply
#9

Quote:
Originally Posted by iRana
Посмотреть сообщение
Ye Not working too...
Код:
CMD:makeadmin(playerid, params[])
{
    new PlayerID, Level, PlayerN[MAX_PLAYER_NAME], Player2N[MAX_PLAYER_NAME], Str[128];
    if(sscanf(params, "dd", PlayerID, Level)) return SendClientMessage(playerid,USAGE,"**USAGE:/MakeAdmin [Playerid/PlayerName] [Level]");

    if(Level < 0 || Level > 5) return SendClientMessage(playerid, GREY,"* Only levels 0-5 Are allowed!");

    GetPlayerName(playerid, PlayerN, sizeof(PlayerN));
    GetPlayerName(PlayerID, Player2N, sizeof(Player2N));

    PlayerInfo[PlayerID][pAdminLevel] = Level;

    format(Str, sizeof(Str), "Admin: %s(%d) has set your admin level to: %d", PlayerN, playerid, Level); // Person who used the command
    SendClientMessage(PlayerID, red, Str); // Sending Message to the other player

    format(Str, sizeof(Str), "You have given: %s(%d) admin level: %d", Player2N, PlayerID, Level); // Other Player
    SendClientMessage(playerid, red, Str); // Sending Message to the player who used the command
    return 1;
}
Reply
#10

pawn Код:
CMD:makeadmin(playerid, params[])
{
    new otherId, new otherName[MAX_PLAYER_NAME], new playerName[MAX_PLAYER_NAME];
    new adminLevel, new stri[128];
   
    if(PlayerInfo[playerid][pAdminLevel] < 4)
        return SendClientMessage(playerid, red, "[Error]: You are not authorized to use this command.");

    GetPlayerName(otherId, otherName, sizeof(otherName));
    GetPlayerName(playerid, playerName, sizeof(playerName));

    if(sscanf(params, "dd", otherId, adminLevel))
    {
        SendClientMessage(playerid, red, "[Usage]: /setadmin [playerid] [Admin Level]");
        return true;
    }
   
    if(PlayerInfo[otherId][pAdminLevel] == adminLevel)
    {
        format(stri, sizeof(stri), "[Error]: Player is already level %d.", adminLevel);
        SendClientMessage(playerid, red, stri);
        return true;
    }

    if(!IsPlayerConnected(otherId))
        return SendClientMessage(playerid, red, "[Error]: Invalid Player ID.");

    if(adminLevel < 0 || adminLevel > 4)
        return SendClientMessage(playerid, red, "[Error]: Level can't be higher than 4.");

    if(adminLevel > PlayerInfo[otherId][pAdminLevel]) {
    format(stri, sizeof(stri), "[AdminSys]: You have been promoted to level %d administrator, by admin %s", adminLevel, playerName);
    SendClientMessage(otherId, red, stri);
    format(stri, sizeof(stri), "[AdminSys]: You have promoted %s to level %d administrator.", otherName, adminLevel);
    SendClientMessage(playerid, red, stri); }
    if(adminLevel < PlayerInfo[otherId][pAdminLevel]) {
    format(stri, sizeof(stri), "[AdminSys]: You have been demoted to level %d administrator, by admin %s", adminLevel, playerName);
    SendClientMessage(otherId, red, stri);
    format(stri, sizeof(stri), "[AdminSys]: You have demoted %s to level %d administrator.", otherName, adminLevel);
    SendClientMessage(playerid, red, stri); }
    PlayerInfo[otherId][pAdmin] = adminLevel;
    return true;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)