vehicle fix - 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)
+--- Thread: vehicle fix (
/showthread.php?tid=376902)
vehicle fix -
R4VER - 12.09.2012
hey guys i scripted this lil thingy . it compiles successfully but it doesn't work...how to fix that fucking bug ?
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new playerState = GetPlayerState(playerid);
if(playerState == PLAYER_STATE_DRIVER)
{
new Float: health;
new veh;
veh = GetPlayerVehicleID(playerid);
if(GetVehicleHealth(veh,health) <100)
{
RepairVehicle(playerid);
}
}
return 1;
}
Re: vehicle fix -
clarencecuzz - 12.09.2012
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
new Float: health;
new veh;
veh = GetPlayerVehicleID(playerid);
if(GetVehicleHealth(veh,health) < 1000) //Max vehicle health is 1000 not 100.
{
RepairVehicle(playerid);
}
}
return 1;
}
Re: vehicle fix -
R4VER - 12.09.2012
whoops

thx so much
Re: vehicle fix -
R4VER - 12.09.2012
tried it but it didn't work either
Respuesta: vehicle fix -
Siralos - 12.09.2012
GetVehicleHealth does not return any values. The value is stored in 'health' variable. And RepairVehicle takes the car as parameter, not the player
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new playerState = GetPlayerState(playerid);
if(playerState == PLAYER_STATE_DRIVER)
{
new Float: health;
new veh;
veh = GetPlayerVehicleID(playerid);
GetVehicleHealth(veh,health);
if(health < 1000)
{
RepairVehicle(veh);
}
}
return 1;
}
Re: vehicle fix -
[ABK]Antonio - 12.09.2012
You don't need GetPlayerState(playerid), you can use newstate