Need Help
#1

I create auto gates system but i want the gate don't open for civil or medic.

just for cops , cia ,army ,fbi

and i create that script: https://sampforum.blast.hk/showthread.php?tid=202668

can u tell me how i make it for cops.cia,fbi,army?
Reply
#2

pawn Код:
if(PlayerInfo[playerid][pFaction] == XX) {//XX Your factions.
Reply
#3

Quote:
Originally Posted by TFreemen
Посмотреть сообщение
pawn Код:
if(PlayerInfo[playerid][pFaction] == XX {//XX Your factions.
thanks but i don't understand it can u explain me well?
Reply
#4

PHP код:
if(PlayerInfo[playerid][pFaction] == XX {//XX Your factions. 
What?

if(PlayerInfo[playerid][pFaction] == XX) {//XX Your factions.
Reply
#5

If you have this model: https://sampforum.blast.hk/showthread.php?tid=202668

pawn Код:
public CheckGate()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(PlayerInfo[playerid][pMember] == X || PlayerInfo[playerid][pMember] == X)//X= your faction number
        {
            if(IsPlayerConnected(i))
            {
                if(IsPlayerInRangeOfPoint(i, 10.0, 2641.8201, 2810.6196, 36.3222))
                {
                    MoveObject(AutomaticGate, 2641.8201, 2810.6196, 26.3222, 5.0);
                }
                else
                {
                    MoveObject(AutomaticGate, 2641.8201, 2810.6196, 36.3222, 5.0);
                }
            }
        }
    }
}
Reply
#6

He means, with pFaction the faction's name of your enum and xx the value.
pawn Код:
if(PlayerInfo[playerid][COP/* Or how it is on your enum */] != 0
|| PlayerInfo[playerid][ARMY/* Or how it is on your enum */] != 0
|| PlayerInfo[playerid][FBI/* Or how it is on your enum */] != 0
|| PlayerInfo[playerid][CIA/* Or how it is on your enum */] != 0)
{
    // code;
}
Reply
#7

C:\Users\Nouman\Downloads\Documents\NVCNR_0.3e\NVC NR\gamemodes\Ncnr.pwn(2000 : error 017: undefined symbol "playerid"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.

Код:
forward GateCheck();
public GateCheck()
{
  for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        if(PlayerInfo[playerid][COP/* Or how it is on your enum */] != 0
        || PlayerInfo[playerid][ARMY/* Or how it is on your enum */] != 0
        || PlayerInfo[playerid][FBI/* Or how it is on your enum */] != 0
        || PlayerInfo[playerid][CIA/* Or how it is on your enum */] != 0)

    if(IsPlayerInRangeOfPoint(i, 15.0, 2334.5737,2443.9558,5.6758)) //Check if any player is in the area. Replace '8.0, 3.0, 10.0' with your own coordinates of your closed gate.
    {
      if(gateopen == false) // If the gate isn't open...
      {
      MoveObject(gate, 2324.5637,2443.9558,5.6758, 3.5); //Then open it! Change '32.0, 12.0, 10.0' to the coordinates of your opened gate.
      gateopen = true; // Setting this to true indicates it's open(ing)
      }
      return; //This closes the callback
    }
  }
  //This is called if nobody has been found near the gate. Obviously, because 'return' would fully close the function and this wouldn't be used then.
  if(gateopen == true) //If the gate IS open, but there's no one near..
  {
    MoveObject(gate, 2334.5637,2443.9558,5.6758, 3.5); // Change the '8.0, 3.0, 10.0' to the coordinates of your gate when it's closed.
    gateopen = false; //This indicates the gate is closed again. Or at least, closing.
  }
}
and this is 20008 : if(PlayerInfo[playerid][COP/* Or how it is on your enum */] != 0
Reply
#8

EDIT: Okay, you PMed me the name and the rest, so here it is.
pawn Код:
forward GateCheck();
public GateCheck()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(!IsPlayerConnected(i)) continue;
        if(GetTeam{i} == CLASS_COPS || GetTeam{i} == CLASS_ARMY || GetTeam{i} == CLASS_FBI || GetTeam{i} == CLASS_CIA)
        {
            if(IsPlayerInRangeOfPoint(i, 15.0, 2334.5737,2443.9558,5.6758)) //Check if any player is in the area. Replace '8.0, 3.0, 10.0' with your own coordinates of your closed gate.
            {
                if(gateopen == false) // If the gate isn't open...
                {
                    MoveObject(gate, 2324.5637,2443.9558,5.6758, 3.5); //Then open it! Change '32.0, 12.0, 10.0' to the coordinates of your opened gate.
                    gateopen = true; // Setting this to true indicates it's open(ing)
                }
            }
            else
            {
                //This is called if nobody has been found near the gate. Obviously, because 'return' would fully close the function and this wouldn't be used then.
                if(gateopen == true) //If the gate IS open, but there's no one near..
                {
                    MoveObject(gate, 2334.5637,2443.9558,5.6758, 3.5); // Change the '8.0, 3.0, 10.0' to the coordinates of your gate when it's closed.
                    gateopen = false; //This indicates the gate is closed again. Or at least, closing.
                }
            }
        }
    }
    return 1;
}
Reply
#9

Quote:
Originally Posted by Dwane
Посмотреть сообщение
EDIT: Okay, you PMed me the name and the rest, so here it is.
pawn Код:
forward GateCheck();
public GateCheck()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(!IsPlayerConnected(i)) continue;
        if(GetTeam{i} == CLASS_COPS || GetTeam{i} == CLASS_ARMY || GetTeam{i} == CLASS_FBI || GetTeam{i} == CLASS_CIA)
        {
            if(IsPlayerInRangeOfPoint(i, 15.0, 2334.5737,2443.9558,5.6758)) //Check if any player is in the area. Replace '8.0, 3.0, 10.0' with your own coordinates of your closed gate.
            {
                if(gateopen == false) // If the gate isn't open...
                {
                    MoveObject(gate, 2324.5637,2443.9558,5.6758, 3.5); //Then open it! Change '32.0, 12.0, 10.0' to the coordinates of your opened gate.
                    gateopen = true; // Setting this to true indicates it's open(ing)
                }
            }
            else
            {
                //This is called if nobody has been found near the gate. Obviously, because 'return' would fully close the function and this wouldn't be used then.
                if(gateopen == true) //If the gate IS open, but there's no one near..
                {
                    MoveObject(gate, 2334.5637,2443.9558,5.6758, 3.5); // Change the '8.0, 3.0, 10.0' to the coordinates of your gate when it's closed.
                    gateopen = false; //This indicates the gate is closed again. Or at least, closing.
                }
            }
        }
    }
    return 1;
}
thanks worked
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)