SA-MP Forums Archive
[Request]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: [Request]Please (/showthread.php?tid=551162)



[Request]Please - astanalol - 17.12.2014

How To Make SetRank My Admin System This its from 0
PHP код:
    else if(PlayerInfo[playerid][pRank] == Community_Owner)
    {
    
//new
    

PHP код:
    else if(PlayerInfo[playerid][pRank] == 6)
    {
    
//new
    

And How To Add Commands For Rank Admins only
i Want Example SetHealth Only Can Do that This admin Rank 6
Help +Rep
Thanks For All.


Re: [Request]Please - JeaSon - 17.12.2014

simple use zcmd and sscanf for that

not tested
pawn Код:
CMD:setrank(playerid, params[])
{
    new str[128], rank, lookupid;
    if(PlayerInfo[playerid][pRank] == 6) // this command is for admins level 6 only
    {
        if(sscanf(params, "ui", lookupid, rank)) return SendClientMessage(playerid, -1, "Usage: /setrank <PlayerID/PlayerName> <Rank>");
        format(str, sizeof(str), "Admin %s (ID:%d) has setted %s (ID:%d) Rank to (%d)",GetName(playerid), playerid, GetName(lookupid), lookupid, rank);
        SendClientMessageToAll(-1, str);
        pInfo[lookupid][pRank] = rank;
    }
    else
    {
        SendClientMessage(playerid, -1, "Sorry , you are not admin");
    }
    return 1;
}

CMD:sethealth(playerid, params[])
{
    new str[128], Float:health, lookupid;
    if(PlayerInfo[playerid][pRank] == 6) // this command is for admins level 6 only
    {
        if(sscanf(params, "uf", lookupid, health)) return SendClientMessage(playerid, -1, "Usage: /sethealth <PlayerID/PlayerName> <health>");
        format(str, sizeof(str), "Admin %s (ID:%d) has setted %s (ID:%d) health to (%f)",GetName(playerid), playerid, GetName(lookupid), lookupid, health);
        SendClientMessageToAll(-1, str);
        SetPlayerHealth(lookupid, health);
    }
    else
    {
        SendClientMessage(playerid, -1, "Sorry , you are not admin");
    }
    return 1;
}

stock GetName(playerid) // use this stock
{
    new PlayerName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
    return PlayerName;
}



Re: [Request]Please - astanalol - 17.12.2014

thanks for try +rep for u
have this error
Quote:

D:\ffff\gamemodes\fast.pwn(1251) : error 028: invalid subscript (not an array or too many subscripts): "pInfo"
D:\ffff\gamemodes\fast.pwn(1251) : warning 215: expression has no effect
D:\ffff\gamemodes\fast.pwn(1251) : error 001: expected token: ";", but found "]"
D:\ffff\gamemodes\fast.pwn(1251) : error 029: invalid expression, assumed zero
D:\ffff\gamemodes\fast.pwn(1251) : fatal error 107: too many error messages on one line

this line 1251
Quote:

pInfo[lookupid][pRank] = ARank;




Re: [Request]Please - JeaSon - 17.12.2014

can you show the code !?


Re: [Request]Please - astanalol - 17.12.2014

this the code errors
Quote:

pInfo[lookupid][pRank] = ARank;

and this full code
PHP код:
CMD:setrank(playeridparams[])
{
    new 
str[128], ranklookupid;
    if(
PlayerInfo[playerid][pRank] == 6// this command is for admins level 6 only
    
{
        if(
sscanf(params"ui"lookupidrank)) return SendClientMessage(playerid, -1"Usage: /setrank <PlayerID/PlayerName> <Rank>");
        
format(strsizeof(str), "Admin %s (ID:%d) has setted %s (ID:%d) Rank to (%d)",GetName(playerid), playeridGetName(lookupid), lookupidrank);
        
SendClientMessageToAll(-1str);
        
pInfo[lookupid][pRank] = ARank;
    }
    else
    {
        
SendClientMessage(playerid, -1"Sorry , you are not admin");
    }
    return 
1;




Re: [Request]Please - astanalol - 17.12.2014

help please


Re: [Request]Please - JeaSon - 17.12.2014

you are doing wrong i defined
pawn Код:
new rank;
and you did ARank it should be rank or you can change it

fixed

pawn Код:
CMD:setrank(playerid, params[])
{
    new str[128], ARank, lookupid;
    if(PlayerInfo[playerid][pRank] == 6) // this command is for admins level 6 only
    {
        if(sscanf(params, "ui", lookupid, ARank)) return SendClientMessage(playerid, -1, "Usage: /setrank <PlayerID/PlayerName> <Rank>");
        format(str, sizeof(str), "Admin %s (ID:%d) has setted %s (ID:%d) Rank to (%d)",GetName(playerid), playerid, GetName(lookupid), lookupid, ARank);
        SendClientMessageToAll(-1, str);
        pInfo[lookupid][pRank] = ARank;
    }
    else
    {
        SendClientMessage(playerid, -1, "Sorry , you are not admin");
    }
    return 1;
}



Re: [Request]Please - astanalol - 17.12.2014

not Fixed
Quote:

D:\ffff\gamemodes\fast.pwn(1252) : error 028: invalid subscript (not an array or too many subscripts): "pInfo"
D:\ffff\gamemodes\fast.pwn(1252) : warning 215: expression has no effect
D:\ffff\gamemodes\fast.pwn(1252) : error 001: expected token: ";", but found "]"
D:\ffff\gamemodes\fast.pwn(1252) : error 029: invalid expression, assumed zero
D:\ffff\gamemodes\fast.pwn(1252) : fatal error 107: too many error messages on one line

Line 1252
Quote:

pInfo[lookupid][pRank] = ARank;

all the code
Quote:

CMDetrank(playerid, params[])
{
new str[128], ARank, lookupid;
if(PlayerInfo[playerid][pRank] == 6) // this command is for admins level 6 only
{
if(sscanf(params, "ui", lookupid, ARank)) return SendClientMessage(playerid, -1, "Usage: /setrank <PlayerID/PlayerName> <Rank>");
format(str, sizeof(str), "Admin %s (ID:%d) has setted %s (ID:%d) Rank to (%d)",GetName(playerid), playerid, GetName(lookupid), lookupid, ARank);
SendClientMessageToAll(-1, str);
pInfo[lookupid][pRank] = ARank;
}
else
{
SendClientMessage(playerid, -1, "Sorry , you are not admin");
}
return 1;
}

i done add
Quote:

new rank;

help to fixing error


Re: [Request]Please - JeaSon - 17.12.2014

sorry my bad i did was that
pawn Код:
pInfo[lookupid][pRank]
but it was
pawn Код:
PlayerInfo[lookupid][pRank]
now its fine
pawn Код:
CMD:setrank(playerid, params[])
{
    new str[128], ARank, lookupid;
    if(PlayerInfo[playerid][pRank] == 6) // this command is for admins level 6 only
    {
        if(sscanf(params, "ui", lookupid, ARank)) return SendClientMessage(playerid, -1, "Usage: /setrank <PlayerID/PlayerName> <Rank>");
        format(str, sizeof(str), "Admin %s (ID:%d) has setted %s (ID:%d) Rank to (%d)",GetName(playerid), playerid, GetName(lookupid), lookupid, ARank);
        SendClientMessageToAll(-1, str);
        PlayerInfo[lookupid][pRank] = ARank;
    }
    else
    {
        SendClientMessage(playerid, -1, "Sorry , you are not admin");
    }
    return 1;
}