[SOLVED]Vehicle Health
#1

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;
}
Reply
#2

so what's the problem??
Reply
#3

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
Reply
#4

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;
}
Reply
#5

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
Reply
#6

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

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)