Last active
September 30, 2024 09:02
-
-
Save KingCprey/d40f6deb8ac2949d95524448596e2f37 to your computer and use it in GitHub Desktop.
FiveM IsControlPressed keys
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--IsControlPressed(0,x) | |
local keys={} | |
keys[34]="A" | |
keys[29]="B" | |
keys[26]="C" | |
keys[30]="D" | |
keys[46]="E" | |
keys[49]="F" | |
keys[47]="G" | |
keys[74]="H" | |
keys[311]="K" | |
keys[7]="L" | |
keys[244]="M" | |
keys[249]="N" | |
keys[199]="P" | |
keys[44]="Q" | |
keys[45]="R" | |
keys[33]="S" | |
keys[245]="T" | |
keys[303]="U" | |
keys[0]="V" | |
keys[32]="W" | |
keys[77]="X" | |
keys[246]="Y" | |
keys[20]="Z" | |
keys[39]="[" | |
keys[27]="UpArr" | |
keys[173]="DownArr" | |
keys[174]="LeftArr" | |
keys[175]="RightArr" | |
keys[19]="LAlt" | |
keys[168]="F7" | |
keys[288]="F1" | |
keys[289]="F2" | |
keys[170]="F3" | |
keys[166]="F5" | |
keys[167]="F6" | |
keys[56]="F9" | |
keys[57]="F10" | |
keys[344]="F11" | |
keys[157]="1" | |
keys[158]="2" | |
keys[160]="3" | |
keys[164]="4" | |
keys[165]="5" | |
keys[159]="6" | |
keys[161]="7" | |
keys[162]="8" | |
keys[163]="9" | |
keys[21]="LShift" | |
--citizen cod | |
Citizen.CreateThread(function() | |
local count=0 | |
local keys={} | |
keys[34]="A" | |
keys[29]="B" | |
keys[26]="C" | |
keys[30]="D" | |
keys[46]="E" | |
keys[49]="F" | |
keys[47]="G" | |
keys[74]="H" | |
keys[311]="K" | |
keys[7]="L" | |
keys[244]="M" | |
keys[249]="N" | |
keys[199]="P" | |
keys[44]="Q" | |
keys[45]="R" | |
keys[33]="S" | |
keys[245]="T" | |
keys[303]="U" | |
keys[0]="V" | |
keys[32]="W" | |
keys[77]="X" | |
keys[246]="Y" | |
keys[20]="Z" | |
keys[39]="[" | |
keys[27]="UpArr" | |
keys[173]="DownArr" | |
keys[174]="LeftArr" | |
keys[175]="RightArr" | |
keys[19]="LAlt" | |
keys[168]="F7" | |
keys[288]="F1" | |
keys[289]="F2" | |
keys[170]="F3" | |
keys[166]="F5" | |
keys[167]="F6" | |
keys[56]="F9" | |
keys[57]="F10" | |
keys[344]="F11" | |
keys[157]="1" | |
keys[158]="2" | |
keys[160]="3" | |
keys[164]="4" | |
keys[165]="5" | |
keys[159]="6" | |
keys[161]="7" | |
keys[162]="8" | |
keys[163]="9" | |
keys[21]="LShift" | |
local ignore={169,240,239} | |
while true do | |
Wait(0) | |
local i=0 | |
while i<1000 do | |
if IsControlPressed(0,i) and not inside(ignore,i) then | |
if keys[i]==nil then | |
print(count .. " CONTROL PRESSED = " .. i) | |
count=count+1 | |
else | |
print(i .. " = " .. keys[i]) | |
break | |
end | |
end | |
i=i+1 | |
end | |
if IsControlPressed(0,20) then | |
break | |
end | |
end | |
end) |
Kann man auch eine Kombi von alt + und eine zahl oder Buchstabe zusätzlich
Ja das geht
in der config.lua so in etwa
Config.Controls = { TPMarker = {keyboard1 = Keys['LEFTALT'], keyboard2 = Keys['E']} }
und in der client.lua
if IsControlPressed(1, Config.Controls.TPMarker.keyboard1) and IsControlJustReleased(1, Config.Controls.TPMarker.keyboard2) then ... ... end
Das wäre ein Beispiel für die linke alt Taste + E
Und F4 kann man mit Umweg auch verwenden!
config.lue
Config.DefaultOpenKey = 'F4'
client.lua
Citizen.CreateThread(function() RegisterKeyMapping('openmenu', 'Open Menu', 'keyboard', Config.DefaultOpenKey) end)
Parameter für RegisterKeyMapping hier nach zu lesen
https://docs.fivem.net/natives/?_0xD7664FD1
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
what is middle key? {scroll}