Jump to content

[Help] BindKey (Done)


amm2100

Recommended Posts

Hi , 1st I am newbie to Script I start since 2 Days

I need help in bindkey x to show the cursor

My Code

bindKey ( "x", "down",  
    function () 
     showCursor( true ) 
end  ) 

Help Me Please :D

That The Error I got in Console :[23:11:32] WARNING: myserver\script.lua:33: Bad argument @ 'bindKey' [Expected player at argument 1, got string 'x']

Notice bindKey ( "x", "down", This is Line 33

Edited by Guest
Link to comment

You're trying to bind the key server-side, so obviously you need to tell the server what player should bind the key. You can't just assume that the server will magically know what you want.

You need to define "player", it is returning nil because it's empty - it doesn't contain anything. You'd be better off doing this in a client-side script instead;

function testFunction() 
   showCursor(not isCursorShowing()) -- Toggles between true and false 
end 
bindKey("X", "down", testFunction) 

Link to comment
You're trying to bind the key server-side, so obviously you need to tell the server what player should bind the key. You can't just assume that the server will magically know what you want.

You need to define "player", it is returning nil because it's empty - it doesn't contain anything. You'd be better off doing this in a client-side script instead;

function testFunction() 
   showCursor(not isCursorShowing()) -- Toggles between true and false 
end 
bindKey("X", "down", testFunction) 

I made it on client-side and It Work :3 Ty very Much

sorry I am Noob Scriptwriter

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