Jump to content

Target with crosshair.


#DaMiAnO

Recommended Posts

Hi!

I have this:

function excelToDriver ( target ) 
    if ( target ) then 
        if getElementType(target) == "vehicle" then 
        if getPedWeapon(source) == 23 then 
            speedx, speedy, speedz = getElementVelocity ( target ) 
            actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) 
            kmh = actualspeed * 180 
            outputChatBox("* Prędkość namierzonego pojazdu wynosi: "..math.floor(tonumber(kmh)).. " KM/h.", getRootElement(), 255, 255, 255, true) 
            end 
        end 
    end 
end 
addEventHandler ( "onClientPlayerTarget", getRootElement(), excelToDriver) 

, but i want target with aiming to vehicle, not when my ped is looking to vehicle when he had sd pistol in hand.

Link to comment
function excelToDriver ( target ) 
        if getElementType(target) == "vehicle" then 
              if getPedWeapon(source) == 23 then 
                 speedx, speedy, speedz = getElementVelocity ( target ) 
                 actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) 
                 kmh = actualspeed * 180 
                  outputChatBox("* Prędkość namierzonego pojazdu wynosi: "..math.floor(tonumber(kmh)).. " KM/h.", getRootElement(), 255, 255, 255, true) 
            end 
       end 
end 
addEventHandler ( "onClientPlayerTarget", getRootElement(), excelToDriver) 

Link to comment
function excelToDriver ( target ) 
        if getElementType(target) == "vehicle" then 
              if getPedWeapon(source) == 23 then 
                 speedx, speedy, speedz = getElementVelocity ( target ) 
                 actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) 
                 kmh = actualspeed * 180 
                  outputChatBox("* Prędkość namierzonego pojazdu wynosi: "..math.floor(tonumber(kmh)).. " KM/h.", getRootElement(), 255, 255, 255, true) 
            end 
       end 
end 
addEventHandler ( "onClientPlayerTarget", getRootElement(), excelToDriver) 

It isn't it.

Link to comment
function excelToDriver (target) 
     if (target) and getElementType(target) == "vehicle" and getPedWeapon(localPlayer) == 23 and getControlState("aim_weapon") then 
            speedx, speedy, speedz = getElementVelocity(target) 
            actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) 
            kmh = actualspeed * 180 
            outputChatBox("* Prędkość namierzonego pojazdu wynosi: "..math.floor(tonumber(kmh)).. " KM/h.",255,255,255,true) 
     end 
end 
addEventHandler("onClientPlayerTarget",localPlayer,excelToDriver) 

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