Jump to content

how to detect capslock?


12p

Recommended Posts

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

@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

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

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

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