K4stic Posted March 10, 2013 Posted March 10, 2013 (edited) function blablabla (hitPlayer) local vehicle = getPedOccupiedVehicle(hitPlayer) local speed = getElementSpeed(vehicle,1) if speed < 30 then function getElementSpeed(element,unit) if (unit == nil) then unit = 0 end if (isElement(element)) then local x,y,z = getElementVelocity(element) if (unit=="mph" or unit==1 or unit =='1') then return (x^2 + y^2 + z^2) ^ 0.5 * 100 else return (x^2 + y^2 + z^2) ^ 0.5 * 1.61 * 100 end else return false end end on first 5 lines is the one part of all code so i just no add end to this 5 lines the error at line 5: attempt to compare boolean with number Edited March 10, 2013 by Guest Giving a Fuck? Nope, That isn't in My Skill Set
Anderl Posted March 10, 2013 Posted March 10, 2013 (edited) You need to add 'end's. And it's giving that error because "hitPlayer" is either not an element (but that would give the error 'Bad ped pointer' @ 'getPedOccupiedVehicle' function) or "hitPlayer" is not inside a vehicle, so you're comparing a boolean value with a number. Edited March 10, 2013 by Guest "[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007
K4stic Posted March 10, 2013 Author Posted March 10, 2013 (edited) on first 5 lines is the one part of all code so i just no add end to this 5 lines Edited March 10, 2013 by Guest Giving a Fuck? Nope, That isn't in My Skill Set
Anderl Posted March 10, 2013 Posted March 10, 2013 Talk in a proper english then. "[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007
K4stic Posted March 10, 2013 Author Posted March 10, 2013 so you can help me yes or no Community PLS HELP me Giving a Fuck? Nope, That isn't in My Skill Set
K4stic Posted March 10, 2013 Author Posted March 10, 2013 if need full code just say Giving a Fuck? Nope, That isn't in My Skill Set
Anderl Posted March 10, 2013 Posted March 10, 2013 I already explained you the possible problems, it's up to you to check, I don't guess things.. "[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007
HunT Posted March 10, 2013 Posted March 10, 2013 addEventHandler("onClientVehicleEnter",root, function () addEventHandler ( "onClientRender", getRootElement(), getPlayerSpeed ) end ) addEventHandler("onClientVehicleExit",root, function () removeEventHandler ( "onClientRender", getRootElement(), getPlayerSpeed ) end ) function getPlayerSpeed ( ) local sx, sy, sz = getElementVelocity (getPedOccupiedVehicle(localPlayer)) return (sx^2 + sy^2 + sz^2)^0.5*180 end Now u can get the speed example : if(tonumber( math.floor( getPlayerSpeed() ) ) < 30 ) then @Huntone_
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