King12 Posted October 7, 2014 Share Posted October 7, 2014 Hello there, I just want to know why it's not working and it's not outputing any erros: function starts() setTimer( function () for i,v in pairs(getElementsByType("player")) do if (isKeyBound (v,"m")) then unbindKey(v, "M") outputChatBox("Done") else outputChatBox("Couldn't unbind the key") end end end , 2000, 1) end addEventHandler("onGamemodeMapStart", root, starts) addEventHandler("onClientMapStarting",root, starts) addEventHandler("onResourceStart", root, starts) It keeps saying Couldn't unbind the key. Also, I have to functions for drawing a text when the map starts. I want when the player disable it and the next map starts while it's disabled it reset back to false. function startss() setTimer( function (thePlayer) enabled = false removeEventHandler("onClientRender",getRootElement(),mapwindowa) removeEventHandler("onClientRender",getRootElement(),mapwindowda) unbindKey(getElementData ( resourceRoot, "Bindkey" )) bindKey( getElementData ( resourceRoot, "Bindkey" ),"down",toggleHideAll) bindKey( getElementData ( resourceRoot, "Bindkey" ),"down",slowvol) end ,50,2) end addEventHandler("onGamemodeMapStart", root, startss) addEventHandler("onClientMapStarting",root, startss) function toggleHideAll(thePlayer) startTimess = getTickCount() if enabled == false then local removeit = setTimer( function () unbindKey(thePlayer, getElementData ( resourceRoot, "Bindkey" )) end, 50,1) removeEventHandler("onClientRender",getRootElement(),mapwindowa) addEventHandler("onClientRender",getRootElement(),mapwindowda) else local removeit1 = setTimer( function () unbindKey(thePlayer, getElementData ( resourceRoot, "Bindkey" )) end, 50,1) removeEventHandler("onClientRender",getRootElement(),mapwindowda) addEventHandler("onClientRender",getRootElement(),mapwindowa) end enabled = not enabled end bindKey( getElementData ( resourceRoot, "Bindkey" ),"down", toggleHideAll) function windowa() dxDrawText("Enabled",165+(sx-400)/2,beta+60,((sx-400)/2)+400,beta+85,tocolor(255,255,255),1.7,"default","left","top",true) end function windowda() dxDrawText("Disabled",165+(sx-400)/2,beta+60,((sx-400)/2)+400,beta+85,tocolor(255,255,255),1.7,"default","left","top",true) end Link to comment
TAPL Posted October 7, 2014 Share Posted October 7, 2014 Uppercase letters wasn't working until this update: https://code.google.com/p/mtasa-blue/source/detail?r=6878 You have to update your mta and force all your players to update or use lowercase letters. Link to comment
King12 Posted October 7, 2014 Author Share Posted October 7, 2014 Uppercase letters wasn't working until this update:https://code.google.com/p/mtasa-blue/source/detail?r=6878 You have to update your mta and force all your players to update or use lowercase letters. Alright, could you help me with the other code? 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