need help with auto gates fs
#1

im trying to add gates to this auto gates fs but i cnt seem to get them to work
gate 1 and gate 2 are the ones i added in

here is the script

#include <a_samp>
#define FILTERSCRIPT
#if defined FILTERSCRIPT

forward GateTimer();
new Timer; //allows killtimer

// ######################## EDIT THESE ##########################
#define TOLERANCE 20
#define OPENSPEED 2
#define CLOSESPEED 2
#define TIMERSPEED 1500 //(MILLISeconds, eg 1000 = 1, 2000 = 2, 1500 = 1.5)
const GateNum = 4; //number of gates present (defines other arrays)
// ################################################## ############

const MiscObjNum = 5;
new Float:GateInfo[GateNum][9]; //stores all gate c-ords (Start, Fnish, Center)
new GateState[GateNum]; //Whether the gate is open closed (not currently in use)
new OpenGate[GateNum]; //Whether or not to open the gate when the loop finishes
new GateObject[GateNum]; //stores gate object ID's
new MiscObject[MiscObjNum];//stores misc object ID's
new Float:Tempx, Float:Tempy, Float:Tempz; //Holds player position during loops
new Floattol1, Floattol2, Float:ytol1, Float:ytol2; //Holds area bounds during loops

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" AutoGates by Thomas_Conroy");
print("--------------------------------------\n");

SendClientMessageToAll(0xFF00FFAA, "AutoGates Activated!");

Timer = SetTimer("GateTimer", TIMERSPEED, true);

MiscObject[0] = CreateObject(976,-1643.446,694.249,6.662,0.0,0.0,270.000); // SFPD West
MiscObject[1] = CreateObject(3092,-1572.638,657.451,7.727,190.795,0.0,-180.000); // Corpse
MiscObject[2] = CreateObject(976,1539.658,-1622.827,12.545,0.0,0.0,90.000); // LSPD1NorthSpare
MiscObject[3] = CreateObject(976,1539.658,-1640.456,12.545,0.0,0.0,90.000); // LSPD1SouthSpare
MiscObject[4] = CreateObject(976,1539.758,-1640.556,12.545,0.0,0.0,0.0); // LSPD1EastSpare
MiscObject[5] = CreateObject(985,2296.19,622.69,10.75,0.00,0.00,0. 00);//Gate-1
MiscObject[6] = CreateObject(986,2278.46,622.77,10.75,0.00,0.00,0. 00);//Gate-1
MiscObject[7] = CreateObject(985,2242.30,439.95,5.51,0.00,0.00,179 .86);//Gate-2
MiscObject[8] = CreateObject(986,2259.99,439.94,5.51,0.00,0.00,179 .86);//Gate-2

// ######################## ADD TO THESE ##########################
// MakeGate(ObjectID, StartX, StarY, StartZ, FinishX, FinishY, FinishZ, CenterX, CenterY, CenterZ, Rotation, GateNumber);
MakeGate(976, -1571.597,665.725,6.349, -1571.597,656.572,6.349, -1571.5579,661.2339,7.1875, -90.0, 0); // SFPD East
MakeGate(976, -1643.446,676.774,6.662, -1643.446,685.551,6.662, -1643.4032,682.6055,7.4930, 90.0, 1); // SFPD West
MakeGate(976, 2236.992,2448.932,9.848, 2236.992,2457.979,9.848, 2236.992,2453.1646,10.7047, 90.0, 2); // Las Venturas
MakeGate(976, 1539.658,-1631.631,12.545, 1539.658,-1624.255,12.545, 1539.658,-1628.0244,13.3828, 90.0, 3); //Los Santos
MakeGate(985, 2296.19,622.69,10.75, 2291.34,622.86,10.75, 0,0,0, 90.0, 5);//Gate-1
MakeGate(986, 2278.46,622.77,10.75, 2283.39,622.86,10.75, 0,0,0, 90.0, 6);//Gate-1
MakeGate(985, 2242.30,439.95,5.51, 2247.22,439.92,5.51, 0,0,0, 90.0, 7);//Gate-2
MakeGate(986, 2259.99,439.94,5.51, 2255.15,439.88,5.51, 0,0,0, 90.0, ;//Gate-2
// ################################################## ##############
return 1;
}

public OnFilterScriptExit()
{
for(new tempgate=0; tempgate<GateNum; tempgate++)
{
DestroyObject(GateObject[tempgate]);
}
for(new tempgate=0; tempgate<MiscObjNum; tempgate++)
{
DestroyObject(MiscObject[tempgate]);
}
KillTimer(Timer);
SendClientMessageToAll(0xFF00FFAA, "AutoGates Deactivated!");
return 1;
}

