PDA

View Full Version : Automatic Gate help!


Appleslayer69
27/08/2011, 08:58 PM
High, this should create three gates at locations at the LVPD station.

Everything works but I get 4 errors.

The script;

#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.688);
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.838))
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.768))
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;

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 (c) 1997-2006, ITB CompuPhase


4 Errors.


Please help, thank you.

Amel_PAtomAXx
27/08/2011, 09:40 PM
Look , you cant use like this

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 :

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

new AutomaticGate1,AutomaticGate2,AutomaticGate3;

then take cordinates of one of gates and put it in IsPlayerInRangeOfPoint
example:

if(IsPlayerInRangeOfPoint(playerid,10.0,2237.421,2 449.144,9.838)) // cordinates of AutomaticGate1
{
MoveObject(AutomaticGame1,X,Y,Z, Speed); // put cordinates to open it
return 1;
}