Control Structure
#1

pawn Код:
if(PlayerData[playerid][pFactionRank] > FactionData[PlayerData[playerid][pFaction]][factionEditrank] || PlayerData[playerid][pAdmin] < 5)
        return SendClientMessage(playerid, COLOR_ADM, "ACCESS DENIED:{FFFFFF} Your rank doesn't have permission to do this.");
For some reason, even as above level 5 admin it doesn't let me do the command? I'm obviously failing to see the obvious, can someone help please.
Reply
#2

Try this.

PHP код:
if((PlayerData[playerid][pFactionRank] > FactionData[PlayerData[playerid][pFaction]][factionEditrank]) && PlayerData[playerid][pAdmin] < 5)
        return 
SendClientMessage(playeridCOLOR_ADM"ACCESS DENIED:{FFFFFF} Your rank doesn't have permission to do this."); 
Reply
#3

Quote:
Originally Posted by GTLS
Посмотреть сообщение
Try this.

PHP код:
if((PlayerData[playerid][pFactionRank] > FactionData[PlayerData[playerid][pFaction]][factionEditrank]) && PlayerData[playerid][pAdmin] < 5)
        return 
SendClientMessage(playeridCOLOR_ADM"ACCESS DENIED:{FFFFFF} Your rank doesn't have permission to do this."); 
Wouldn't that require both structures to be correct in order to work?

Код:
&&	and	if (Left && Right)
Reply
#4

If this is a command show us the full code.
Reply
#5

Try PlayerData[playerid] [pAdmin] <= 5
Reply
#6

Quote:
Originally Posted by Exhibit
Посмотреть сообщение
If this is a command show us the full code.
pawn Код:
CMD:configfaction(playerid, params[])
{
    if(!PlayerData[playerid][pFaction])
        return SendClientMessage(playerid, COLOR_ADM, "ERROR: You aren't in a faction.");

    if(PlayerData[playerid][pFactionRank] > FactionData[PlayerData[playerid][pFaction]][factionEditrank] || PlayerData[playerid][pAdmin] < 5)
        return SendClientMessage(playerid, COLOR_ADM, "ACCESS DENIED:{FFFFFF} Your rank doesn't have permission to do this.");

    ShowYourFactionMenu(playerid);
    return 1;
}
Reply
#7

PHP код:
CMD:configfaction(playeridparams[])
{
    if(!
PlayerData[playerid][pFaction])
        return 
SendClientMessage(playeridCOLOR_ADM"ERROR: You aren't in a faction.");
    if(
PlayerData[playerid][pFactionRank] > FactionData[PlayerData[playerid][pFaction]][factionEditrank])
        return 
SendClientMessage(playeridCOLOR_ADM"ACCESS DENIED:{FFFFFF} Your rank doesn't have permission to do this.");
        if(
PlayerData[playerid][pAdmin] < 5) return SendClientMessage(playeridCOLOR_ADM"ACCESS DENIED:{FFFFFF} Your rank doesn't have permission to do this. ADMIN");
    
ShowYourFactionMenu(playerid);
    return 
1;

try this.
Reply
#8

Are you sure that this:
PlayerData[playerid][pAdmin]
Holds the correct value?
Try printing it to be sure, your code looks ok. It should work

Quote:
Originally Posted by Exhibit
Посмотреть сообщение
try this.
Im pretty sure the topic starter knows this method. He clearly doesn't want to do it this way hence he is using || (means or in an if-statement).
The way you showed him is repeating code and his method using ||/or should work.
Reply
#9

Quote:
Originally Posted by jasperschellekens
Посмотреть сообщение
Are you sure that this:
PlayerData[playerid][pAdmin]
Holds the correct value?
Try printing it to be sure, your code looks ok. It should work


Im pretty sure the topic starter knows this method. He clearly doesn't want to do it this way hence he is using || (means or in an if-statement).
The way you showed him is repeating code and his method using ||/or should work.
It does hold the correct value. I'm not sure why it isn't working - trying to figure ways around it.
Reply
#10

Quote:
Originally Posted by Jing_Chan
Посмотреть сообщение
Wouldn't that require both structures to be correct in order to work?

Код:
&&	and	if (Left && Right)
Yes and thats what you should achieve here. If Player is admin less than 5 and he is also less than edit rank, error shows up.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)