/facmask problem
#1

Quote:
PHP код:
CMD:facmask(playeridparams[])
{
    new 
name[MAX_PLAYER_NAME];
    new 
string[42];
    if((!
IsACop(playerid) || !IsALVMPDCop(playerid))) return SendClientMessageEx(playeridCOLOR_GREY"   You are not a member of L.E.O !");
    if(
HasBoughtMask[playerid] != 1) return SendClientMessage(playeridCOLOR_GREY"You don't have a mask.");
    if(
PlayerInfo[playerid][pMask] == 0)
    {
            for(new 
0MAX_PLAYERSi++)
            {
                    if(
IsPlayerConnected(i))
                    {
                            
ShowPlayerNameTagForPlayer(iplayerid0);
                    }
            }
            
PlayerInfo[playerid][pMask] = 1;
            
SetPlayerAttachedObject(playerid1190372104.70.090900);
            
GetPlayerName(playeridnamesizeof(name));
            
format(stringsizeof(string), "* Stranger has put a mask on.");
            
ProxDetector(15.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    }
    else if(
PlayerInfo[playerid][pMask] == 1)
    {
            for(new 
0MAX_PLAYERSi++)
            {
                    if(
IsPlayerConnected(i))
                    {
                            
ShowPlayerNameTagForPlayer(iplayerid1);
                    }
            }
            
PlayerInfo[playerid][pMask] = 0;
            
RemovePlayerAttachedObject(playerid1);
            
GetPlayerName(playeridnamesizeof(name));
            
format(stringsizeof(string), "* Stranger has put their mask away.");
            
ProxDetector(15.0playeridstringCOLOR_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==|| member==|| member== || member==|| member==|| member==11 || member==13 || member==18 || member==19)
        {
            return 
1;
        }
        else if(
leader==|| leader==|| leader == || leader==|| leader==|| 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(playeridCOLOR_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)