03.09.2009, 08:30
I changed the code to this and it worked .. Thanks
Код:
PlayerToPoint(Float:radius, playerid, Float:X, Float:Y, Float:Z) { new Float:oldpos[3], Float:temppos[3]; 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 Lsgate; new Lvgate; new OpenGateLS[MAX_PLAYERS]; new OpenGateLV[MAX_PLAYERS]; forward CheckGate();
Код:
Lsgate = CreateObject(980, 1961.425415, -2189.519043, 15.320267, 0.0000, 0.0000, 0.0000); Lvgate = CreateObject(980, 1706.067505, 1607.601563, 11.983828, 0.0000, 0.0000, 253.4298); SetTimer("CheckGate", 1000, true);
Код:
Код:public CheckGate() { for(new i = 0; i < GetMaxPlayers(); i++) { if(!IsPlayerConnected(i)) continue; if(PlayerToPoint(9.5, i, 1961.425415, -2189.519043, 15.320267) && OpenGateLS[i] == 0) { MoveObject(Lsgate, 1961.434082, -2189.519043, 9.050316,3); OpenGateLS[i] = 1; } else if(!PlayerToPoint(5.5, i, 1961.425415, -2189.519043, 15.320267) && OpenGateLS[i] == 1) { MoveObject(Lsgate,1961.425415, -2189.519043, 15.320267,3); OpenGateLS[i] = 0; } } for(new i = 0; i < GetMaxPlayers(); i++) { if(!IsPlayerConnected(i)) continue; if(PlayerToPoint(9.5, i, 1706.067505, 1607.601563, 11.983828) && OpenGateLV[i] == 0) { MoveObject(Lvgate, 1706.055054, 1607.618652, 5.914435,3); OpenGateLV[i] = 1; } else if(!PlayerToPoint(5.5, i, 1706.067505, 1607.601563, 11.983828) && OpenGateLV[i] == 1) { MoveObject(Lvgate,1706.067505, 1607.601563, 11.983828,3); OpenGateLV[i] = 0; } }