21.04.2009, 05:58
I've fixed the other now i got another problem.
The gates appear in game but won't move.
These are above main:
These are under Publice OnGameModeInit:
This is in the bottm of the script
The gates appear in game but won't move.
These are above main:
Код:
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 OpenGate[MAX_PLAYERS]; new c_gate; forward CheckGate();
Код:
c_gate = CreateObject(975, 2720.552, -2405.363, 14.150, 0.0, 0.0, 90.0); SetTimer("checkgate", 500, true);
Код:
public CheckGate() { for(new i = 0; i < GetMaxPlayers(); i++) { if(!IsPlayerConnected(i)) continue; if(PlayerToPoint(10.0, i, 2720.552, -2405.363, 14.150) && OpenGate[i] == 0) { MoveObject(c_gate, 2720.552, -2396.363, 14.150); OpenGate[i] = 1; } else if(!PlayerToPoint(10.0, i, 2720.552, -2405.363, 14.150) && OpenGate[i] == 1) { MoveObject(c_gate, 2720.552, -2405.363, 14.150); OpenGate[i] = 0; } } }