PlayerToPoint(Float:radius, playerid, Float:X, Float:Y, Float:Z) { new Float ![]() GetPlayerPos(playerid, oldpos[0], oldpos[1], oldpos[2]); temppos[0] = (oldpos[0] -X); temppos[1] = (oldpos[1] -Y); temppos[2] = (oldpos[2] -Z); if(((temppos[0] < radius) && (temppos[0] > -radius)) && ((temppos[1] < radius) && (temppos[1] > -radius)) && ((temppos[2] < radius) && (temppos[2] > -radius))) { return true; } return false; } new c_gate; c_gate = CreateObject(2669,1245.2478,-767.1913,92.0703,349.5082,1250.0586,-767.1960,92.0638,266.4016); new OpenGate[MAX_PLAYERS]; SetTimer("CheckGate", 500, true); forward CheckGate(); public CheckGate() { for(new i = 0; i < GetMaxPlayers(); i++) { if(!IsPlayerConnected(i)) continue; if(PlayerToPoint(10.0, i, 1250.0586,-767.1960,92.0638,266.4016) && OpenGate[i] == 0) { MoveObject(c_gate, 1245.2478,-767.1913,92.0703); OpenGate[i] = 1; } else if(!PlayerToPoint(10.0, i, -767.1960,92.0638,266.4016) && OpenGate[i] == 1) { MoveObject(c_gate, -767.1960,92.0638,266.4016); OpenGate[i] = 0; } } } |
public Kapilar(playerid) { if(PlayerToPoint(7.0, playerid, 172.8482,654.4478,3.8090)) // Change the hole kode to your own koordinates .. { MoveObject(Kapi[1], 179.10, 642.13, 9.86, 4.0); // For OPEN the doors MoveObject(Kapi[2], 171.40, 640.17, 9.86, 4.0); // For OPEN the doors } else { MoveObject(Kapi[1], 179.10, 642.13, 2.86, 4.0); // For CLOSE the doors MoveObject(Kapi[2], 171.40, 640.17, 2.86, 4.0); // For CLOSE the doors } }