Admin Commands Issue
#1

So once again, scripting noob here needing help..
So i made a /makeadmin , /a and now here's the issue:

/makeadmin sets their adminlevel to a random number, not the one typed up (i.e, 0 makes the number 48 )
/a Is just a random . now even though it's all normal.. (i.e, [timestamp].: )

Make Admin:
Код:
CMD:makeadmin(playerid, params[])
{
    new PID, str[128], param, PName[MAX_PLAYER_NAME], AName[MAX_PLAYER_NAME];

    if(PlayerInfo[playerid][pAdminLevel] < 5) return SendClientMessage(playerid, COLOR_GREY, "You're not authorized to use that command");
    if(sscanf(params, "us[64]", PID, param)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /makeadmin [playerid] [Admin Level]");
    
    GetPlayerName(playerid, AName, sizeof(AName));
    GetPlayerName(PID, PName, sizeof(PName));
    
    if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_RED, "Player is not connected!");

	format(str, sizeof(str), "%s Has set %s admin level to %s ", AName, PName, param);

    PlayerInfo[PID][pAdminLevel] = param;

    foreach(Player, i)
    {
        if(PlayerInfo[i][pAdminLevel] > 0) return SendClientMessage(i,COLOR_YELLOW,str);
    }

    return 1;
}
Admin Chat:
Код:
CMD:a(playerid, params[])
{
        if(PlayerInfo[playerid][pAdminLevel] < 1) return SendClientMessage(playerid, COLOR_GREY, "You're not authorized to use this command");
        new
            str[144], text[128];
        if(sscanf(params, "s[128]",text)) return SendClientMessage(playerid, -1, "USAGE: /a [Text]");
		if(PlayerInfo[playerid][pAdminLevel] > 0) format(str, sizeof(str), "[OOC] %s %s: %s", GetAdminName(playerid), GetName(playerid), text);
        foreach(Player, i) {
        if(PlayerInfo[i][pAdminLevel] > 0){
        SendClientMessage(i,COLOR_YELLOW,text);}}
        return 1;
}
Also the "GetAdminName" stock:
Код:
stock GetAdminName(playerid)
{
	new name[25];

	if(PlayerInfo[playerid][pAdminLevel] == 1) format(name, sizeof(name), "Trial Admin");
	if(PlayerInfo[playerid][pAdminLevel] == 2) format(name, sizeof(name), "Junior Admin");
	if(PlayerInfo[playerid][pAdminLevel] == 3) format(name, sizeof(name), "General Admin");
	if(PlayerInfo[playerid][pAdminLevel] == 4) format(name, sizeof(name), "Senior Admin");
	if(PlayerInfo[playerid][pAdminLevel] == 5) format(name, sizeof(name), "Head Admin");
	if(PlayerInfo[playerid][pAdminLevel] == 100) format(name, sizeof(name), "Co-Community Director");
	if(PlayerInfo[playerid][pAdminLevel] == 102) format(name, sizeof(name), "Community Director");

	return name;
}
Reply
#2

