07.02.2017, 20:01
Alguem poderia me passar um sistema, que quando a vida do veiculo chegar por exemplo em 100.0, o veiculo nгo andar mais, ate o mecanico reparar o veiculo, alguem poderia me passar??
mano Pesquisa ae.
https://sampforum.blast.hk/showthread.php?tid=324711 |
public OnGameModeInit() { SetTimer("CheckVehicles", 1000, true); return 1; } forward CheckVehicles(); public CheckVehicles() { for(new i = 0, m = GetPlayerPoolSize()+1; i < m; i++) { if(IsPlayerConnected(i)) { if(GetPlayerState(i) == PLAYER_STATE_DRIVER) { new v = GetPlayerVehicleID(i), Float:health; new engine, lights, alarm, doors, bonnet, boot, objective; GetVehicleParamsEx(v, engine, lights, alarm, doors, bonnet, boot, objective); GetVehicleHealth(v, health); if(health <= 100.0 && engine == VEHICLE_PARAMS_ON) { SetVehicleParamsEx(v, VEHICLE_PARAMS_OFF, lights, alarm, doors, bonnet, boot, objective); SendClientMessage(i, -1, "O motor do seu veнculo parou de funcionar"); } } } } return 1; } stock RepararMotor(vehicleid) { SetVehicleHealth(vehicleid, 1000); new engine, lights, alarm, doors, bonnet, boot, objective; GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective); SetVehicleParamsEx(vehicleid, VEHICLE_PARAMS_ON, lights, alarm, doors, bonnet, boot, objective); return 1; }