SA-MP Forums Archive
Little Problem :/ - 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: Little Problem :/ (/showthread.php?tid=185146)



Little Problem :/ - Sascha - 23.10.2010

Hi... I get this warning: tag missmatch (that's in the return line) and it doesn't work...

Код:
stock GetVehicleDamage(vehicleid)
{
	new Float:vhealth;
	GetVehicleHealth(vehicleid, vhealth);
	vhealth = (100 / 1000 * vhealth);
	return vhealth = (floatround(vhealth * 10.0) / 10.0);
}
where's the problem?


Re: Little Problem :/ - legodude - 23.10.2010

my fault. ddidnt do the job. it is made to do return the health of the car?


Re: Little Problem :/ - Sascha - 23.10.2010

nop doesn't fix it..


Re: Little Problem :/ - legodude - 23.10.2010

what must it return.
how many health the car lost ?


Re: Little Problem :/ - iJumbo - 23.10.2010

to my gm work good dont give any errors
pawn Код:
stock GetVehicleDamage(vehicleid)
{
    new Float:vhealth;
    new Float:bubu;
    GetVehicleHealth(vehicleid, vhealth);
    vhealth = (100 / 1000 * vhealth);
    bubu = (floatround(vhealth * 10.0) / 10.0);
    return bubu;
}
try this :P


Re: Little Problem :/ - legodude - 23.10.2010

your piece of code always returns 0 to me...

try this piece if you want how many damage the car has
Код:
stock GetVehicleDamage(vehicleid){
	new Float:vhealth,Float:ags;
        GetVehicleHealth(vehicleid, vhealth);
        ags=1000-vhealth;
	return ags;
}



Re: Little Problem :/ - iJumbo - 23.10.2010

do you need this ?https://sampwiki.blast.hk/wiki/GetVehicleDamageStatus


Respuesta: Little Problem :/ - The_Moddler - 23.10.2010

pawn Код:
stock GetVehicleDamage(vehicleid)
{
    new Float:vhealth;
    GetVehicleHealth(vehicleid, vhealth);
    return floatdiv(vhealth, 10);
}
Full health with that code would be 100.


Re: Little Problem :/ - Sascha - 23.10.2010

to gigi: nop I don't need this:P...

to the others:
I guess I fixed the problem now..., ty anyway:P


Re: Little Problem :/ - Badger(new) - 23.10.2010

You are returning a float value so change it to:
pawn Код:
stock Float:GetVehicleDamage(vehicleid)
{
    new Float:vhealth;
    GetVehicleHealth(vehicleid, vhealth);
    vhealth = (100 / 1000 * vhealth);
    return vhealth = (floatround(vhealth * 10.0) / 10.0);
}
IMPORTANT: Make sure you put this before the point where you use it in your script or it will cause errors.

Example:
pawn Код:
stock Float:GetVehicleDamage(vehicleid)
{
    new Float:vhealth;
    GetVehicleHealth(vehicleid, vhealth);
    vhealth = (100 / 1000 * vhealth);
    return vhealth = (floatround(vhealth * 10.0) / 10.0);
}
public OnPlayerEnterVehicle(playerid,vehicleid,ispassenger){
    new Float:damage=GetVehicleDamage(vehicleid);
    return 1;
}