/facmask problem
#1

Quote:
PHP код:
CMD:facmask(playerid, params[])
{
    new 
name[MAX_PLAYER_NAME];
    new 
string[42];
    if((!
IsACop(playerid) || !IsALVMPDCop(playerid))) return SendClientMessageEx(playerid, COLOR_GREY, "   You are not a member of L.E.O !");
    if(
HasBoughtMask[playerid] != 1) return SendClientMessage(playerid, COLOR_GREY, "You don't have a mask.");
    if(
PlayerInfo[playerid][pMask] == 0)
    {
            for(new 
i = 0; i < MAX_PLAYERS; i++)
            {
                    if(
IsPlayerConnected(i))
                    {
                            
ShowPlayerNameTagForPlayer(i, playerid, 0);
                    }
            }
            
PlayerInfo[playerid][pMask] = 1;
            
SetPlayerAttachedObject(playerid, 1, 19037, 2, 10, 4.7, 0.0, 90, 90, 0);
            
GetPlayerName(playerid, name, sizeof(name));
            
format(string, sizeof(string), "* Stranger has put a mask on.");
            
ProxDetector(15.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    }
    else if(
PlayerInfo[playerid][pMask] == 1)
    {
            for(new 
i = 0; i < MAX_PLAYERS; i++)
            {
                    if(
IsPlayerConnected(i))
                    {
                            
ShowPlayerNameTagForPlayer(i, playerid, 1);
                    }
            }
            
PlayerInfo[playerid][pMask] = 0;
            
RemovePlayerAttachedObject(playerid, 1);
            
GetPlayerName(playerid, name, sizeof(name));
            
format(string, sizeof(string), "* Stranger has put their mask away.");
            
ProxDetector(15.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    }
    return 
1;
} 
Once i /facmask it send me that first return > You are not a member of L.E.O ! . Even i am a leo.
Can you please help me to fix it

Problem fixed
Reply
#2

PHP код:
if((!IsACop(playerid) || !IsALVMPDCop(playerid))) 
can you show IsACop and IsALVMPDCop fuctions?
Reply
#3

There no problem. Because those are 100% okey. As you say

PHP код:
IsACop(playerid)
{
    if(
IsPlayerConnected(playerid))
    {
        new 
leader = PlayerInfo[playerid][pLeader];
        new 
member = PlayerInfo[playerid][pMember];
        if(
member==1 || member==2 || member== 3 || member==6 || member==7 || member==11 || member==13 || member==18 || member==19)
        {
            return 
1;
        }
        else if(
leader==1 || leader==2 || leader == 3 || leader==6 || leader==7 || leader==11 || leader==13 || leader==18 || leader==19)
        {
            return 
1;
        }
     }
    return 
0;
} 
I am using IsACop in many other cmds. There no problem at all
Reply
#4

can you try this but i'm not sure about it ;_;

PHP код:
if((!IsACop(playerid)) || !IsALVMPDCop(playerid)) 
your first code were
Код:
if((!IsACop(playerid)
last ) closed playerid but !isacop "(" not closed, would you try it? as i said not sure about :3
Reply
#5

Problem fixed . I was forgot about that. Solution is

using
PHP код:
 if((!IsACop(playerid) || !IsALVMPDCop(playerid))) return SendClientMessageEx(playerid, COLOR_GREY, "   You are not a member of L.E.O !"); 
Is bad idea and there some problem in return . There was no {} and need to replace || to &&
like this :

PHP код:
if(!IsACop(playerid) && !IsALVMPDCop(playerid))
    {
        return 
Error(playerid, "You are not authorized to use this command");
    } 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)