Little Problem :/
#1

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?
Reply
#2

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

nop doesn't fix it..
Reply
#4

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

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

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

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

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

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)