15.11.2011, 07:15
Quote:
#include <a_samp> new gate; new bool:gateopen; new playerid public OnFilterScriptInit() // Alternatively, use OnGameModeInit if you implement it in your gamemode { SetTimer("GateCheck", 800, true); //This is used to create the timer. The "GateCheck" is the callback we'll be using, // the '800' is the amount of milliseconds between each call and the 'true' indicates that this timer is looping endlessly gate = (969,1549.59997559,-1623.00000000,12.60000038,0.00000000,0.00000000,27 0.00000000); //'gate = CreateObject(...);' = Assigns the object id of the gate to the 'gate' variable //16442 = object model id < change it to the model id you use for your gate // 1549.59997559,-1623.00000000,12.60000038 = coordinates of the gate // 0.00000000,0.00000000,270.00000000 = Rotation of the gate. return 1; } forward GateCheck(); public GateCheck() { for(new i; i < MAX_PLAYERS; i++) { // Start the loop //Check if any player is in the area. Replace '8.0, 3.0, 10.0' with your own coordinates of your closed gate. if(IsPlayerInRangeOfPoint(playerid, 15.0, 1549.59997559, -1623.00000000, 12.6000003) { if(gateopen == false) { // If the gate isn't open... //Then open it! Change '32.0, 12.0, 10.0' to the coordinates of your opened gate. MoveObject(gate, 1549.59997559, -1623.00000000, 9.60000038, 3.5); gateopen = true; // Setting this to true indicates it's open(ing) } return; //This closes the callback } } //This is called if nobody has been found near the gate. Obviously, because 'return' would fully close the function and this wouldn't be used then. if(gateopen == true) { //If the gate IS open, but there's no one near.. // Change the '8.0, 3.0, 10.0' to the coordinates of your gate when it's closed. MoveObject(gate, 1549.59997559, -1623.00000000, 12.60000038, 3.5); gateopen = false; //This indicates the gate is closed again. Or at least, closing. } } |
Quote:
C:\Users\jacquie\Desktop\Next Generation Roleplay New Fixed\Next Generation Roleplay New Fixed\Next Generation Roleplay FIXED\filterscripts\Automaticgate.pwn(6) : error 001: expected token: ";", but found "public" C:\Users\jacquie\Desktop\Next Generation Roleplay New Fixed\Next Generation Roleplay New Fixed\Next Generation Roleplay FIXED\filterscripts\Automaticgate.pwn(10) : warning 213: tag mismatch Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Error. |