new Gate1,Gate2;
new GateData;
public OnGamemodeInit()
{
GateData = 0;
Gate1 = CreateObject(985,3064.23437500,-577.76251221,6.40274763,0.00000000,0.00000000,94.03747559); //gate 1
Gate2 = CreateObject(986,3064.80151367,-585.69366455,6.42100000,0.00000000,0.00000000,94.13995361); //gate 2
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/gate", cmdtext, true, 10) == 0)
{
if(GateData == 0)
{
SendClientMessage(playerid,messagecolor,"Island Gates Now Open!");
MoveObject(Gate1, 3063.86181641,-571.97137451,6.40274763, 2.00);
MoveObject(Gate2, 3065.2329101563,-591.55322265625,6.42100000, 2.00);
GateData = 1;
}
else
{
SendClientMessage(playerid,messagecolor,"Island Gates Now Closed!");
MoveObject(Gate1, 3064.23437500,-577.76251221,6.40274763, 2.00);
MoveObject(Gate2, 3064.80151367,-585.69366455,6.42100000, 2.00);
GateData = 0;
}
return 1;
}
#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 = 8; //number of gates present (defines other arrays)
// ##############################################################
const MiscObjNum = 10;
const GateNum = 8;
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 Float:xtol1, Float:xtol2, 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(985, 2296.25, 622.98, 10.62, 0.00, 0.00, 0.00);//Gate-1
MiscObject[5] = CreateObject(986, 2278.56, 623.00, 10.62, 0.00, 0.00, 0.00);//Gate-1
// ######################## 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.25, 622.98, 10.62, 2290.88, 623.08, 10.62, 0,0,0, 0, 4);//Gate-1
MakeGate(986, 2278.56, 623.00, 10.62, 2282.93, 623.07, 10.62, 0,0,0, 0, 5);//Gate-1
// ################################################################
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;
}
|
First of all make these on your top of your gamemode.
pawn Code:
pawn Code:
pawn Code:
|
: error 017: undefined symbol "messagecolor"|
its a auto gate fs
#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 = 8; //number of gates present (defines other arrays) // ################################################## ############ const MiscObjNum = 10; const GateNum = 8; 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 Float tol1, Float tol2, Float:ytol1, Float:ytol2; //Holds area bounds during loopspublic 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(985, 2296.25, 622.98, 10.62, 0.00, 0.00, 0.00);//Gate-1 MiscObject[5] = CreateObject(986, 2278.56, 623.00, 10.62, 0.00, 0.00, 0.00);//Gate-1 // ######################## 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.25, 622.98, 10.62, 2290.88, 623.08, 10.62, 0,0,0, 0, 4);//Gate-1 MakeGate(986, 2278.56, 623.00, 10.62, 2282.93, 623.07, 10.62, 0,0,0, 0, 5);//Gate-1 // ################################################## ############## 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; } |