zazais
Специалист
Привет. Вообщем хотел попробовать сделать чтобы при при повреждении машина не взырвалась если мало хп 300, но она всеравно взырываеться
Код:
public OnVehicleDamageStatusUpdate(vehicleid, playerid)
{
new house = PlayerInfo[playerid][pPhousekey]; new Float: carhp;
GetVehicleHealth(vehicleid, carhp);
foreach(Player,i)
{
if(GetPlayerVehicleID(playerid) == caridhouse[i])
{
if(carhp > 700 && carhp < 1000) { HouseInfo[house][hVehSost] -= 0,PlayerInfo[playerid][pProz] -= 0; return true; }
else if(carhp > 500 && carhp < 700) { HouseInfo[house][hVehSost] -= 1,PlayerInfo[playerid][pProz] -= 1; return true; }
else if(carhp > 200 && carhp < 500) { if(PlayerInfo[playerid][pProz] > 0) HouseInfo[house][hVehSost] -= 2; PlayerInfo[playerid][pProz] -= 2; return true; }
}
}
/*if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new Float:vhealth;
GetVehicleHealth(vehicleid, vhealth); //доделать
if(vhealth > 400 && vhealth < 500)
{
SendClientMessage(playerid, COLOR_ORANGE, "Ваш транспорт повреджен. Используйте {ff0000}\"/repcar\" {FF9900}Или воспользуйтесь мастерскими (f6eb86)(/gps > 7 / 2)");
}
}*/
if(GetPlayerState(playerid) == 2)
{
new carid = GetPlayerVehicleID(playerid);
if(IsAPlane(carid) || IsABoat(carid) || IsANoSpeed(carid) || IsABike(carid))
{
new string[256];
new Float:VHealth;
GetVehicleHealth(carid,VHealth);
if(VHealth <= 300)
{
{
format(string,sizeof(string),"Двигатель заглох (( %s ))",PlayerInfo[playerid][pNames]);
ProxDetector(playerid, 30.0, COLOR_PURPLE, string);
SendClientMessage(playerid, COLOR_ORANGE, "Ваш транспорт повреджен. Используйте {ff0000}\"/repcar\" {FF9900}Или воспользуйтесь мастерскими (f6eb86)(/gps > 7 / 2)");
}
}
}
}
return true;
}
