/makeadmin command
#1

Can someone tell me what's wrong with this command? it's freakin' me out, if I try for exemple /makeadmin 0 1338 it sends me: Invalid player id... any ideas?
pawn Code:
CMD:makeadmin(playerid, params[])
{
    new pID, value;
    if(!(PlayerInfo[playerid][pAdmin] >= 1338)) return SendClientMessage(playerid, 0xFF0000AA, " you are not authorized to use this command!");
    else if (sscanf(params, "ui", pID, value)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: /makeadmin [playerid/partofname] [level 1-1338]");
    else if (value < 1 || value > 1338) return SendClientMessage(playerid, 0xFF0000AA, "Unknown level! Only 1 to 1338");
    else if(pID == INVALID_PLAYER_ID) return SCM(playerid, COLOR_GREY,"Invalid player id");
    else
    {
        new pName[MAX_PLAYER_NAME], tName[MAX_PLAYER_NAME], string[128];
        GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
        GetPlayerName(pID, tName, MAX_PLAYER_NAME);
        format(string, sizeof(string), "You have promoted %s to Admin level %i", tName, value);
        SCM(playerid, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "You have been promoted to Admin level %i by %s", value, pName);
        SCM(pID, COLOR_LIGHTBLUE, string);
        PlayerInfo[pID][pAdmin] = value;
    }
    return 1;
}
Reply
#2

pawn Code:
CMD:makeadmin(playerid, params[])
{
    new pName[64], file[128], string[128], level, id;
    GetPlayerName(id,(pName),sizeof(pName));
    format(file,sizeof(file), USER_FILE, pName);
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,0x0,"Only admins can use this command");
    if(sscanf(params, "i", level)) return SendClientMessage(playerid,0x0,"USAGE: /makeadmin [level]");
    if(level < 0 || level > 1338) return SendClientMessage(playerid,0x0,"Max Admin Level is 1338!");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid,0x0,"Player not found");
    else
    {
        pInfo[id][pAdmin] = level;
        dini_IntSet(file,"pAdmin",level);
        format(string,sizeof(string),"You have just set %s Admin Level to %i", pName, level);
        SendClientMessage(playerid,0x0,string);
        }
    return true;
}
Tell me if that works, please rep if it did
Reply
#3

Quote:
Originally Posted by uprp
View Post
pawn Code:
CMD:makeadmin(playerid, params[])
{
    new pName[64], file[128], string[128], level, id;
    GetPlayerName(id,(pName),sizeof(pName));
    format(file,sizeof(file), USER_FILE, pName);
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,0x0,"Only admins can use this command");
    if(sscanf(params, "i", level)) return SendClientMessage(playerid,0x0,"USAGE: /makeadmin [level]");
    if(level < 0 || level > 1338) return SendClientMessage(playerid,0x0,"Max Admin Level is 1338!");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid,0x0,"Player not found");
    else
    {
        pInfo[id][pAdmin] = level;
        dini_IntSet(file,"pAdmin",level);
        format(string,sizeof(string),"You have just set %s Admin Level to %i", pName, level);
        SendClientMessage(playerid,0x0,string);
        }
    return true;
}
Tell me if that works, please rep if it did
Nope, getting the same thing: Player not found
Reply
#4

Quote:
Originally Posted by Jafet_Macario
View Post
Nope, getting the same thing: Player not found
Must be your script, not the command, works fine on my test script.

Can i still get the rep? Ask a scripter to check your script.
Reply
#5

