-.Paradox.- Posted July 2, 2014 Posted July 2, 2014 Hello guys, I'm trying to make an Away From Keyboard script for my multi-gamemode race server, In a running gamemode if player didn't move for exactly 1 minute he get kicked and i'm trying to cancel it if he moved before 1 min passes, anyway here is the code. function checkSomething() if getElementData(thePlayer, "Away From Keyboard") == true then setElementData(thePlayer, "Away From Keyboard", false) end end addEventHandler("onClientKey", getRootElement(), checkSomething) addEventHandler( "onClientCursorMove", getRootElement(), checkSomething) If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
xXMADEXx Posted July 2, 2014 Posted July 2, 2014 You can just use it on the server-side with getPlayerIdleTime function checkPlayers ( ) for i, p in pairs ( getElementsByType ( "player" ) ) do local t = math.floor ( getPlayerIdleTime ( p ) / 1000 ) if ( t >= 60 ) then kickPlayer ( p ) end end end checkPlayers ( ) setTimer ( checkPlayers, 3000, 0 ) The Ultimate Lua Tutorial! | MTA PHP SDK
-.Paradox.- Posted July 2, 2014 Author Posted July 2, 2014 You can just use it on the server-side with getPlayerIdleTime function checkPlayers ( ) for i, p in pairs ( getElementsByType ( "player" ) ) do local t = math.floor ( getPlayerIdleTime ( p ) / 1000 ) if ( t >= 60 ) then kickPlayer ( p ) end end end checkPlayers ( ) setTimer ( checkPlayers, 3000, 0 ) I did it already with getPlayerIdleTime in Server side and i set his element Data to "Away From Keyboard", in the client side i wanted to use onClientKey and onClientCursorMove to check if his ElementData is Away From Keyboard then set it to false... If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
-.Paradox.- Posted July 3, 2014 Author Posted July 3, 2014 Anyone? Or just give me functions/events i could use to check when the player move cursor and press a key. If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
Castillo Posted July 5, 2014 Posted July 5, 2014 I don't really understand the problem. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
-.Paradox.- Posted July 5, 2014 Author Posted July 5, 2014 Sorry for being unclear, I'm trying to set racer ElementData (Away From Keyboard) to false after moving his curosr or clicking a key, thanks. If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
SkittlesAreFalling Posted July 5, 2014 Posted July 5, 2014 (edited) localPlayer or getLocalPlayer() instead of thePlayer Edited July 5, 2014 by Guest http://www.prntscr.com/4fkwyj
MTA Team botder Posted July 5, 2014 MTA Team Posted July 5, 2014 getRootElement() Predefined variable: root getLocalPlayer() Predefined variable: localPlayer Source: https://forum.multitheftauto.com/viewtopic.php?f=91&t=39678 GitHub: Debug Console • MTA-Discord Relay Scripting: How to draw a line chart with DirectX functions? • Doppler Effect in MTA • Get the client's FPS • Customizable Blur Shader
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