Faction's HQ lock not working.
#1

Well i made /lockhq and unlockhq
see this is the code
PHP код:
    if(strcmp(cmd"/lockhq"true) == 0)
    {
        new 
fam PlayerInfo[playerid][pMember];
        if(
IsPlayerConnected(playerid))
        {
            if(
PlayerInfo[playerid][pMember] <= 6)
            {
                return 
1;
            }
            if(
FamilyInfo[fam][FamilyLocked] == 0)
            {
                
FamilyInfo[fam][FamilyLocked] = 1;
                
SendClientMessage(playerid,COLOR_GREY,"HQ Locked.");
            }
        }
        return 
1;
    }
    if(
strcmp(cmd"/unlockhq"true) == 0)
    {
        new 
fam PlayerInfo[playerid][pMember];
        if(
IsPlayerConnected(playerid))
        {
            if(
PlayerInfo[playerid][pMember] <= 6)
            {
                return 
1;
            }
            if(
FamilyInfo[fam][FamilyLocked] == 1)
            {
                
FamilyInfo[fam][FamilyLocked] = 0;
                
SendClientMessage(playerid,COLOR_GREY,"HQ Unlocked.");
            }
        }
        return 
1;
    } 
the lock works only when i /unlockhq i cant enter because its say locked
PHP код:
            for(new 5sizeof(FamilyInfo); h++)
            {
                if(
PlayerToPoint(2.0playeridFamilyInfo[h][FamilySpawn][0],FamilyInfo[h][FamilySpawn][1],FamilyInfo[h][FamilySpawn][2]))
                {
                    if(
PlayerInfo[playerid][pMember] != && PlayerInfo[playerid][pMember] != && FamilyInfo[h][FamilyLocked] == && AdminDuty[playerid] != 1)
                    {
                        
GameTextForPlayer(playerid"~r~Locked"50001);
                    }
                    else
                    {
                        if(
FamilyInfo[h][FamilyInterior] == 0)
                        {
                            
GameTextForPlayer(playerid"~r~Entrance is in Construction"50001);
                        }
                        else if(
FamilyInfo[h][FamilyInterior] == 1// Crackden
                        
{
                            
format(stringsizeof(string), "~p~%s~n~~w~HQ"FamilyInfo[h][FamilyName]);
                            
GameTextForPlayer(playeridstring50001);
                            
SetPlayerVirtualWorld(playerid,h);
                            
SetPlayerInterior(playerid,5);
                            
DOO_SetPlayerPos(playerid318.6968,1117.9586,1083.8828);
                        }
                        else if(
FamilyInfo[h][FamilyInterior] == 2// Ryders
                        
{
                            
format(stringsizeof(string), "~p~%s~n~~w~HQ"FamilyInfo[h][FamilyName]);
                            
GameTextForPlayer(playeridstring50001);
                            
SetPlayerVirtualWorld(playerid,h);
                            
SetPlayerInterior(playerid,2);
                            
DOO_SetPlayerPos(playerid2465.8018,-1698.3330,1013.5078);
                        }
                        else if(
FamilyInfo[h][FamilyInterior] == 3// Cjs
                        
{
                            
format(stringsizeof(string), "~p~%s~n~~w~HQ"FamilyInfo[h][FamilyName]);
                            
GameTextForPlayer(playeridstring50001);
                            
SetPlayerVirtualWorld(playerid,h);
                            
SetPlayerInterior(playerid,3);
                            
DOO_SetPlayerPos(playerid2496.0498,-1694.3333,1014.7422);
                        }
                    }
                    return 
1;
                }
            } 
On top there is /enter.
Any solutions guys??
Reply
#2

Well anyone??
Reply
#3

pawn Код:
if(PlayerInfo[playerid][pMember] != 1 && PlayerInfo[playerid][pMember] != h && FamilyInfo[h][FamilyLocked] == 1 && AdminDuty[playerid] != 1)
should be

pawn Код:
if((PlayerInfo[playerid][pMember] != 1 && PlayerInfo[playerid][pMember] != h && AdminDuty[playerid] != 1) || (FamilyInfo[h][FamilyLocked] == 1 && AdminDuty[playerid] != 1))
Reply
#4

Well the problem still the same. It says unlock but when /enter its locked.??
Reply
#5

pawn Код:
if(strcmp(cmd, "/lockhq", true) == 0)
    {
        new fam = PlayerInfo[playerid][pMember];
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pMember] <= 6)
            {
                return 1;
            }
            if(FamilyInfo[fam][FamilyLocked] == 0) // I think this is the problem. U made the locked here to 0. I think it should be 1. NOt sure I am a new scripter.
            {
                FamilyInfo[fam][FamilyLocked] = 1;
                SendClientMessage(playerid,COLOR_GREY,"HQ Locked.");
            }
        }
        return 1;
    }
Reply
#6

Well whats the problem with it? 1 is lock 0 is unlocked. before it lock it checks first weather it is locked or not and if its unlocked then it will locked it. so whats the problem? any solutions?? been fixing this for hours..
Reply
#7

Bump Anyone??
Reply
#8

Код:
  if(strcmp(cmd, "/unlockhq", true) == 0)
    {
        new fam = PlayerInfo[playerid][pMember];
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pMember] <= 6)
            {
                return 1;
            }
            if(FamilyInfo[fam][FamilyLocked] == 0)
            {
                FamilyInfo[fam][FamilyLocked] = 0;
                SendClientMessage(playerid,COLOR_GREY,"HQ Unlocked.");
            }
        }
        return 1;
    }
This should do it I think..
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)