SA-MP Forums Archive
Help with 2 gates - 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: Help with 2 gates (/showthread.php?tid=298685)



Help with 2 gates - remyguys - 22.11.2011

My question is:

How can i make that only faction 2 can open Gate2
And faction 1 still gate1, They shouldn't be able to open both.
Only 1 gate each

Would also be appriciated if you would explain how to do that for more then 2 gates like future for example 10 gates. (no need to show it, just explain )

But it needs to stay with the same command.(/open and /close)

Thanks in Advance!



PHP код:
    if (!strcmp("/open"cmdtext))
    {
        if(
PlayerInfo[playerid][pFaction] != 255 && DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 1)
          {
              if(
PlayerInfo[playerid][pFaction] != 255 && DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 2)
                if(
IsPlayerInRangeOfPoint(playerid10.01128.59997559, -1740.900024419.50000000))
                 {
                    
MoveObject(Gate1128.59997559, -1740.900024419.500000001);   //fType 1
                    
MoveObject(Gate21412.40002441, -1646.6999511715.10000038,1);  //fType 2
                    
SendClientMessage(playerid0xEF994300"Opening Gate.");
                     return 
1;
                }
            }
        }
    if (!
strcmp("/close"cmdtext))
    {
        if(
PlayerInfo[playerid][pFaction] != 255 && DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 1)
        {
            if(
PlayerInfo[playerid][pFaction] != 255 && DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 2)
                if(
IsPlayerInRangeOfPoint(playerid10.01128.59997559, -1740.9000244115.19999981))
                {
                      
MoveObject(Gate1128.59997559, -1740.9000244115.199999811); // fType 1
                      
MoveObject(Gate21412.4200, -1646.69959.500038,1);           // fType 2
                    
SendClientMessage(playerid0xEF994300"Closing Gate.");
                    return 
1;
                }
            }
        } 



Re: Help with 2 gates - Alberto_DR - 22.11.2011

edit
pawn Код:
if(PlayerInfo[playerid][pFaction] != 255
to
pawn Код:
if(PlayerInfo[playerid][pMember] == 2
but if you dont use pMember make it pFaction