Jump to content

Bad argument @'getElementVelocity'


saluta

Recommended Posts

Posted
Spoiler
Spoiler


spfont = dxCreateFont("fonts/font.ttf", 21)

local isAdded = false

function speed()
    if(isAdded == false) then
       addEventHandler ("onClientRender", root, getspeed)
       isAdded = true
    end
end
addEventHandler("onClientVehicleEnter", root, speed)

function wylacz ( )

    removeEventHandler ( "onClientRender", root, getspeed )
end
addEventHandler("onClientVehicleExit", root, wylacz)

function getspeed ( )
    if isPedInVehicle (localPlayer) == false then return end
    local sx, sy, sz = getElementVelocity (getPedOccupiedVehicle(localPlayer))
    kmhs = math.floor(((sx^2 + sy^2 + sz^2)^(0.5))*180)
    mphs = math.floor((((sx^2 + sy^2 + sz^2)^(0.5))*180)/1.6)
    health = getElementHealth (getPedOccupiedVehicle(localPlayer))
    name = getVehicleName (getPedOccupiedVehicle(localPlayer))
    currenthealth = math.floor(health/10)
    screenWidth, screenHeight = guiGetScreenSize()
    windowWidth, windowHeight = 300,170
    left = screenWidth/1.18 - windowWidth/9.8
    top = screenHeight/1.03 - windowHeight/20
    dxDrawText ( " "..tostring(kmhs).."km/h", left ,  top +2, screenWidth +2, screenHeight , tocolor ( 255, 255, 255, 255 ), 1, spfont )
    dxDrawText ( " "..tostring(kmhs).."km/h", left -2,  top, screenWidth, screenHeight -2, tocolor ( 255, 255, 0, 255 ), 1, spfont )
    dxDrawText ( " "..tostring(mphs).."mph", left ,  top -23, screenWidth +2, screenHeight , tocolor ( 255, 255, 255, 255 ), 1, spfont )
    dxDrawText ( " "..tostring(mphs).."mph", left -2,  top -25, screenWidth, screenHeight -2, tocolor ( 255, 255, 0, 255 ), 1, spfont )
end

 

Please help

Posted

local thecar = getPedOccupiedVehicle(localPlayer)

local sx, sy, sz = getElementVelocity (thecar)

-----------------------------------------------------

or just:
local  sx, sy, sz = getElementVelocity (localplayer)

Posted
4 hours ago, RavenLoad said:

местный thecar =  getPedOccupiedVehicle (localPlayer)

местные sx, sy, sz = getElementVelocity  (автомобиль )

-------------------------------------------------- ---

или просто:
local sx, sy, sz = getElementVelocity (localplayer)

not worked

Posted
Spoiler

That speedometer is all buggy, I threw off another one here the same errors but the code itself is small help please

Spoiler

screenWidth, screenHeight = guiGetScreenSize ( )
function speed()
if isPedInVehicle then
        theVehicle = getPedOccupiedVehicle ( getLocalPlayer() )
        speedx, speedy, speedz = getElementVelocity ( theVehicle )
        actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5)
        kmh = actualspeed * 180
        kmhFloor = math.floor (kmh)
        dxDrawText ( "KMH: ".. kmhFloor, screenWidth - 150, screenHeight - 40, screenWidth, screenHeight, tocolor ( 255, 255, 0, 255 ), 1.02, "pricedown" )
    end
end
addEventHandler ( "onClientRender", root, speed )
 

 

Posted

Again, all programmers are silent, but as I tell them about collaboration, I offer work for money, they refuse.  So you refuse to correct a small mistake here too.  Help me please.

Posted
spfont = dxCreateFont("fonts/font.ttf", 21)

local isAdded = false

function speed()
    if(isAdded == false) then
       addEventHandler ("onClientRender", root, getspeed)
       isAdded = true
    end
end
addEventHandler("onClientVehicleEnter", root, speed)

function wylacz ()
	if(isAdded == true) then
       removeEventHandler("onClientRender", root, getspeed)
       isAdded = false
    end
end
addEventHandler("onClientVehicleExit", root, wylacz)

