Vehicle damage textdraw mess up - 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 damage textdraw mess up (
/showthread.php?tid=569770)
Vehicle damage textdraw mess up -
LeXuZ - 02.04.2015
Hello, I've been working on a vehicle damage textdraw and so some reason it doesn't put the health in.. it shows as Damage: 0.000000... I can't see what i've done or gone wrong here, would love for some help!
pawn Код:
public OnPlayerUpdate(playerid)
{
new ddamage[16];
format(ddamage, sizeof(ddamage), "damage: %0.f", GetVehDamage(playerid));
TextDrawSetString(DamageTD, ddamage);
}
stock GetVehDamage(playerid)
{
new Float:health;
new vehid = GetPlayerVehicleID(playerid);
GetVehicleHealth(vehid, health);
return 1;
}
Re: Vehicle damage textdraw mess up -
BGTrucker - 02.04.2015
stock GetVehDamage(playerid) should return the Float:health instead of 1.It should look like this
pawn Код:
public OnPlayerUpdate(playerid)
{
new ddamage[16];
format(ddamage, sizeof(ddamage), "damage: %0.f", GetVehDamage(playerid));
TextDrawSetString(DamageTD, ddamage);
}
stock GetVehDamage(playerid)
{
new Float:health;
new vehid = GetPlayerVehicleID(playerid);
GetVehicleHealth(vehid, health);
return health;
}
Re: Vehicle damage textdraw mess up -
LeXuZ - 02.04.2015
Getting this error when I change return health;
Quote:
C:\Users\BLACK\Desktop\FunRoam\gamemodes\FunRoam.p wn(1201) : warning 213: tag mismatch
|
Re: Vehicle damage textdraw mess up -
CalvinC - 02.04.2015
When returning a float, you need to add a float tag to the function.
pawn Код:
stock Float:GetVehDamage(playerid)
Re: Vehicle damage textdraw mess up -
LeXuZ - 02.04.2015
Adding a Float into the function brings this warning
Quote:
C:\Users\BLACK\Desktop\FunRoam\gamemodes\FunRoam.p wn(1196) : warning 208: function with tag result used before definition, forcing reparse
|
This works, it's just this warning i'm worried about.
Re: Vehicle damage textdraw mess up -
Smileys - 02.04.2015
try using
remove the Float: from the stock function.
AW: Re: Vehicle damage textdraw mess up -
FSAOskar - 02.04.2015
Quote:
Originally Posted by LeXuZ
Adding a Float into the function brings this warning This works, it's just this warning i'm worried about.
|
Just move the function up in your script(somewhere before you use that function).