Quote:
Originally Posted by uprp
View Post
pawn Code:
CMD:makeadmin(playerid, params[])
{
    new pName[64], file[128], string[128], level, id;
    GetPlayerName(id,(pName),sizeof(pName));
    format(file,sizeof(file), USER_FILE, pName);
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,0x0,"Only admins can use this command");
    if(sscanf(params, "i", level)) return SendClientMessage(playerid,0x0,"USAGE: /makeadmin [level]");
    if(level < 0 || level > 1338) return SendClientMessage(playerid,0x0,"Max Admin Level is 1338!");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid,0x0,"Player not found");
    else
    {
        pInfo[id][pAdmin] = level;
        dini_IntSet(file,"pAdmin",level);
        format(string,sizeof(string),"You have just set %s Admin Level to %i", pName, level);
        SendClientMessage(playerid,0x0,string);
        }
    return true;
}
Tell me if that works, please rep if it did
Why did you Strip it ?, Funny, People stripping codes from GF Edits, and paste it to help others.
Reply
#6

Quote:
Originally Posted by G4M3Ov3r
View Post
Why did you Strip it ?, Funny, People stripping codes from GF Edits, and paste it to help others.
strip?

I use that command for my script, which i made from scratch, and not the server in my sig.

Think before you speak.
Reply
#7

Quote:
Originally Posted by uprp
View Post
strip?

I use that command for my script, which i made from scratch, and not the server in my sig.

Think before you speak.
Script From "Scratch", How do you know he has the same Defines ?, Example you use tName, he Uses pName.. Makes ALOT of Difference, Next time, Do it Yourself, instead of stripping it from your "scratch" script.
Reply
#8

Any others idea? ^^
Reply
#9

