Problem with gate
#1

I got this command

Код:
 if(strcmp(cmdtext,"/gate", true) == 0)
  {
  if(!PlayerToPoint(15.0,playerid,1598.306885, -1637.804443, 15.260101))
  return SendClientMessage(playerid,COLOR_VEH,"Your to far from the gate.");
  if(PlayerInfo[playerid][pFaction] != 255 && DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 0)
  {
 if(Moved == 0)
 {
 MoveObject(lspdgate, 1598.306885, -1637.804443, 15.260101, 2.0); Moved = 1;
  } else {
 MoveObject(lspdgate, 1590.306885, -1637.804443, 15.260101, 2.0); Moved = 0;
  }
 return 1;
 }
 else if(!PlayerToPoint(15.0,playerid,1545.539795, -1451.062866, 15.331202))
 return SendClientMessage(playerid,COLOR_VEH,"Your to far from the gate.");
  if(PlayerInfo[playerid][pFaction] != 255 && DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 1)
  {
  if(Moved == 0)
 {
 MoveObject(fbigate, 1545.539795, -1451.062866, 15.331202, 2.0); Moved = 1;
  } else {
 MoveObject(fbigate, 1534.842773, -1451.141357, 15.331202, 2.0); Moved = 0;
  }
  return 1;
 }}
The problem is when i am trying to open the first gate its working, but when i am trying to open the other one it says "Your to far from the gate"
Reply
#2

Which gate is the 'other one'- do you mean the fbi gate is not opening (it says "Your to far from the gate")?
If so, check your co-ordinates for the gate playertopoint, most likely you have the wrong coords
Reply
#3

The lspd gate is fine the command opening it...

but the fbi gate not working and the co-ordinates are fine i've checked it..
Reply
#4

i think you can't have one command for two PlayertoPoint checks. You're indentationis really bad as well.

Try This: (it's just indented, but i changed the SendClientMessasge. Whn you go to the FBI gat tell me what message you get.

pawn Код:
if(strcmp(cmdtext,"/gate", true) == 0)
    {
        if(!PlayerToPoint(15.0,playerid,1598.306885, -1637.804443, 15.260101)) return SendClientMessage(playerid,COLOR_VEH,"You're too far from the LSPD Gate");
        if(PlayerInfo[playerid][pFaction] != 255 && DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 0)
        {
            if(Moved == 0)
            {
                MoveObject(lspdgate, 1598.306885, -1637.804443, 15.260101, 2.0); Moved = 1;
            }
            else
            {
                MoveObject(lspdgate, 1590.306885, -1637.804443, 15.260101, 2.0); Moved = 0;
            }
            return 1;
        }
        else if(!PlayerToPoint(15.0,playerid,1545.539795, -1451.062866, 15.331202)) return SendClientMessage(playerid,COLOR_VEH,"You're too far from the FBI gate.");
        if(PlayerInfo[playerid][pFaction] != 255 && DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 1)
        {
            if(Moved == 0)
            {
                MoveObject(fbigate, 1545.539795, -1451.062866, 15.331202, 2.0); Moved = 1;
            }
            else
            {
                MoveObject(fbigate, 1534.842773, -1451.141357, 15.331202, 2.0); Moved = 0;
            }
            return 1;
        }
        return 1;
    }
Reply
#5

I tried to open the FBI gate and its says Your to far away from the LSPD Gate...

so whats the problem
Reply
#6

Ofcourse it doesnt work, because you have this
pawn Код:
if(!PlayerToPoint(15.0,playerid,1598.306885, -1637.804443, 15.260101)) return SendClientMessage(playerid,COLOR_VEH,"You're too far from the LSPD Gate");
If you're not in that radius(15.0), it will send you the message


Heres fixed code:
pawn Код:
if(strcmp(cmdtext,"/gate", true) == 0)
{
  if(PlayerInfo[playerid][pFaction] != 255 && DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 0)
  {
    if(PlayerToPoint(15.0,playerid,1598.306885, -1637.804443, 15.260101))
    {
      if(Moved == 0)
      {
        MoveObject(lspdgate, 1598.306885, -1637.804443, 15.260101, 2.0); Moved = 1;
      }
      else
      {
        MoveObject(lspdgate, 1590.306885, -1637.804443, 15.260101, 2.0); Moved = 0;
      }
    }
    else return SendClientMessage(playerid,COLOR_VEH,"You're too far from the LSPD gate.");
  }
  else if(PlayerInfo[playerid][pFaction] != 255 && DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 1)
  {
    if(PlayerToPoint(15.0,playerid,1545.539795, -1451.062866, 15.331202))
    {
      if(Moved == 0)
      {
        MoveObject(fbigate, 1545.539795, -1451.062866, 15.331202, 2.0); Moved = 1;
      }
      else
      {
        MoveObject(fbigate, 1534.842773, -1451.141357, 15.331202, 2.0); Moved = 0;
      }
    }
    else return SendClientMessage(playerid,COLOR_VEH,"You're too far from the FBI gate.");
  }
  return 1;
}
Reply
#7

Same problem still not sloved =\

any one else
Reply
#8

Comon no one know how to fix it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)