Код:
 if(sscanf(params, "ui", PID, param)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /makeadmin [playerid] [Admin Level]");
Try that on the makeadmin command
Reply
#3

Quote:
Originally Posted by Blademaster680
Посмотреть сообщение
Код:
 if(sscanf(params, "ui", PID, param)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /makeadmin [playerid] [Admin Level]");
Try that on the makeadmin command
That works but now the string wont display the number they were set to.
Reply
#4

Your killing your /makeadmin command, Adding useless things won't help you.
pawn Код:
CMD:makeadmin(playerid, params[])
{
    if(PlayerInfo[playerid][pAdminLevel] < 5) return SendClientMessage(playerid, COLOR_GREY, "You're not authorized to use that command");
            new targetid,level;
            if(sscanf(params, "ud", targetid, level)) return  SendClientMessage(playerid,-1,"/makeadmin [playerid] [level]");
   
                        PlayerInfo[PID][pAdminLevel] = level;

   
    if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_RED, "Player is not connected!");

    format(str, sizeof(str), "%s Has set %s admin level to %s ", PlayerName(playerid), PlayerName(targetid), level);

    foreach(Player, i)
    {
        if(PlayerInfo[i][pAdminLevel] > 0) return SendClientMessage(i,COLOR_YELLOW,str);
    }

    return 1;
}
Reply
#5

Quote:
Originally Posted by Clad
Посмотреть сообщение
Your killing your /makeadmin command, Adding useless things won't help you.
pawn Код:
CMD:makeadmin(playerid, params[])
{
    if(PlayerInfo[playerid][pAdminLevel] < 5) return SendClientMessage(playerid, COLOR_GREY, "You're not authorized to use that command");
            new targetid,level,string[256];
            if(sscanf(params, "ud", targetid, level)) return  SendClientMessage(playerid,-1,"/makeadmin [playerid] [level]");
   
                        PlayerInfo[PID][pAdminLevel] = level;

   
    if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_RED, "Player is not connected!");

    format(str, sizeof(str), "%s Has set %s admin level to %s ", PlayerName(playerid), PlayerName(targetid), level);

    foreach(Player, i)
    {
        if(PlayerInfo[i][pAdminLevel] > 0) return SendClientMessage(i,COLOR_YELLOW,str);
    }

    return 1;
}
Thanks, i don't see what was useless but what about the /a command?
Reply
#6

Quote:
Originally Posted by Clad
Посмотреть сообщение
pawn Код:
string[256];
I REALLY hope this is a joke.
Reply
#7

Quote:
Originally Posted by Mionee
Посмотреть сообщение
I REALLY hope this is a joke.
He ain't using messages ?
Reply
#8

pawn Код:
CMD:makeadmin(playerid, params[])
{
    if(PlayerInfo[playerid][pAdminLevel] < 5) return SendClientMessage(playerid, COLOR_GREY, "You're not authorized to use that command");
    new PID, lvl;
    if(sscanf(params, "ui", PID, lvl)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /makeadmin [playerid] [Admin Level]");
    if(!IsPlayerConnected(PID)) return SendClientMessage(playerid, COLOR_RED, "Player is not connected!");
    new str[128], PName[MAX_PLAYER_NAME], AName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, AName, sizeof(AName));
    GetPlayerName(PID, PName, sizeof(PName));
    format(str, sizeof(str), "%s Has set %s admin level to %i ", AName, PName, lvl);
    foreach(Player, i) if(PlayerInfo[i][pAdminLevel] > 0) SendClientMessage(i,COLOR_YELLOW,str);
    PlayerInfo[PID][pAdminLevel] = lvl;
    return 1;
}
pawn Код:
CMD:a(playerid, params[])
{
    if(PlayerInfo[playerid][pAdminLevel] < 1) return SendClientMessage(playerid, COLOR_GREY, "You're not authorized to use this command");
    if(isnull(params)) return SendClientMessage(playerid, -1, "USAGE: /a [Text]");
    new str[128];
    format(str, sizeof(str), "[OOC] %s %s: %s", GetAdminName(playerid), GetName(playerid), params);
    foreach(Player, i) if(PlayerInfo[i][pAdminLevel] > 0) SendClientMessage(i,COLOR_YELLOW,str);
    return 1;
}
pawn Код:
stock GetAdminName(playerid)
{
    new name[25];
    switch(PlayerInfo[playerid][pAdminLevel])
    {
        case 1: name = "Trial Admin";
        case 2: name = "Junior Admin";
        case 3: name = "General Admin";
        case 4: name = "Senior Admin";
        case 5: name = "Head Admin";
        case 100: name = "Co-Community Director";
        case 102: name = "Community Director";
    }
    return name;
}
Reply
#9

Quote:
Originally Posted by Clad
Посмотреть сообщение
He ain't using messages ?
Just to let you know, the "ui" just sends out a random letter now, not even a number under the SendClientMessage
Reply
#10

Quote:
Originally Posted by Cole_William
Посмотреть сообщение
Just to let you know, the "ui" just sends out a random letter now, not even a number under the SendClientMessage
First of all you was asking and I tried to help, I think I missed a small part and thanks to Mionee for correcting me know.
And second, I read tutorials, As I said it was just a mistake.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)