SA-MP Forums Archive
Faction's HQ lock not working. - 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)
+--- Thread: Faction's HQ lock not working. (/showthread.php?tid=335665)



Faction's HQ lock not working. - jaami - 19.04.2012

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??


Re: Faction's HQ lock not working. - jaami - 19.04.2012

Well anyone??


Re: Faction's HQ lock not working. - SuperViper - 19.04.2012

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))



Re: Faction's HQ lock not working. - jaami - 19.04.2012

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


Re: Faction's HQ lock not working. - nilanjay - 19.04.2012

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;
    }



Re: Faction's HQ lock not working. - jaami - 19.04.2012

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..


Re: Faction's HQ lock not working. - jaami - 20.04.2012

Bump Anyone??


Re: Faction's HQ lock not working. - Derek_Westbrook - 20.04.2012

Код:
  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..