SA-MP Forums Archive
Automatic 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Automatic Gates (/showthread.php?tid=143259)



Automatic Gates - Scenario - 22.04.2010

I need help with Automatic Gates... I have looked at the SA:MP Wiki and I have followed what it said on there, but I still have errors.

Here is what I have:

pawn Код:
public CheckGate()
{
    for(new i;i<MAX_PLAYERS;i++)
  {
    if(!IsPlayerConnected(i)) continue;
    if(IsPlayerInRangeOfPoint(i,10.0,266.30337524414, 92.817451477051, 1002.5568237305)) MoveDynamicObject(LSPDGate, 266.25262451172, 96.629951477051, 1002.5570678711 ,5.0);
  }
  else MoveDynamicObject(LSPDGate, 266.30337524414, 92.817451477051, 1002.5568237305, 2.0);
}
pawn Код:
public OnGameModeInit()
{
  LSPDGate = CreateDynamicObject(971, 266.30337524414, 92.817451477051, 1002.5568237305, 0.000000, 0.000000, 270.27026367188,-1,-1,-1,200);
  SetTimer("CheckGate",1000,true);
  return 1;
}
and

pawn Код:
#include <streamer>

//Forwards
forward CheckGate();

//Other
new LSPDGate;
I don't see why I am getting this issue...

Код:
C:\CnR SA-MP Server\gamemodes\CnR.pwn(133) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Does anyone have a solution to help me with this?




Resource Used: https://sampwiki.blast.hk/wiki/Automatic_Gates


Re: Automatic Gates - Joe Staff - 22.04.2010

Someone changed it after I had, and changed it so it was incorrect

But the wiki is now correct.


Re: Automatic Gates - Scenario - 22.04.2010

Quote:
Originally Posted by Joe Staff
Someone changed it after I had, and changed it so it was incorrect

But the wiki is now correct.
Thank you for doing that! It works now, but I have a question about the code...

I have this:
pawn Код:
public CheckGate()
{
  new jailgate_status;
  for(new i;i<MAX_PLAYERS;i++)
  {
    if(!IsPlayerConnected(i)) continue;
    if(IsPlayerInRangeOfPoint(i,10.0,266.30337524414, 92.817451477051, 1002.5568237305))jailgate_status=1;
  }
  if(jailgate_status)MoveDynamicObject(LSPDGate, 266.25262451172, 96.629951477051, 1002.5570678711,6.0);
  else MoveDynamicObject(LSPDGate, 266.30337524414, 92.817451477051, 1002.5568237305, 6.0);
}
but on this line...

pawn Код:
if(IsPlayerInRangeOfPoint(i,10.0,266.30337524414, 92.817451477051, 1002.5568237305))jailgate_status=1;
Anytime I change the 10.0 after the IsPlayerInRangeOfPoint(i, ... It won't work anymore I set it to 1.0 and the gate does not open, why?



Re: Automatic Gates - Joe Staff - 22.04.2010

Because 1.0 meters in-game is very very short.


You could spit on a guy that close.


Re: Automatic Gates - Scenario - 22.04.2010

Quote:
Originally Posted by Joe Staff
Because 1.0 meters in-game is very very short.


You could spit on a guy that close.
Ah, okay. I tried doing about 5.0 meters and that works just as well. Thanks for the help.