11.08.2009, 20:46
hello i tryed to script some gate's but i am little noob and i dident understand so much but i think you guys can help me i making thease gates for my server and to release some gate's on the samp here is the code
((sorry for my bad english and the code is from wiki))
Quote:
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; } } } |