SA-MP Forums Archive
/setadmin problem. need help please - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /setadmin problem. need help please (/showthread.php?tid=336999)



/setadmin problem. need help please - jaami - 24.04.2012

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;
}



Re: /setadmin problem. need help please - Twisted_Insane - 24.04.2012

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!


Re: /setadmin problem. need help please - jaami - 24.04.2012

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!")



Re: /setadmin problem. need help please - Elysian` - 24.04.2012

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.


Re: /setadmin problem. need help please - jaami - 24.04.2012

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.


Re: /setadmin problem. need help please - Elysian` - 24.04.2012

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);



Re: /setadmin problem. need help please - Scripter12345 - 24.04.2012

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;
}



Re: /setadmin problem. need help please - jaami - 24.04.2012

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?


Re: /setadmin problem. need help please - Elysian` - 24.04.2012

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.


Re: /setadmin problem. need help please - jaami - 24.04.2012

btw when i /setadmin it say unknown commands


Re: /setadmin problem. need help please - Elysian` - 24.04.2012

Where did you add the command?


Re: /setadmin problem. need help please - jaami - 24.04.2012

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


Re: /setadmin problem. need help please - Elysian` - 24.04.2012

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


Re: /setadmin problem. need help please - jaami - 24.04.2012

well its fixed now.


Re: /setadmin problem. need help please - Leo Karls - 24.04.2012

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..