Jump to content

cvz


z24d

Recommended Posts

function getElementSpeed(theElement, unit) 
  
    -- Check arguments for errors 
    assert(isElement(theElement), "Bad argument 1 @ getElementSpeed (element expected, got " .. type(theElement) .. ")") 
    assert(getElementType(theElement) == "player" or getElementType(theElement) == "ped" or getElementType(theElement) == "object" or getElementType(theElement) == "vehicle", "Invalid element type @ getElementSpeed (player/ped/object/vehicle expected, got " .. getElementType(theElement) .. ")") 
    assert((unit == nil or type(unit) == "string" or type(unit) == "number") and (unit == nil or (tonumber(unit) and (tonumber(unit) == 0 or tonumber(unit) == 1 or tonumber(unit) == 2)) or unit == "m/s" or unit == "km/h" or unit == "mph"), "Bad argument 2 @ getElementSpeed (invalid speed unit)") 
    -- Default to m/s if no unit specified and 'ignore' argument type if the string contains a number 
    unit = unit == nil and 0 or ((not tonumber(unit)) and unit or tonumber(unit)) 
    -- Setup our multiplier to convert the velocity to the specified unit 
    local mult = (unit == 0 or unit == "m/s") and 50 or ((unit == 1 or unit == "km/h") and 180 or 111.84681456) 
    -- Return the speed by calculating the length of the velocity vector, after converting the velocity to the specified unit 
    return (Vector3(getElementVelocity(theElement)) * mult).length 
end 
  
local screenW, screenH = guiGetScreenSize() 
  
addEventHandler("onClientRender", root, 
    function() 
    if isPedInVehicle(source) then 
    local elementSpeed = getElementSpeed(source, km/h) 
    dxDrawText("Your Speed:"..elementSpeed, screenW * 0.7680, screenH * 0.9245, screenW * 0.9969, screenH * 0.9805, tocolor(48, 255, 0, 255), 1.50, "pricedown", "left", "top", false, false, false, true, false) 
    end 
end 
) 
  

? فين البربلم؟ التكست مايطلع

Link to comment
وش الأفضل للدي أكس ؟ من الرندر والبري رندر؟

+

الكود ماله رب : ( ابيه طبلون لكن ماضبط

استعمل بدال الفنكشن المفيد

getElementVelocity 

+ الافضل رندر عشان مايتسبب بلاق ,

لان الرندر افضل والبري رندر تستعمله في الاشياء الي تحتاج سرعة بزيادة,

Link to comment

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...