/setadmin problem. need help please
#1

Here all the enum has been added and done

pawn Код:
enum pInfo
{
    Password,
    Cash,
    Kills,
    Deaths,
    Adminlevel,
    levels
}
pawn Код:
D:\gta.sa\BaseNorton V2\gamemodes\Test.pwn(1545) : warning 219: local variable "levels" shadows a variable at a preceding level
D:\gta.sa\BaseNorton V2\gamemodes\Test.pwn(1549) : error 028: invalid subscript (not an array or too many subscripts): "pInfo"
D:\gta.sa\BaseNorton V2\gamemodes\Test.pwn(1549) : warning 215: expression has no effect
D:\gta.sa\BaseNorton V2\gamemodes\Test.pwn(1549) : error 001: expected token: ";", but found "]"
D:\gta.sa\BaseNorton V2\gamemodes\Test.pwn(1549) : error 029: invalid expression, assumed zero
D:\gta.sa\BaseNorton V2\gamemodes\Test.pwn(1549) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
the scripts
pawn Код:
CMD:setadmin(playerid, params[])
{
    ((LINE 1545))  new id, levels, sendername[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME], string[128];
    if(PlayerInfo[playerid][Adminlevel] < 4) return SendClientMessage(playerid,COLOR_ERROR,"[ERROR]: You are not authorized to use this command ");
    if(sscanf(params,"ui", id, levels)) return SendClientMessage(playerid, COLOR_SYNTAX,"[SYNTAX]: /givemoney [playerid/partofname] [ammount]");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_ERROR,"[ERROR]: Invalid player ID");
    ((THIS IS THE LINE 1549))  if(pInfo[id][AdminLevel] == levels) return SendClientMessage(playerid,0xFF0000FF, "ERROR: That person is already this admin level!");//Detect if the guy is already the level you setted
    GetPlayerName(playerid,Nam, MAX_PLAYER_NAME);//define the playerid name
    GetPlayerName(id,pname,MAX_PLAYER_NAME);//define the other person name
    if(levels == 0)
    {
        format(str, sizeof(str),"%s has your Admin level to %d on the server. *cry *cry",Nam,levels);
        SendClientMessage(ID,0xFF9900AA,str);
        format(str, sizeof(str),"You had set %s Admin level to %d!",pname,levels);
        SendClientMessage(playerid,0xFF9900AA,str);
        PlayerData[ID][AdminLevel] = levels;//this sets the player level
        return 1;
    }
    format(str, sizeof(str),"%s has your Admin level to %d on the server.",Nam,levels);
    SendClientMessage(ID,0xFF9900AA,str);
    format(str, sizeof(str),"You had set %s Admin level to %d!",pname,levels);
    SendClientMessage(playerid,0xFF9900AA,str);
    PlayerData[ID][AdminLevel] = levels;
    return 1;
}
Reply
#2

Read the error carefully, you already have another variable called "levels" somewhere in your script which is important. Navigate to your command and change the variable "levels" to another name!
Reply
#3

Well i remove the enum levels. but still get this

pawn Код:
D:\gta.sa\BaseNorton V2\gamemodes\Test.pwn(1548) : error 028: invalid subscript (not an array or too many subscripts): "pInfo"
D:\gta.sa\BaseNorton V2\gamemodes\Test.pwn(1548) : warning 215: expression has no effect
D:\gta.sa\BaseNorton V2\gamemodes\Test.pwn(1548) : error 001: expected token: ";", but found "]"
D:\gta.sa\BaseNorton V2\gamemodes\Test.pwn(1548) : error 029: invalid expression, assumed zero
D:\gta.sa\BaseNorton V2\gamemodes\Test.pwn(1548) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Line
pawn Код:
if(pInfo[id][AdminLevel] == levels) return SendClientMessage(playerid,0xFF0000FF, "ERROR: That person is already this admin level!")
Reply
#4

Here, use this.
pawn Код:
CMD:setadminlevel(playerid, params[])
{
    if(PlayerInfo[playerid][pAdminLevel] == 6)
    {
        new target, level, targetid;
        if(sscanf(params, "ri", target, level)) return SendClientMessage(playerid, 0xCC0000AA, "Server: /setadminlevel [playerid] [level]");
        if(level > 5) return SendClientMessage(playerid, 0xCC0000AA, "The maximum level is 5!");
        PlayerInfo[target][pAdminLevel] = level;

        new aName[MAX_PLAYER_NAME], tName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, aName, sizeof(aName));
        GetPlayerName(target, tName, sizeof(tName));

        new string[128];
        format(string, sizeof(string), "|| You set %s(%d) to admin level %d! ||", tName, targetid, level);
        SendClientMessage(playerid, 0x0000FF, string);
        format(string, sizeof(string), "Administrator %s has set your admin level to %d!", aName, level); //like above
        SendClientMessage(target, 0x0000FF, string);
        format(string, sizeof(string), "%s(%d) has just been made apart of the team! Well done!", tName, targetid);
    }
    else return SendClientMessage(playerid, 0xCC0000AA, "Warning: You are a high enough Admin Level!");
    return 1;
}
You can use my one.
Reply
#5

Well left with two Error
pawn Код:
D:\gta.sa\BaseNorton V2\gamemodes\Test.pwn(1544) : error 017: undefined symbol "AdminLevel"
D:\gta.sa\BaseNorton V2\gamemodes\Test.pwn(1549) : error 017: undefined symbol "AdminLevel"
This is my first time using sscanf and zcmds. So spot my mistake for me.
Reply
#6

