Quote:
Originally Posted by tyler12
pawn Код:
public OnGameModeInit() { SetTimer("TrainCheck",1000,1); return 1; }
forward TrainCheck();
public TrainCheck() { new Float:vehx, Float:vehy, Float:vehz; GetVehiclePos(Train, vehx, vehy, vehz); if (vehx == 1778.8184 && vehy == -1953.8077 && vehz == 14.8756) { SendClientMessageToAll(COLOR_RED, "The train has arrived at Unity Station"); } return 1; }
|
Thankyou. I thought about the use of a timer, because otherwise it wouldnt know when to check if the train is there..
Quote:
Originally Posted by Vince
You can't compare floats like that due to the way they are saved. Sometimes the position may be 1778.8185, rendering your check totally useless. You could probably use GetVehicleDistanceFromPoint.
|
Hmmm, I understand - I'll try the method posted first and if I have trouble still I'll try that instead.
EDIT: Yeah I think you are right Vince, as still no message is being shown, and I've put all the code in the right place as i followed the structure of another timer that I know works. I'll try using GetVehicleDistanceFromPoint instead.