kevincouto6 Posted June 22, 2018 Share Posted June 22, 2018 Hello, I would like to tell you some other tip, I think it is not working because I am specifying only the location of the player, but if I use the location of the ped of "a nill value", and the same thing is happening with just the location player thePed = createPed(104, -2406.92749, -593.24597, 132.64844) function onPedRender() local x ,y, z = getElementPosition(thePed) local sx, sy, sz = getElementPosition(localPlayer) local Dist = getDistanceBetweenPoints3D (x, y, z, sx, sy, sz) givePedWeapon(thePed, 31, 5000, true) setElementFrozen( thePed, true) setPedControlState(thePed, "fire", true) setPedAimTarget(thePed, sx, sy, sz) setPedRotation(thePed, findRotation(x , y)) end addEventHandler("onClientRender", root, onPedRender) addEventHandler("onClientPedDamage", root, onPedRender) Line 11 error " a nill value" Link to comment
Administrators Lpsd Posted June 22, 2018 Administrators Share Posted June 22, 2018 Tons of things wrong with this. For a starter you're calling the onPedRender function every frame without any kind of checks to see if "thePed" exists, or if he already has the weapon which you're trying to give him - that's extremely bad practice. Also, where is this "findRotation" function? You haven't included in the code. In future please provide the full error, I highly doubt it was just "a nil value". That helps no one. Link to comment
kevincouto6 Posted June 28, 2018 Author Share Posted June 28, 2018 On 22/06/2018 at 18:35, LopSided_ said: Tons of things wrong with this. For a starter you're calling the onPedRender function every frame without any kind of checks to see if "thePed" exists, or if he already has the weapon which you're trying to give him - that's extremely bad practice. Also, where is this "findRotation" function? You haven't included in the code. In future please provide the full error, I highly doubt it was just "a nil value". That helps no one. could you help me with the script I'm not very good at scripting I'm learning 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