if(IsPlayerInAnyVehicle(playerid))
{
new vehicleid = GetPlayerVehicleID(playerid);
new Float:vHP;
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleHealth(vehicleid, vHP);
if(vHP < 400.00)
{
SetVehicleHealth(vehicleid, 400.00);
SendClientMessage(playerid, YELLOW, "The vehicle has taken to much damage and has broken.");
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objective);
}
}
if(GetPVarInt(playerid, "variable_name") == 0) {
SetPVarInt(playerid, "variable_name", 1);
// Code - will only be executed once
// or until "variable_name" is set back to 0
}
pawn Код:
|
if(IsPlayerInAnyVehicle(playerid))
{
new vehicleid = GetPlayerVehicleID(playerid);
new Float:vHP;
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleHealth(vehicleid, vHP);
if(vHP < 400.00)
{
if(GetPVarInt(playerid, "Vehicle_Breaking_Down") == 0) {
SetVehicleHealth(vehicleid, 400.00);
SendClientMessage(playerid, YELLOW, "The vehicle has taken to much damage and has broken.");
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objective);
SetPVarInt(playerid, "Vehicle_Breaking_Down", 1);
}
}
}