SA-MP Forums Archive
Why is this not working please help me - 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: Why is this not working please help me (/showthread.php?tid=337044)



Why is this not working please help me - Scripter12345 - 24.04.2012

I am trying to make it so you can set the vehicles health level


pawn Код:
CMD:setvehiclehealth(playerid, params[])
{
    if(PlayerData[ID][AdminLevel] >= 1)
    {
        new VehicleHealth;
        new vehicleid = GetPlayerVehicleID(playerid);
        if(sscanf(params, "f", VehicleHealth)) return SendClientMessage(playerid, COLOR_GREEN, "/setvehiclehealth [Health]");
        new pstring[128];
        format(pstring,sizeof(pstring),"You have set your vehicle health to %f",VehicleHealth);
        SendClientMessage(playerid, COLOR_GREEN, pstring);
        SetVehicleHealth(vehicleid,VehicleHealth);
    }
    return 1;
}
But when i put a number in the health bit it says "You have set your vehicle health to (the number) but when i drive around the car still gets damaged ( bonet coming off doors coming off ) but it never blows up even if i put the number to 1


Thank You


Please Help Me Please


Re: Why is this not working please help me - Pinguinn - 24.04.2012

You should either replace
pawn Код:
new VehicleHealth;
with
pawn Код:
new Float:VehicleHealth;
or replace
pawn Код:
SetVehicleHealth(vehicleid,VehicleHealth);
with
pawn Код:
SetVehicleHealth(vehicleid,float(VehicleHealth));