11.03.2013, 12:04
Hello,
All I understood is that you don't want your vehicle to explode.
As u know, in GTA SA vehicle is about to explode when engine is on fire.
To prevent it, try something like this:
1) Use this code:
2) Get into any vehicle and type /testdmg X where X is number around 10-40. Just see for yourself for what X you given vehicle engine's being burning.
3) Then do something like this (in ur gamemode?)
X - maximum vehicle health, where car's engine starts to burn
Y - minimum vehicle health where car's engine ain't burning.
Perhaps it is that what you meant..
You can use 'globalTimer' for other repeatedly checks (for example to trace player score, XYZ coords, whatever).
Greetz,
LetsOWN
Quote:
Well today i been beta testing engine system >> so i want the cars not to blow up when it gets to the lowest level damage << am not sure how i would script the parts for the vehicle health to set as 0.300 |
As u know, in GTA SA vehicle is about to explode when engine is on fire.
To prevent it, try something like this:
1) Use this code:
pawn Код:
COMMAND:testdmg(playerid, params[])
{
new dmgVal;
if(sscanf(params, "d", dmgVal))
{
// 0 - min / 1000 - max
SetVehicleHealth(GetPlayerVehicleID(playerid), dmgVal);
new Str[64];
format(Str, 64, "Current damage: %d", dmgVal);
SendClientMessage(playerid, Str);
return 1;
}
}
3) Then do something like this (in ur gamemode?)
pawn Код:
public OnGameModeInit()
{
SetTimer("globalTimer", 500, 1);
return 1;
}
forward globalTimer();
public globalTimer()
{
for(new i = 0; i != MAX_PLAYERS; i++)
{
new Float:vdmg;
GetVehicleHealth(GetPlayerVehicleID(playerid), vdmg);
if(vdmg < X)
{
SetVehicleHealth(GetPlayerVehicleID(playerid), Y);
printf("Vehicle of player %d has been kinda repaired..", i);
}
}
}
Y - minimum vehicle health where car's engine ain't burning.
Perhaps it is that what you meant..
You can use 'globalTimer' for other repeatedly checks (for example to trace player score, XYZ coords, whatever).
Greetz,
LetsOWN