Jump to content

afk killer problem


Recommended Posts

Posted (edited)

this is problem in debugscript 3 :afktimer.lua:40 attempt to call global 'getlocalplayer'

this is the code i have

function funcInput ( key, keyState )
 
afkTime =60000*15
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 =60000*15
     afktimer = getTimers ( afkTime)
for timerKey, timerafk in ipairs(afktimer) do
killTimer ( timerafk )
end
outputChatBox ( "afk" )
end
 
 
function bindTheKeys ()
outputChatBox("jupp")
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)

Edited by Guest
Posted

this script is a little mess..

one timer is enough..

and this:

bindKey ( "forwards", "down", funcInput )

is incorrect..

"forwards" is not a key..

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted

kevin, can you please try to listen to people and use properly indented code in the proper format? Write [lua], it's not that freaking hard. Also, this is a kinda dumb mistake, one you wouldn't make if you had the basics of Lua down. Seriously. Read a little.

Do NOT PM ME for help unless invited. - New MTA Script Editor

Scripting help "etiquette": understandable language, relevant code (ALL code if unsure), [Lua] tags, error messages with line numbers. Super simple stuff.

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