[question] Car - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [question] Car (
/showthread.php?tid=67358)
[question] Car -
tony_fitto - 28.02.2009
Hey have a question i have do so when my car health is on 280 it will freeze the player like this
Код:
public OnFilterScriptInit()
{
SetTimer("VehicleHealthTimer",100,1);
return 1;
}
public VehicleHealthTimer()
{
for(new i = 0; i < GetMaxPlayers(); i++)
{
if(IsPlayerInAnyVehicle(i))
{
GetVehicleHealth(GetPlayerVehicleID(i),vhealth[i]);
if(vhealth[i] < 280)
{
TogglePlayerControllable(i, 0);
SendClientMessage(i,0xFFFFFF96,"|________________________________________Car________________________________________|");
SendClientMessage(i,0x0000FF96,"You can't drive this car anymore the engine is damage!");
SendClientMessage(i,0x0000FF96,"Call 911 and call for Medic or the Police (you must RP your car crash)");
}
}
}
}
The question is if i can do so when i leave the car it wond blow up it will stay there untill a towcar comes.
Re: [question] Car -
Chpp - 25.08.2009
Код:
new IsCarDamaged(vehid);
new CarCrashed(i);
public VehicleHealthTimer()
{
for(new i = 0; i < GetMaxPlayers(); i++)
{
if(IsPlayerInAnyVehicle(i))
{
GetVehicleHealth(GetPlayerVehicleID(i),vhealth[i]);
if(vhealth[i] < 280)
{
vehid = (GetPlayerVehicleID(i));
CarCrashed(i) = 1;
TogglePlayerControllable(i, 0);
SendClientMessage(i,0xFFFFFF96,"|________________________________________Car________________________________________|");
SendClientMessage(i,0x0000FF96,"You can't drive this car anymore the engine is damage!");
SendClientMessage(i,0x0000FF96,"Call 911 and call for Medic or the Police (you must RP your car crash)");
}
}
}
}
public OnPlayerStateChange(playerid)
{
if CarCrashed = 1
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_YELLOW, "Your car is damaged and not driveable");
}
return 1
}
Now the person might not be able to drive. Not sure though
Re: [question] Car -
woot - 25.08.2009
Set the vehiclehealth to ~ 300 or something (to prevent it from exploding), then eject him. Then OnPlayerStateChange, like the previous poster said