Automatic Gate help!
#1

High, this should create three gates at locations at the LVPD station.

Everything works but I get 4 errors.

The script;
Quote:

#include <a_samp>
#define blue 0x0000FFFF

forward GateCheck();

new AutomaticGate;

public OnGameModeInit()
{
SetTimer("GateCheck", 500, true);
AutomaticGate = CreateObject(969,2237.421,2449.144,9.838,0.0,0.0,9 0.000);
AutomaticGate = CreateObject(971,2293.847,2498.374,5.768,0.0,0.0,-90.000);
AutomaticGate = CreateObject(971,2335.227,2443.460,8.261,0.0,0.0,5 9.68;
return 1;
}
public GateCheck()

for(new i=0; i<MAX_PLAYERS; i++)

if(IsPlayerConnected(i))

if(IsPlayerInRangeOfPoint(i, 10.0, 2237.421, 2449.144, 9.83)
MoveObject(AutomaticGate, 2237.414, 2457.107, 9.840, 5);
else
MoveObject(AutomaticGate, 2237.421, 2449.144, 9.838, 5);

if(IsPlayerInRangeOfPoint(i, 10.0, 2293.847, 2498.374, 5.76)
MoveObject(AutomaticGate, 2293.847, 2498.374, 10.518, 5);
else
MoveObject(AutomaticGate, 2293.847, 2498.374, 5.768, 5);

if(IsPlayerInRangeOfPoint(i, 10.0, 2335.227, 2443.460, 8.261))
MoveObject(AutomaticGate, 2335.170, 2443.313, 1.311, 5));
else
MoveObject(AutomaticGate, 2335.227, 2443.460, 8.261, 5);

The errors that I get;
Quote:

C:\Users\Jing\Desktop\Automatic Gate.pwn(27) : error 010: invalid function or declaration
C:\Users\Jing\Desktop\Automatic Gate.pwn(29) : error 010: invalid function or declaration
C:\Users\Jing\Desktop\Automatic Gate.pwn(32) : error 010: invalid function or declaration
C:\Users\Jing\Desktop\Automatic Gate.pwn(34) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.

Please help, thank you.
Reply
#2

Look , you cant use like this
pawn Code:
AutomaticGate = CreateObject(969,2237.421,2449.144,9.838,0.0,0.0,9 0.000);
AutomaticGate = CreateObject(971,2293.847,2498.374,5.768,0.0,0.0,-90.000);
AutomaticGate = CreateObject(971,2335.227,2443.460,8.261,0.0,0.0,5 9.68;
i must be like this :
pawn Code:
AutomaticGate1 = CreateObject(969,2237.421,2449.144,9.838,0.0,0.0,9 0.000);
AutomaticGate2 = CreateObject(971,2293.847,2498.374,5.768,0.0,0.0,-90.000);
AutomaticGate3 = CreateObject(971,2335.227,2443.460,8.261,0.0,0.0,5 9.68;
before it
pawn Code:
new AutomaticGate1,AutomaticGate2,AutomaticGate3;
then take cordinates of one of gates and put it in IsPlayerInRangeOfPoint
example:
pawn Code:
if(IsPlayerInRangeOfPoint(playerid,10.0,2237.421,2449.144,9.838)) // cordinates of AutomaticGate1
{
    MoveObject(AutomaticGame1,X,Y,Z, Speed); // put cordinates to open it
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)