Change it to your Admin Variable.

EDIT: Also add this:
pawn Код:
SendClientMessageToAll(COLOR_LIGHTRED, string);
Under:
pawn Код:
format(string, sizeof(string), "%s(%d) has just been made apart of the team! Well done!", tName, targetid);
Reply
#7

Quote:
Originally Posted by jaami
Посмотреть сообщение
Well left with two Error
pawn Код:
D:\gta.sa\BaseNorton V2\gamemodes\Test.pwn(1544) : error 017: undefined symbol "AdminLevel"
D:\gta.sa\BaseNorton V2\gamemodes\Test.pwn(1549) : error 017: undefined symbol "AdminLevel"
This is my first time using sscanf and zcmds. So spot my mistake for me.
Use this


pawn Код:
CMD:setadminlevel(playerid, params[])
{
    if(PlayerInfo[playerid][pAdminlevel] == 6)
    {
        new target, level, targetid;
        if(sscanf(params, "ri", target, level)) return SendClientMessage(playerid, 0xCC0000AA, "Server: /setadminlevel [playerid] [level]");
        if(level > 5) return SendClientMessage(playerid, 0xCC0000AA, "The maximum level is 5!");
        PlayerInfo[target][pAdminlevel] = level;

        new aName[MAX_PLAYER_NAME], tName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, aName, sizeof(aName));
        GetPlayerName(target, tName, sizeof(tName));

        new string[128];
        format(string, sizeof(string), "|| You set %s(%d) to admin level %d! ||", tName, targetid, level);
        SendClientMessage(playerid, 0x0000FF, string);
        format(string, sizeof(string), "Administrator %s has set your admin level to %d!", aName, level); //like above
        SendClientMessage(target, 0x0000FF, string);
        format(string, sizeof(string), "%s(%d) has just been made apart of the team! Well done!", tName, targetid);
    }
    else return SendClientMessage(playerid, 0xCC0000AA, "Warning: You are a high enough Admin Level!");
    return 1;
}
Reply
#8

Quote:
Originally Posted by Scripter12345
Посмотреть сообщение
Use this


pawn Код:
CMD:setadminlevel(playerid, params[])
{
    if(PlayerInfo[playerid][pAdminlevel] == 6)
    {
        new target, level, targetid;
        if(sscanf(params, "ri", target, level)) return SendClientMessage(playerid, 0xCC0000AA, "Server: /setadminlevel [playerid] [level]");
        if(level > 5) return SendClientMessage(playerid, 0xCC0000AA, "The maximum level is 5!");
        PlayerInfo[target][pAdminlevel] = level;

        new aName[MAX_PLAYER_NAME], tName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, aName, sizeof(aName));
        GetPlayerName(target, tName, sizeof(tName));

        new string[128];
        format(string, sizeof(string), "|| You set %s(%d) to admin level %d! ||", tName, targetid, level);
        SendClientMessage(playerid, 0x0000FF, string);
        format(string, sizeof(string), "Administrator %s has set your admin level to %d!", aName, level); //like above
        SendClientMessage(target, 0x0000FF, string);
        format(string, sizeof(string), "%s(%d) has just been made apart of the team! Well done!", tName, targetid);
    }
    else return SendClientMessage(playerid, 0xCC0000AA, "Warning: You are a high enough Admin Level!");
    return 1;
}
Its the same right?
Reply
#9

Quote:
Originally Posted by Scripter12345
Посмотреть сообщение
Use this


pawn Код:
CMD:setadminlevel(playerid, params[])
{
    if(PlayerInfo[playerid][pAdminlevel] == 6)
    {
        new target, level, targetid;
        if(sscanf(params, "ri", target, level)) return SendClientMessage(playerid, 0xCC0000AA, "Server: /setadminlevel [playerid] [level]");
        if(level > 5) return SendClientMessage(playerid, 0xCC0000AA, "The maximum level is 5!");
        PlayerInfo[target][pAdminlevel] = level;

        new aName[MAX_PLAYER_NAME], tName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, aName, sizeof(aName));
        GetPlayerName(target, tName, sizeof(tName));

        new string[128];
        format(string, sizeof(string), "|| You set %s(%d) to admin level %d! ||", tName, targetid, level);
        SendClientMessage(playerid, 0x0000FF, string);
        format(string, sizeof(string), "Administrator %s has set your admin level to %d!", aName, level); //like above
        SendClientMessage(target, 0x0000FF, string);
        format(string, sizeof(string), "%s(%d) has just been made apart of the team! Well done!", tName, targetid);
    }
    else return SendClientMessage(playerid, 0xCC0000AA, "Warning: You are a high enough Admin Level!");
    return 1;
}
You just copied mine.
Reply
#10

btw when i /setadmin it say unknown commands
Reply
#11

Where did you add the command?
Reply
#12

Its not under on playercommandtext. its under forward. because the gm is create by inorton blank script. for begginers. and there is no setadmin level there, so i was thinking of making one
Reply
#13

I honestly don't know why it says Unknown command!
It doesn't say that for me.
Reply
#14

well its fixed now.
Reply
#15

http://forum.sa-mp.com/showthread.ph...ht=%2Fsetadmin
http://forum.sa-mp.com/showthread.ph...ht=%2Fsetadmin
http://forum.sa-mp.com/showthread.ph...ht=%2Fsetadmin
http://forum.sa-mp.com/showthread.ph...ht=%2Fsetadmin
Check this links . It might Help you..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)