SA-MP Forums Archive
[SOLVED]Vehicle Health - 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: [SOLVED]Vehicle Health (/showthread.php?tid=145242)



[SOLVED]Vehicle Health - eDz0r - 01.05.2010

pawn Код:
/*public OnPlayerEnterCheckpoint(playerid)
{
if (IsPlayerInRangeOfPoint(playerid, 7.0,cardelckp1))
{
GivePlayerMoney(playerid, 1000);
RemovePlayerFromVehicle(playerid);
DisablePlayerCheckpoint(playerid);
GameTextForPlayer(playerid, "~y~You Completed The Deliver, Well Done!", 3000, 1);
{*/

if (VehicleHealt = 100))//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<This is not exist
{
GivePlayerMoney(playerid, 300);
GameTextForPlayer(playerid, "~y~Great You Deliver It In Perfect Condition Bonus 300$!", 3000, 3);
}
return 1;
}



Re: [HELP]Vehicle Healt - aircombat - 01.05.2010

so what's the problem??


Re: [HELP]Vehicle Healt - eDz0r - 01.05.2010

Quote:
Originally Posted by Etch ❽ H
so what's the problem??
i need to check if hehicle has full healt to give playe 3000$ and a text message


Re: [HELP]Vehicle Healt - maij - 01.05.2010

First of
Код:
if (VehicleHealt = 100))
assigning a value to variable inside an if statement?
Probably unintended statement so change it to
Код:
if (VehicleHealt == 100))
Secondly, don't forget that vehiclehealth is a float. I do not see any declaration of the variable vehiclehealt so my guess it is a global variable.
don't forget it make it a float and get the vehicle health.

Код:
new Float:VehicleHealt;//assuming you really meant VehicleHealt and not VehicleHealth
public OnPlayerEnterCheckpoint(playerid)
{
if (IsPlayerInRangeOfPoint(playerid, 7.0,cardelckp1))
{
GivePlayerMoney(playerid, 1000);
GetVehicleHealth(GetPlayerVehicleID(playerid),VehicleHealt);
RemovePlayerFromVehicle(playerid);
DisablePlayerCheckpoint(playerid);
GameTextForPlayer(playerid, "~y~You Completed The Deliver, Well Done!", 3000, 1);
{
if (VehicleHealt == 1000))//Change 1000 to max vehicle health, cuz I honestly do not know.
{
GivePlayerMoney(playerid, 300);
GameTextForPlayer(playerid, "~y~Great You Deliver It In Perfect Condition Bonus 300$!", 3000, 3);
}
return 1;
}



Re: [HELP]Vehicle Healt - eDz0r - 01.05.2010

Quote:
Originally Posted by maij
First of
Код:
if (VehicleHealt = 100))
assigning a value to variable inside an if statement?
Probably unintended statement so change it to
Код:
if (VehicleHealt == 100))
Secondly, don't forget that vehiclehealth is a float. I do not see any declaration of the variable vehiclehealt so my guess it is a global variable.
don't forget it make it a float and get the vehicle health.

Код:
new Float:VehicleHealt;//assuming you really meant VehicleHealt and not VehicleHealth
public OnPlayerEnterCheckpoint(playerid)
{
if (IsPlayerInRangeOfPoint(playerid, 7.0,cardelckp1))
{
GivePlayerMoney(playerid, 1000);
GetVehicleHealth(GetPlayerVehicleID(playerid),VehicleHealt);
RemovePlayerFromVehicle(playerid);
DisablePlayerCheckpoint(playerid);
GameTextForPlayer(playerid, "~y~You Completed The Deliver, Well Done!", 3000, 1);
{
if (VehicleHealt == 1000))//Change 1000 to max vehicle health, cuz I honestly do not know.
{
GivePlayerMoney(playerid, 300);
GameTextForPlayer(playerid, "~y~Great You Deliver It In Perfect Condition Bonus 300$!", 3000, 3);
}
return 1;
}
i Will Try now
P.S Sorry about Languace mistake i am Romanian


Re: [HELP]Vehicle Healt - BurningSWA - 01.05.2010

i once made the same mistake i made a command were the car should eb health,but instead it went on fire (FAIL)


Re: [HELP]Vehicle Healt - eDz0r - 01.05.2010

Here Is The Good Code
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
if (IsPlayerInRangeOfPoint(playerid, 7.0,cardelckp1))
{
GivePlayerMoney(playerid, 10000);
RemovePlayerFromVehicle(playerid);
DisablePlayerCheckpoint(playerid);
GameTextForPlayer(playerid, "~y~You Completed The Deliver, Well Done!", 3000, 1);
new Float:health;
GetVehicleHealth(pcar1, health);
if(health >500)
{
GivePlayerMoney(playerid, 3000);
GameTextForPlayer(playerid, "~y~Great You Deliver It In Perfect Condition Bonus 300$!", 3000, 3);
}
}
return 1;
}