16.12.2011, 04:13
I'm trying to make a function that will heal a players vehicle while player is in range of point.
My problem is that it only works for id 0, unless I put it under OnPlayerUpdate which i don't wanna do.
Can anyone help me out?
Thanks
My problem is that it only works for id 0, unless I put it under OnPlayerUpdate which i don't wanna do.
Код:
forward repair(playerid); public OnGameModeInit() { SetTimer("repair", 2000, true); } public repair(playerid) { new Float:x, Float:y, Float:z; new vehicleid = GetPlayerVehicleID(playerid); GetPlayerPos(playerid, x, y, z); if(IsPlayerInVehicle(playerid, vehicleid)) { if(IsPlayerInRangeOfPoint(playerid, 650.0, -1171.4510, -226.3357, 14.1484)) { SetVehicleHealth(vehicleid, 1000.0); } if(IsPlayerInRangeOfPoint(playerid, 150.0, 1977.5227, -2352.5647, 13.1115)) { SetVehicleHealth(vehicleid, 1000.0); } if(IsPlayerInRangeOfPoint(playerid, 150.0, 1757.5624, -2536.8030, 13.1132)) { SetVehicleHealth(vehicleid, 1000.0); } if(IsPlayerInRangeOfPoint(playerid, 150.0, 1972.2734, -2527.6707, 13.1140)) { SetVehicleHealth(vehicleid, 1000.0); } if(IsPlayerInRangeOfPoint(playerid, 150.0, 1490.7642, -2510.8005, 13.1258)) { SetVehicleHealth(vehicleid, 1000.0); } if(IsPlayerInRangeOfPoint(playerid, 100.0, 1724.5593, -2275.1589, 61.8035)) { SetVehicleHealth(vehicleid, 1000.0); } } return 1; }
Thanks
