12p Posted July 16, 2014 Share Posted July 16, 2014 Is there a way to do it without getKeyState? Link to comment
Bonsai Posted July 16, 2014 Share Posted July 16, 2014 It might be possible to compare the input (like the first key pressed) with string.upper, at least for characters. Link to comment
12p Posted July 16, 2014 Author Share Posted July 16, 2014 I wish it was that easy. I wouldn't need to bother checking my local variable for caps. But characters delivered from input are always in lower case. Link to comment
Max+ Posted July 16, 2014 Share Posted July 16, 2014 Is there a way to do it without getKeyState? why you don't want to use this function ? Link to comment
12p Posted July 16, 2014 Author Share Posted July 16, 2014 Because it doesn't serve my purpose if the client has capslock enabled in his keyboard BEFORE joining a server, for obvious reasons. Now, is it possible or not? Maybe I'm missing a function here? Link to comment
_DrXenon Posted July 16, 2014 Share Posted July 16, 2014 Idk if that work.. OnClientKey < event. Check its parameters Link to comment
Max+ Posted July 16, 2014 Share Posted July 16, 2014 Maybe this will help ? addEventHandler ( 'onPlayerJoin', root, function ( ) triggerClientEvent ( source, 'Check', source ) end ) ---Client addEvent('Check', true ) addEventHandler ('Check', root, function ( ) if getKeyState( "capslock" ) == true then outputChatBox(getPlayerName(localPlayer)..'His CapsLocks Are Active ', 255, 255, 0 ) elseif getKeyState ( "capslocks") == false then outputChatBox(getPlayerName(localPlayer)..'His CapsLocks Are Not Active ', 255, 255, 0 ) end end ) Link to comment
12p Posted July 16, 2014 Author Share Posted July 16, 2014 @SuperCroz I didn't try using that event before... Tried now. Unfortunately, it din't work. Directly checking input only delivers lower case @Max I appreciate your intention, but if you don't know what you talk about then don't try to help me in first place. That code won't work because, as I implied in my previous post: since getKeyState only detects whether a key is pressed or not, it would only help when the player presses capslock after joining a server. Link to comment
bandi94 Posted July 16, 2014 Share Posted July 16, 2014 As far as i know it's not possible to check it with pure LUA ( aka LUA suck's a bit ). For this you would need to use Window's API's on the input handle Level , so this is more like up to the mod's to integrate a function inside MTA's DLL. Bk you will not be able to host a modified MTA version. Link to comment
12p Posted July 16, 2014 Author Share Posted July 16, 2014 Oh, too bad. I guess I have a suggestion for MTA now... Link to comment
Max+ Posted July 16, 2014 Share Posted July 16, 2014 Oh, too bad.I guess I have a suggestion for MTA now... yes , exactly it will Only work when it's pressed , if you you want to detect it witout press and unpress you Can't Link to comment
12p Posted July 16, 2014 Author Share Posted July 16, 2014 yes , exactly it will Only work when it's pressed , if you you want to detect it witout press and unpress you Can't wow thanks for the bit of information someone else already told me If any moderator comes, I ask to close this topic. My problem has its answer already, thanks to bandi94. Link to comment
Spajk Posted July 17, 2014 Share Posted July 17, 2014 I wish it was that easy. I wouldn't need to bother checking my local variable for caps.But characters delivered from input are always in lower case. How do you mean? Link to comment
ZL|LuCaS Posted July 17, 2014 Share Posted July 17, 2014 Is there a way to do it without getKeyState? getKeyState? check continuously if the key is active | or cancel uppercase messages as this. if not string.find(string.lower(text), text, 1, true) then outputChatBox("#E7DBADCaps Lock desativado.",source, 255, 255, 255, true) cancelEvent() return end Link to comment
12p Posted July 17, 2014 Author Share Posted July 17, 2014 Thanks, but that does no help at all. You clearly don't understand the question I made on this topic. I already how to deal with lower and upper case; all I wanted was to know whether the client had capslock ENABLED IN HIS KEYBOARD; not whether the player pressed it. So... If any moderator comes, I ask to close this topic. My problem has its answer already, thanks to bandi94. Please, don't bother replying, any of you. 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