SA-MP Forums Archive
/Setlevel command not working .. - 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: /Setlevel command not working .. (/showthread.php?tid=397147)



/Setlevel command not working .. - Threshold - 03.12.2012

Guys,
My /setlevel command does not work. For some odd reason. If somebody can kindly help me fix this problem. I dont see what im doing wrong here.

pawn Код:
CMD:setlevel(playerid,params[])
    {
        if(PlayerInfo[playerid][pAdmin] < 3) return 0;
        new target,level,string[124],pName[24];
        if(sscanf(params,"ud",target,level)) return SendClientMessage(playerid,-1,"{FF0000}[USAGE]: {FFFFFF}/Setlevel (PlayerID) (Level)");
        if(!IsPlayerConnected(target)) return SendClientMessage(playerid,-1,"ERROR:Player not connected.");
        if(level < 0 || level > 3) return SendClientMessage(playerid,-1,"ERROR:Invalid level. (1 - 3)");
        GetPlayerName(target,pName,sizeof(pName));
        format(string,sizeof(string),"{00FF40}%s Has Been Promoted To Level %d Administrator!",pName,level);
        SendClientMessageToAll(-1,string);
        PlayerInfo[playerid][pAdmin] = level;
        PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
        return 1;
    }



Re: /Setlevel command not working .. - [HK]Ryder[AN] - 03.12.2012

pawn Код:
CMD:setlevel(playerid,params[])
    {
        if(PlayerInfo[playerid][pAdmin] < 3) return 0;
        new target,level,string[124],pName[24];
        if(sscanf(params,"ud",target,level)) return SendClientMessage(playerid,-1,"{FF0000}[USAGE]: {FFFFFF}/Setlevel (PlayerID) (Level)");
        if(!IsPlayerConnected(target)) return SendClientMessage(playerid,-1,"ERROR:Player not connected.");
        if(level < 0 || level > 3) return SendClientMessage(playerid,-1,"ERROR:Invalid level. (1 - 3)");
        GetPlayerName(target,pName,sizeof(pName));
        format(string,sizeof(string),"{00FF40}%s Has Been Promoted To Level %d Administrator!",pName,level);
        SendClientMessageToAll(-1,string);
        PlayerInfo[target][pAdmin] = level;
        PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
        return 1;
    }



Re: /Setlevel command not working .. - Konstantinos - 03.12.2012

I don't see anything wrong with the code, but what exactly does not work?


Re: /Setlevel command not working .. - [HK]Ryder[AN] - 03.12.2012

Quote:
Originally Posted by Dwane
Посмотреть сообщение
I don't see anything wrong with the code, but what exactly does not work?
dwane..when he sets the level..he is setting it of the playerid

PlayerInfo[playerid][pAdmin] = level;

Isn't that wrong?


Re: /Setlevel command not working .. - dannyk0ed - 03.12.2012

Replace playerid with "target"


Re: /Setlevel command not working .. - Djole1337 - 03.12.2012

Quote:
Originally Posted by [HK]Ryder[AN]
Посмотреть сообщение
dwane..when he sets the level..he is setting it of the playerid

PlayerInfo[playerid][pAdmin] = level;

Isn't that wrong?
Yeah, he's setting his own instead of target ids.


Re: /Setlevel command not working .. - [HK]Ryder[AN] - 03.12.2012

Quote:
Originally Posted by dannyk0ed
Посмотреть сообщение
Replace playerid with "targetid"
1.Already given him code.
2.It should be target not targetid


Re: /Setlevel command not working .. - Konstantinos - 03.12.2012

Oh, I didn't see that. My fault!


Re: /Setlevel command not working .. - Threshold - 03.12.2012

Thanks! +Rep


Re: /Setlevel command not working .. - Devilxz97 - 03.12.2012

try this , idk ur saving system but lemme guess lolz

pawn Код:
CMD:setlevel(playerid,params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 3)
    {
        new target,level,string[124],pName[24];
        if(sscanf(params,"ud",target,level)) return SendClientMessage(playerid,-1,"{FF0000}[USAGE]: {FFFFFF}/Setlevel (PlayerID) (Level)");
        if(!IsPlayerConnected(target)) return SendClientMessage(playerid,-1,"ERROR:Player not connected.");
        if(level < 0 || level > 3) return SendClientMessage(playerid,-1,"ERROR:Invalid level. (1 - 3)");
        GetPlayerName(target,pName,sizeof(pName));
        format(string,sizeof(string),"{00FF40}%s Has Been Promoted To Level %d Administrator!",pName,level);
        SendClientMessageToAll(-1,string);
        PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
           
        new file[256];
        PlayerInfo[id][pAdmin] = level;
        dini_IntSet(file,"pAdmin",level);
    }
    else return SendClientMessage(playerid, -1, "You are not an Admin!");
    return 1;
}