#else
#endif

public GateTimer()
{
for(new tempgate=0; tempgate<GateNum; tempgate++)
{
for(new pid=0; pid<MAX_PLAYERS; pid++)
{
if(OpenGate[tempgate] == 0/* && IsPlayerAdmin(pid) == 1*/) OpenGate[tempgate] = IsPlayerNearGate(pid, tempgate, TOLERANCE);
}
if(OpenGate[tempgate] == 1) MoveObject(GateObject[tempgate], GateInfo[tempgate][3], GateInfo[tempgate][4], GateInfo[tempgate][5], OPENSPEED), GateState[tempgate] = 1;
else MoveObject(GateObject[tempgate], GateInfo[tempgate][0], GateInfo[tempgate][1], GateInfo[tempgate][2], CLOSESPEED), GateState[tempgate] = 0;
OpenGate[tempgate] = 0;
}
}

MakeGate(z, Float:a, Float:b, Float:c, Float:d, Float:e, Float:f, Float:g, Float:h, Float:i, Float:j, k)
{
GateInfo[k][0] = a, GateInfo[k][1] = b, GateInfo[k][2] = c; //Start
GateInfo[k][3] = d, GateInfo[k][4] = e, GateInfo[k][5] = f; //Finish
GateInfo[k][6] = g, GateInfo[k][7] = h, GateInfo[k][8] = i; //Center
GateState[k] = 0; //Gate Closed
GateObject[k] = CreateObject(z ,a, b, c, 0.0,0.0,j);
}

stock IsPlayerNearGate(pid, tempgate, tolerance)
{
GetPlayerPos(pid, Tempx, Tempy, Tempz);
xtol1 = GateInfo[tempgate][6] + tolerance;
xtol2 = GateInfo[tempgate][6] - tolerance;
ytol1 = GateInfo[tempgate][7] + tolerance;
ytol2 = GateInfo[tempgate][7] - tolerance;
if(Tempx >= xtol2 && Tempx <= xtol1 && Tempy >= ytol2 && Tempy <= ytol1) return 1;
return 0;
}
Reply
#2

NextTime please add in your script heres the problem
pawn Код:
const GateNum = 9; //number of gates present (defines other arrays)
Reply
#3

Quote:
Originally Posted by Naruto_Emilio
Посмотреть сообщение
NextTime please add in your script heres the problem
pawn Код:
const GateNum = 9; //number of gates present (defines other arrays)
hi thx for that it got rid of most of the error but i still have this

C:\Users\Joe\Desktop\Admin-VIP\auto gates.pwn(21) : error 017: undefined symbol "MiscObjNum"
C:\Users\Joe\Desktop\Admin-VIP\auto gates.pwn(21) : error 009: invalid array size (negative, zero or out of bounds)
C:\Users\Joe\Desktop\Admin-VIP\auto gates.pwn(65) : error 017: undefined symbol "MiscObjNum"
Reply
#4

Quote:
Originally Posted by scottygraham1990
Посмотреть сообщение
hi thx for that it got rid of most of the error but i still have this

C:\Users\Joe\Desktop\Admin-VIP\auto gates.pwn(21) : error 017: undefined symbol "MiscObjNum"
C:\Users\Joe\Desktop\Admin-VIP\auto gates.pwn(21) : error 009: invalid array size (negative, zero or out of bounds)
C:\Users\Joe\Desktop\Admin-VIP\auto gates.pwn(65) : error 017: undefined symbol "MiscObjNum"
Add more numbers in MiscObjNum i think try that.
Reply
#5

Quote:
Originally Posted by Naruto_Emilio
Посмотреть сообщение
Add more numbers in MiscObjNum i think try that.
still has not worked still the same errors
Reply
#6

Do this:
const MiscObjNum = 10;
Reply
#7

Quote:
Originally Posted by Naruto_Emilio
Посмотреть сообщение
Do this:
const MiscObjNum = 10;
thx so much m8 its worked
Reply
#8

Quote:
Originally Posted by scottygraham1990
Посмотреть сообщение
thx so much m8 its worked
Enjoy
Reply
#9

Quote:
Originally Posted by Naruto_Emilio
Посмотреть сообщение
Enjoy
just tryed the gates and they dnt open lol
Reply
#10

Quote:
Originally Posted by scottygraham1990
Посмотреть сообщение
just tryed the gates and they dnt open lol
I Think it's the coordinates no?.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)