pawn Code:
CMD:makeadmin(playerid, params[])
{
    new pID, value;
    if(PlayerInfo[playerid][pAdmin] < 1338) return SendClientMessage(playerid, 0xFF0000AA, " you are not authorized to use this command!");
    if(sscanf(params, "ui", pID, value)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: /makeadmin [playerid/partofname] [level 1-1338]");
    if(value < 1 || value > 1338) return SendClientMessage(playerid, 0xFF0000AA, "Unknown level! Only 1 to 1338");
    if(pID == INVALID_PLAYER_ID) return SCM(playerid, COLOR_GREY,"Invalid player id");
   
    new pName[MAX_PLAYER_NAME], tName[MAX_PLAYER_NAME], string[128];
    GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
    GetPlayerName(pID, tName, MAX_PLAYER_NAME);
    format(string, sizeof(string), "You have promoted %s to Admin level %i", tName, value);
    SCM(playerid, COLOR_LIGHTBLUE, string);
    format(string, sizeof(string), "You have been promoted to Admin level %i by %s", value, pName);
    SCM(pID, COLOR_LIGHTBLUE, string);
    PlayerInfo[pID][pAdmin] = value;
    return 1;
}
Try that
Reply
#10

pawn Code:
CMD:makeadmin(playerid, params[])
{
    new pID, value;
    if(!(PlayerInfo[playerid][pAdmin] >= 1338)) return SendClientMessage(playerid, 0xFF0000AA, " you are not authorized to use this command!");
    else if (sscanf(params, "ui", pID, value)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: /makeadmin [playerid/partofname] [level 1-1338]");
    else if (value < 1 || value > 1338) return SendClientMessage(playerid, 0xFF0000AA, "Unknown level! Only 1 to 1338");
    else if(IsPlayerConnected(pID)) {
    if(pID == INVALID_PLAYER_ID) return SCM(playerid, COLOR_GREY,"Invalid player id");
    }
    else
    {
        new pName[MAX_PLAYER_NAME], tName[MAX_PLAYER_NAME], string[128];
        GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
        GetPlayerName(pID, tName, MAX_PLAYER_NAME);
        format(string, sizeof(string), "You have promoted %s to Admin level %i", tName, value);
        SCM(playerid, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "You have been promoted to Admin level %i by %s", value, pName);
        SCM(pID, COLOR_LIGHTBLUE, string);
        PlayerInfo[pID][pAdmin] = value;
    }
    return 1;
}
This should work
Reply
#11

@PrawkC - same thing

@G4M3Ov3r - When I type for exemple: /makeadmin Jafet 2, I'm getting:
Code:
You have promoted   to Admin level 2
SERVER: Unknown Command
But there is no effect... it doesn't even tell my name, You have promoted Jafet... But if I use
pawn Code:
sscanf(params,"ii", pID, value)
works but only on players ID's and I want this to work also on names... /makeadmin jafet 1338.Any ideas what can cause this?
Reply
#12

PHP Code:
if(sscanf(params"ui"pIDValue)) 
Reply
#13

Ye mate, but it's not working getting Player Not Connected
Reply
#14

Quote:
Originally Posted by Jafet_Macario
View Post
Ye mate, but it's not working getting Player Not Connected
What do you mean by getting Player Not Connected ?
Reply
#15

Are you using the sscanf plugin, or the sscanf stock ?
Reply
#16

@G4M3Ov3r - told from beggining,
pawn Code:
CMD:makeadmin(playerid, params[])
{
    new pID, value;
    if(!(PlayerInfo[playerid][pAdmin] >= 1338)) return SendClientMessage(playerid, 0xFF0000AA, " you are not authorized to use this command!");
    else if (sscanf(params, "ui", pID, value)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: /makeadmin [playerid/partofname] [level 1-1338]");
    else if (value < 1 || value > 1338) return SendClientMessage(playerid, 0xFF0000AA, "Unknown level! Only 1 to 1338");
    else if(pID == INVALID_PLAYER_ID) return SCM(playerid, COLOR_GREY,"Invalid player id");
    else
    {
        new pName[MAX_PLAYER_NAME], tName[MAX_PLAYER_NAME], string[128];
        GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
        GetPlayerName(pID, tName, MAX_PLAYER_NAME);
        format(string, sizeof(string), "You have promoted %s to Admin level %i", tName, value);
        SCM(playerid, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "You have been promoted to Admin level %i by %s", value, pName);
        SCM(pID, COLOR_LIGHTBLUE, string);
        PlayerInfo[pID][pAdmin] = value;
    }
    return 1;
}
Or any another command that uses
PHP Code:
sscanf(params,"ui"example1example2
does not work, getting Invalid Player ID/ Player Not Connected

@PrawkC I'm using the plugin
Reply
#17

Do you have sscanf2 or sscanf ?
Reply
#18

sscanf2
Reply
#19

Try this

PHP Code:
new
            
value,
            
pID;
if(
sscanf(params"ui"pIDvalue)) { 
And remove this new pID, value;
Reply
#20

((Ignore the Double Post))

PHP Code:
CMD:makeadmin(playeridparams[])
{
    new
    
pID,
    
value;
    if(!(
PlayerInfo[playerid][pAdmin] >= 1338)) return SendClientMessage(playerid0xFF0000AA" you are not authorized to use this command!");
    else if (
sscanf(params"ui"pIDvalue)) return SendClientMessage(playerid0xFF0000AA"Usage: /makeadmin [playerid/partofname] [level 1-1338]");
    else if (
value || value 1338) return SendClientMessage(playerid0xFF0000AA"Unknown level! Only 1 to 1338");
    if(
IsPlayerConnected(pID)) {
    if(
pID == INVALID_PLAYER_ID) return SendClientMessage(playeridCOLOR_GREY,"Invalid player id");
    {
        new 
pName[MAX_PLAYER_NAME], tName[MAX_PLAYER_NAME], string[128];
        
GetPlayerName(playeridpNameMAX_PLAYER_NAME);
        
GetPlayerName(pIDtNameMAX_PLAYER_NAME);
        
format(stringsizeof(string), "You have promoted %s to Admin level %i"tNamevalue);
        
SCM(playeridCOLOR_LIGHTBLUEstring);
        
format(stringsizeof(string), "You have been promoted to Admin level %i by %s"valuepName);
        
SCM(pIDCOLOR_LIGHTBLUEstring);
        
PlayerInfo[pID][pAdmin] = value;
    }
    return 
1;

Try this.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)