SA-MP Forums Archive
Scripting help..1 line - 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: Scripting help..1 line (/showthread.php?tid=200309)



Scripting help..1 line - ifly4life - 18.12.2010

Well i trying to De-bug a script and re-moldel it well this is the line that wont compile
"GetVehicleVelocity" i know it's probaly not a command but i need something like it so i can
get the vehicle speed ...All help will be greatly appreciated Thx in advance
(I also just started scripting so please don't act like im stupid)


Re: Scripting help..1 line - Benjo - 18.12.2010

GetVehicleVelocity is indeed a samp function. It will give you the velocity that the vehicle is moving on all the axis - x, y and z. You can read about it on the wiki here: https://sampwiki.blast.hk/wiki/GetVehicleVelocity

If you still have some problems, post the line/code in question and perhaps somebody will be able to help you out.


Re: Scripting help..1 line - ifly4life - 18.12.2010

Thank you very much


Re: Scripting help..1 line - MrDeath537 - 18.12.2010

I'll give you a small function, maybe you will use it:

pawn Код:
stock
    GetVehicleSpeed(vehicleid)
    {
        new
            Float: x,
            Float: y,
            Float: z;

        GetVehicleVelocity(vehicleid, x, y, z);
        return floatround((floatmul(floatsqroot(floatpower(x, 2.0) + floatpower(y, 2.0) + floatpower(z, 2.0)), 100.0) / 0.4463), floatround_floor);
    }
It returns the vehicle speed in kmp/h.