Moving gates not closing!
#1

Hey I'm creating moving gates for my LSPD faction and while it opens the gate properly, it does not close. To test whether or not it is working I added a client message in the code to close the gate however this does not appear in chat after the timer is finished here is the "gate" command:

pawn Код:
CMD:gate(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 5.0, 1540.59, -1627.57, 14.95))
    {
        if(PlayerInfo[playerid][Faction] == 1)
          {
               if(GateOpen == 0)
               {
                    MoveObject(LSPDGate, 1540.59, -1607.57, 14.95, 2.0);
                    GateOpen = 1;
                    SetTimerEx("gateclose",10000,false,"i",playerid);
               }
               return 1;
          }
          else
          {
               SendClientMessage(playerid, COLOR_LIGHTRED, "You are not a member of the LSPD.");
          }
    }
    return 1;
}
And here is the timer:
pawn Код:
public gateclose(playerid)
    {
        if(IsPlayerInRangeOfPoint(playerid, 5.0, 1540.59, -1627.57, 14.95))
        {
            MoveObject(LSPDGate, 1540.59, -1627.57, 14.95, 2.0);
            SendClientMessage(playerid, COLOR_LIGHTGREEN, "The gate is now closing!");
            GateOpen = 0;
        }
    return 1;
    }
Reply
#2

SetTimerEx("gateclose",10000,false,"i",playerid); to
SetTimer("gateclose",10000,false);

pawn Код:
public gateclose(playerid)
{
     MoveObject(LSPDGate, 1540.59, -1627.57, 14.95, 2.0);
     GateOpen = 0;
}
If you want to send a message to nearby players, you can still do this after GateOpen = 0;

pawn Код:
for(new i=0;i<GetMaxPlayers();i++)
{
      if(IsPlayerInRangeOfPoint(i, 5.0, 1540.59, -1627.57, 14.95))
      {
            SendClientMessage(i, COLOR_LIGHTGREEN, "The gate is now closing!");
      }
}
Reply
#3

I'll give it a try and I'll tell you what happens
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)