15.02.2013, 03:58
The title is a bit misleading, I need a code that shuts the vehicle off when the damage reaches 400.0 on /dl
public OnPlayerUpdate(playerid)
{
if(IsPlayerInAnyVehicle(playerid))
{
new vehicleid = GetPlayerVehicleID(playerid);
new Float:fVehicleHealth; GetVehicleHealth(vehicleid, fVehicleHealth);
if(fVehicleHealth <= 20.0)
{
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, false, lights, alarm, doors, bonnet, boot, objective);
}
}
return 1;
}
Someone like this should work.
pawn Код:
|
Someone like this should work.
pawn Код:
|
public OnPlayerUpdate(playerid) { if(IsPlayerInAnyVehicle(playerid)) { new vehicleid = GetPlayerVehicleID(playerid); new Float:fVehicleHealth; GetVehicleHealth(vehicleid, fVehicleHealth); if(fVehicleHealth <= 400.0) SendClientMessage(playerid, yellow, "Your vehicle has taken too much damage and refuses to move! ((Find a Mechanic))"); { new engine, lights, alarm, doors, bonnet, boot, objective; GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective); SetVehicleParamsEx(vehicleid, false, lights, alarm, doors, bonnet, boot, objective); } } return 1; }
So I just tried to add a SendClientMessage to let the player know their vehicle was damaged, but the vehicles won't even turn on.
Код:
public OnPlayerUpdate(playerid) { if(IsPlayerInAnyVehicle(playerid)) { new vehicleid = GetPlayerVehicleID(playerid); new Float:fVehicleHealth; GetVehicleHealth(vehicleid, fVehicleHealth); if(fVehicleHealth <= 400.0) SendClientMessage(playerid, yellow, "Your vehicle has taken too much damage and refuses to move! ((Find a Mechanic))"); { new engine, lights, alarm, doors, bonnet, boot, objective; GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective); SetVehicleParamsEx(vehicleid, false, lights, alarm, doors, bonnet, boot, objective); } } return 1; } |
public OnPlayerUpdate(playerid)
{
if(IsPlayerInAnyVehicle(playerid))
{
new vehicleid = GetPlayerVehicleID(playerid);
new Float:fVehicleHealth; GetVehicleHealth(vehicleid, fVehicleHealth);
if(fVehicleHealth <= 20.0)
{
SendClientMessage(playerid, yellow, "Your vehicle has taken too much damage and refuses to move! ((Find a Mechanic))")''
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, false, lights, alarm, doors, bonnet, boot, objective);
}
}
return 1;
}