SA-MP Forums Archive
hello help plz - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: hello help plz (/showthread.php?tid=274647)



hello help plz - kingchandio - 06.08.2011

Actually i want to use these three options isplayeradmin, pAdmin, pHelper but its not working can you help me.
pawn Код:
if(PlayerInfo[playerid][pAdmin] >= 2 || PlayerInfo[playerid][pHelper] >= 2 || !IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_RED,"You are not allowed to use this command!");



Re: hello help plz - Calgon - 06.08.2011

pawn Код:
if(PlayerInfo[playerid][pAdmin] < 2 || PlayerInfo[playerid][pHelper] < 2 || !IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_RED,"You are not allowed to use this command!");
You needed to reverse the check, you were checking if pAdmin & pHelper were above or equal to 2 and saying they couldn't use the command, you should use the code above as it checks if they're below 2 and won't let them use the command if they are.


Re: hello help plz - kingchandio - 06.08.2011

no its not still working i am not logged in as rcon admin i am pAdmin = 3 and pHelper = 0 . here is my full code, its keep saying "You are not allowed to use this command!");
pawn Код:
CMD:nmute(playerid, params[])
{
  new pid;
  //if(!IsPlayerAdmin(playerid)) return 1;
  if(PlayerInfo[playerid][pAdmin] < 2 || PlayerInfo[playerid][pHelper] < 2 || !IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_RED,"You are not allowed to use this command!");
  if(sscanf(params,"u",pid)) return SendClientMessage(playerid, 0xF60000AA, "USAGE: /mute [playerid]");
  new name[MAX_PLAYER_NAME],string[128];
  GetPlayerName(pid,name,sizeof(name));
  format(string,sizeof(string),"%s has been muted",name);
  SendClientMessageToAll(COLOR_TOMATO,string);
  PlayerInfo[pid][pNMuted]= 1;
  return 1;
}



Re: hello help plz - =WoR=Varth - 06.08.2011

pawn Код:
if(PlayerInfo[playerid][pAdmin] < 2 && PlayerInfo[playerid][pHelper] < 2 && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_RED,"You are not allowed to use this command!");



Re: hello help plz - Calgon - 06.08.2011

Quote:
Originally Posted by varthshenon
Посмотреть сообщение
pawn Код:
if(PlayerInfo[playerid][pAdmin] < 2 && PlayerInfo[playerid][pHelper] < 2 && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_RED,"You are not allowed to use this command!");
Sorry, forgot the && signs, that's the working code.


Re: hello help plz - kingchandio - 06.08.2011

Thanks both of you but still my one command not working can you tell me whats wrong with it its keep saying not authorized
pawn Код:
CMD:nooc(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 2 && PlayerInfo[playerid][pHelper] < 2 && !IsPlayerAdmin(playerid))
    {
        if(OOCSTAT)
        {
            OOCSTAT = 0;
            SendClientMessageToAll(COLOR_LIGHTBLUE, "OOC Chat has been enabled by an Admin.");
        }
        else
        {
            OOCSTAT = 1;
            SendClientMessageToAll(COLOR_LIGHTBLUE, "OOC Chat has been disabled by an Admin.");
        }
    }
    else return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command.");
    return 1;
}



Re: hello help plz - =WoR=Varth - 06.08.2011

pawn Код:
CMD:nooc(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 2 && PlayerInfo[playerid][pHelper] < 2 && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command.");
    if(OOCSTAT == 1)//You may take a look at this line
    {
        OOCSTAT = 0;
        SendClientMessageToAll(COLOR_LIGHTBLUE, "OOC Chat has been enabled by an Admin.");
    }
    else
    {
        OOCSTAT = 1;
        SendClientMessageToAll(COLOR_LIGHTBLUE, "OOC Chat has been disabled by an Admin.");
    }
    return 1;
}



Re: hello help plz - kingchandio - 06.08.2011

thanks..