Automatic Gates
#1

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
Reply
#2

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

But the wiki is now correct.
Reply
#3

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?
Reply
#4

Because 1.0 meters in-game is very very short.


You could spit on a guy that close.
Reply
#5

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)