new obj = CreateObject(975, 2334.5637,2443.9558,5.6758, 2333.1999511719, 2440.3000488281, 4.8000001907349);
SetObjectRot(obj,Float:RotX, Float:RotY, Float:RotZ);
new gate; new bool:gateclosed; forward GateCheck(); public OnGameModeInit() { SetTimer("GateCheck", 1000, true); gate = CreateObject(975, 2334.5637,2443.9558,5.6758, 2333.1999511719, 2440.3000488281, 4.8000001907349); }
public GateCheck() { for(new i; i < MAX_PLAYERS; i++) // Start the loop { if(IsPlayerInRangeOfPoint(i, 10.02334.5637,2443.9558,5.6758)) { if(gateclosed = true) { MoveObject(gate, x,y,z, 3); // Here put your x,y,z of your moved object gateclosed = false; } return; //This closes the callback } } if(gateclosed == true) //If the gate IS open, but there's no one near.. { MoveObject(gate, -1985.65, 885.33, 44.13, 7); / gateclosed = true; //This indicates the gate is closed again. Or at least, closing. } }
You might find this interesting too Try like this This will move your object to the x,y,z provided by you when a player is near to your object Код:
new gate; new bool:gateclosed; forward GateCheck(); public OnGameModeInit() { SetTimer("GateCheck", 1000, true); gate = CreateObject(975, 2334.5637,2443.9558,5.6758, 2333.1999511719, 2440.3000488281, 4.8000001907349); } Next step is you "GateCheck" ^^ Код:
public GateCheck() { for(new i; i < MAX_PLAYERS; i++) // Start the loop { if(IsPlayerInRangeOfPoint(i, 10.02334.5637,2443.9558,5.6758)) { if(gateclosed = true) { MoveObject(gate, x,y,z, 3); // Here put your x,y,z of your moved object gateclosed = false; } return; //This closes the callback } } if(gateclosed == true) //If the gate IS open, but there's no one near.. { MoveObject(gate, -1985.65, 885.33, 44.13, 7); / gateclosed = true; //This indicates the gate is closed again. Or at least, closing. } } |