Skip to content

Instantly share code, notes, and snippets.

@EncodeTheCode
Created May 6, 2023 15:33
Show Gist options
  • Save EncodeTheCode/e275bddb81bcae0e44a7954ff08dbed6 to your computer and use it in GitHub Desktop.
Save EncodeTheCode/e275bddb81bcae0e44a7954ff08dbed6 to your computer and use it in GitHub Desktop.
addbind("W")
addbind("A")
addbind("S")
addbind("D")
function onPlayerKeyPress(id,key,state)
if(key=="W" and state==1) then
msg("W is pressed!")
elseif(key=="A" and state==1) then
msg("A is pressed!")
elseif(key=="S" and state==1) then
msg("S is pressed!")
elseif(key=="D" and state==1) then
msg("D is pressed!")
end
if(key=="W" and state==0) then
msg("W has been pressed.")
elseif(key=="A" and state==0) then
msg("A has been pressed!")
elseif(key=="S" and state==0) then
msg("S has been pressed!")
elseif(key=="D" and state==0) then
msg("D has been pressed!")
end
end
addhook("key", "onPlayerKeyPress")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment