Assassin-NL Posted March 3, 2010 Share Posted March 3, 2010 function funcInput ( key, keyState ) afkTime = 60*2 if ( keyState == "up" ) then setTimer(afkgo,afkTime,1) end if ( keyState == "down" ) then afktimer = getTimers ( afkTime) for timerKey, timerafk in ipairs(afktimer) do killTimer ( timerafk ) end end end function afkgo() afkTime =600*2 afktimer = getTimers ( afkTime) for timerKey, timerafk in ipairs(afktimer) do killTimer ( timerafk ) end outputChatBox ( "afk" ) end function bindTheKeys () bindKey ( "forwards", "down", funcInput ) bindKey ( "forwards", "up", funcInput ) bindKey ( "backwards ", "down", funcInput ) bindKey ( "backwards ", "up", funcInput ) bindKey ( "left", "down", funcInput ) bindKey ( "left", "up", funcInput ) bindKey ( "right", "down", funcInput ) bindKey ( "right", "up", funcInput ) end addEventHandler("onClientPlayerSpawn",getLocalPlayer(),bindTheKeys) does this work ? if no how to fix Link to comment
Callum Posted March 3, 2010 Share Posted March 3, 2010 does this work ? if no how to fix You know you should actually try the script and debug it before asking for help here. Link to comment
Assassin-NL Posted March 3, 2010 Author Share Posted March 3, 2010 i tested it and it doesnt work and i hope you guys can help because i dont know what i did wrong Link to comment
karlis Posted March 3, 2010 Share Posted March 3, 2010 (edited) u got various syntax problems,i think i fixed it, i also made it little more efficient afkTime = 1320 function funcInput ( key, keyState ) if ( keyState == "up" ) then if not isTimer(afktimer) then afktimer = setTimer(function() outputChatBox("afk") end,afkTime,1) end else killTimer ( afktimer ) end end function bindTheKeys () bindKey ( "forwards", "both", funcInput ) bindKey ( "backwards ", "both", funcInput ) bindKey ( "left", "both", funcInput ) bindKey ( "right", "both", funcInput ) end addEventHandler("onClientPlayerSpawn",getLocalPlayer(),bindTheKeys) BTW: use Edited March 4, 2010 by Guest Link to comment
Gamesnert Posted March 3, 2010 Share Posted March 3, 2010 Also note that you can replace: bindKey ( "(key)", "down", funcInput ) bindKey ( "(key)", "up", funcInput ) with: bindKey ( "(key)", "both", funcInput ) Should save you a bit in lines. Link to comment
Assassin-NL Posted March 4, 2010 Author Share Posted March 4, 2010 thanks for helping me out also what to replace for kick instead of kill ? Link to comment
Gamesnert Posted March 4, 2010 Share Posted March 4, 2010 Trigger a server event for the kicking, since the client can't kick itself. Link to comment
Assassin-NL Posted March 4, 2010 Author Share Posted March 4, 2010 is trigger a server event for the kicking about the same triggering a server event for banning ? onBan Link to comment
Gamesnert Posted March 4, 2010 Share Posted March 4, 2010 is trigger a server event for the kicking about the same triggering a server event for banning ? onBan I mean adding your own event with addEvent and then using triggerServerEvent. 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