Hello, I tought I did everything right, but it just happens nothing...
https://files.facepunch.com/forum/upload/305674/392de454-3d52-4dd3-82ee-6c2971866c33/Screenshot_12.png
https://files.facepunch.com/forum/upload/305674/afb25d74-4676-45e6-9617-91572bfc9ca1/Screenshot_13.png
https://files.facepunch.com/forum/upload/305674/73e60470-1ac3-40fa-bb74-25ad10d38602/Screenshot_14.png
hook.Add( "KeyPress", "keypress_use_hi", function( ply, key )
if ( key == IN_USE ) then
print( "hi" )
end
end )
Please help me
use PrintMessage(HUD_PRINTCENTER,"hi")
It just prints it again in my console. I want it to write it on my screen in gmod for a short time, but I think the code, then will be longer
Also, please use descriptive thread titles, and if you're posting code it is helpful to use the code display. This can be done by highlighting the code and clicking the { } button at the bottom of the editing box.
You litrealy copied and pasted the example out of the wiki :/ GM/KeyPress. Anyway here is the code i would use:
if CLIENT then end
if !SERVER then end
hook.Add("KeyPress", "keypress_use_hi", function(ply, key)
if (key == IN_USE) then
ply:PrintMessage(HUD_PRINTCENTER,"hi")
end
end)
How do I automaticly let the player running it?
You are asking the Facepunch Community questions that you can find out by just reading a bit of the wiki or watch Lua videos on youtube which some of them are very well explained.
Here
Sorry, you need to Log In to post a reply to this thread.