prolol Posted February 4, 2010 Posted February 4, 2010 hai, i'm kinda new, but i got this simple script to activate the cursor, but it doesn't seem to work, can anyone help me? here the script: addEventHandler ( "onResourceLoad", getRootElement(), "loadScripts" ) function loadScripts for index, player in getElementsByType ( "player" ) do bindKey ( player, "p"down", "hookCursor" ) end end addEventHandler ( "onPlaterJoin", getRootElement(), "handleSingleJoin" ) function handleSingleJoin bindKey( source, "p" "down", "hookCursor" ) end function hookCursor if isCursorShowing ( source ) then showCursor ( source, false ) else showCursor ( source, true ) end end and here is the meta.xml: - <meta> <info src="test.lua" type="client" version="1.0.0" /> </meta>]
MasterTobi Posted February 4, 2010 Posted February 4, 2010 bindkey at clientside don´t need the arg source, use bindKey ("p","down", "hookCursor" )
Antibird Posted February 4, 2010 Posted February 4, 2010 There are lot of syntax mistakes: Lines 3, 11, 15: missed "( )" after function name Line 4: should be for index, player in [color=#FF0000]pairs[/color]( getElementsByType ( "player" ) ) do Line 5: bindKey ( player, "p[color=#FF0000]", "[/color]down", "hookCursor" ) Line 9: "onPla[color=#FF0000]y[/color]erJoin" Line 12: bindKey( source, "p"[color=#FF0000],[/color]"down", "hookCursor" ) Finally, this script can't be client-side, all the functions and events you're using are for server-side scripts.
NeonBlack Posted February 4, 2010 Posted February 4, 2010 And you cannot add the event handler before defining the function. » Neon (Multigaming) Forum «
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