function getspeed()
    local playerVehicle = getPedOccupiedVehicle(localPlayer)
    if(playerVehicle) then
       local sx, sy, sz = getElementVelocity(playerVehicle)
       kmhs = math.floor(((sx^2 + sy^2 + sz^2)^(0.5))*180)
       mphs = math.floor((((sx^2 + sy^2 + sz^2)^(0.5))*180)/1.6)
       health = getElementHealth(playerVehicle)
       name = getVehicleName(playerVehicle)
       currenthealth = math.floor(health/10)
       screenWidth, screenHeight = guiGetScreenSize()
       windowWidth, windowHeight = 300,170
       left = screenWidth/1.18 - windowWidth/9.8
       top = screenHeight/1.03 - windowHeight/20
       dxDrawText ( " "..tostring(kmhs).."km/h", left ,  top +2, screenWidth +2, screenHeight , tocolor ( 255, 255, 255, 255 ), 1, spfont )
       dxDrawText ( " "..tostring(kmhs).."km/h", left -2,  top, screenWidth, screenHeight -2, tocolor ( 255, 255, 0, 255 ), 1, spfont )
       dxDrawText ( " "..tostring(mphs).."mph", left ,  top -23, screenWidth +2, screenHeight , tocolor ( 255, 255, 255, 255 ), 1, spfont )
       dxDrawText ( " "..tostring(mphs).."mph", left -2,  top -25, screenWidth, screenHeight -2, tocolor ( 255, 255, 0, 255 ), 1, spfont )
    end
end

try this

  • Like 1
Posted
37 minutes ago, Burak5312 said:
spfont = dxCreateFont("fonts/font.ttf", 21)

local isAdded = false

function speed()
    if(isAdded == false) then
       addEventHandler ("onClientRender", root, getspeed)
       isAdded = true
    end
end
addEventHandler("onClientVehicleEnter", root, speed)

function wylacz ()
	if(isAdded == true) then
       removeEventHandler("onClientRender", root, getspeed)
       isAdded = false
    end
end
addEventHandler("onClientVehicleExit", root, wylacz)

function getspeed()
    local playerVehicle = getPedOccupiedVehicle(localPlayer)
    if(playerVehicle) then
       local sx, sy, sz = getElementVelocity(playerVehicle)
       kmhs = math.floor(((sx^2 + sy^2 + sz^2)^(0.5))*180)
       mphs = math.floor((((sx^2 + sy^2 + sz^2)^(0.5))*180)/1.6)
       health = getElementHealth(playerVehicle)
       name = getVehicleName(playerVehicle)
       currenthealth = math.floor(health/10)
       screenWidth, screenHeight = guiGetScreenSize()
       windowWidth, windowHeight = 300,170
       left = screenWidth/1.18 - windowWidth/9.8
       top = screenHeight/1.03 - windowHeight/20
       dxDrawText ( " "..tostring(kmhs).."km/h", left ,  top +2, screenWidth +2, screenHeight , tocolor ( 255, 255, 255, 255 ), 1, spfont )
       dxDrawText ( " "..tostring(kmhs).."km/h", left -2,  top, screenWidth, screenHeight -2, tocolor ( 255, 255, 0, 255 ), 1, spfont )
       dxDrawText ( " "..tostring(mphs).."mph", left ,  top -23, screenWidth +2, screenHeight , tocolor ( 255, 255, 255, 255 ), 1, spfont )
       dxDrawText ( " "..tostring(mphs).."mph", left -2,  top -25, screenWidth, screenHeight -2, tocolor ( 255, 255, 0, 255 ), 1, spfont )
    end
end

try this

Everything works fine, tried mistakes, let me offer you cooperation for your work, I will pay money, we will discuss my project in private messages.

  • Moderators
Posted
16 hours ago, saluta said:

Everything works fine, tried mistakes, let me offer you cooperation for your work, I will pay money, we will discuss my project in private messages.

If you are not interested in scripting and here for recruiting, then this is not the section for you. See section guidelines:

 

You should recruit people only there:

https://forum.multitheftauto.com/forum/149-looking-for-staff/

 

Locked

  • IIYAMA locked this topic
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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