Jump to content

error at jumper script


emreb

Recommended Posts

I am getting BadArgument @ setelementposition error on debug script.

whats wrong with my script?

I am really new on lua.

function jumper () 
    local playerpos = getLocalPlayer() 
    local x, y, z = getElementPosition ( playerpos ) 
    setElementPosition ( source, x, y, 100 ) 
end 
addCommandHandler ( "jump", jumper ) 

Link to comment
function jumper () 
    local playerpos = getLocalPlayer() 
    local x, y, z = getElementPosition ( playerpos ) 
    setElementPosition ( getLocalPlayer(), x, y, 100 ) 
end 
addCommandHandler ( "jump", jumper ) 

huh, didn't you notice that he used local playerpos = getLocalPlayer()?, so instead of repeating getLocalPlayer(), using playerpos would fit.

Link to comment
  • Moderators

Just simply use localPlayer inside your whole client code.

It is a predefined variable and it is shorter so you have to write less characters. :idea:

(and it is 1 ms faster then getLocalPlayer(), because it isn't a function.)

.

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