Jump to content

[REL] getPlayerSpeed


Cazomino05

Recommended Posts

Posted (edited)

Resource: http://rapidshare.com/files/85836435/ge ... d.zip.html

This function is ONLY for vehicles support for anything else is not in this script

Example usage (put this in your gamemode or where ever you want to doesent Have to be in this resource) :)

obveously it could be cleaned up a little but just wanted to show how i did it and id use getElementVelocity but i prefer it this way

  
function getPlayerSpeed2( thePlayer, commandName ) 
    local speed = call( getResourceFromName("getPlayerSpeed"), "getPlayerSpeed", thePlayer, 1 ) 
    if (speed ~= false) then 
        outputChatBox( "Speed in mph: " .. speed ) 
    end 
end 
  
addCommandHandler( "currentspeed", getPlayerSpeed2 ) 
  

Usages supported:

Both below return mph its just your prefrence really...

  • getPlayerSpeed( player thePlayer, "MPH" )
  • getPlayerSpeed( player thePlayer, 1 )

Both below return kmh its just your prefrence really...

  • getPlayerSpeed( player thePlayer, "KMH" )
  • getPlayerSpeed( player thePlayer, 2 )

Returns an Integer of the the players speed

Edited by Guest
  • 2 years later...
  • 3 weeks later...
Posted

link is down.. btw: this should be added as useful snippet rather than another resource..

https://wiki.multitheftauto.com/wiki/Useful_Functions

edit: i just saw 2 years old bump..

speedx resource have useful function to count speed

edit:

if somebody needs:

https://wiki.multitheftauto.com/wiki/GetElementSpeed

https://wiki.multitheftauto.com/wiki/SetElementSpeed

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...