#DaMiAnO Posted December 2, 2011 Share Posted December 2, 2011 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
diegofkda Posted December 2, 2011 Share Posted December 2, 2011 I didn't get you. Could you specify better? Link to comment
#DaMiAnO Posted December 2, 2011 Author Share Posted December 2, 2011 When my ped is holding sd pistol in hand, i move camera at the car (not aiming), i will see outputchatbox. I want see outputchatbox when my ped is aiming to car, not when ped see car (with holding sd). Link to comment
Charlie_Jefferson Posted December 3, 2011 Share Posted December 3, 2011 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
#DaMiAnO Posted December 3, 2011 Author Share Posted December 3, 2011 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
TAPL Posted December 3, 2011 Share Posted December 3, 2011 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now