• SWEP secondary fire Returning alt+e
    7 replies, posted
how can i set a swep to say that if you use the secondary, it returns that you pressed alt+e? [lua] function SWEP.Secondary() Press ALT Press E end [/lua]
There is no way to do this. Garrysmod cannot simulate keystrokes on your keyboard.
so theres no way to tell it to walk and press e at the same time in a function?
You want it to make the player walk forward and press the e key?
[QUOTE=c0baltha1l;24149620]You want it to make the player walk forward and press the e key?[/QUOTE] i want it to WALK and press the E key WALK is not the same a W WALK+ w = walk w = run get what im saying?
We do, but we also know that there is no need to simulate keystrokes for what you are trying to do. Set the players velocity manually when he pressed secondary fire. As for the 'pressing E' part, you will have to explain what you want to use this on.
Yes, as he said the easiest way would be to set the player's velocity. There is no way to simulate the player pressing the e key, so you would have to directly call the ENT:Use() function on the entity you are trying to make the player press the e key on.
what EXACTLY im trying to do is this: Im trying to merge the DerpRP Inventory with a SWEP. there is a console command for opening the menu, and i have that set to secondary fire. but the actual pickup code is under a ply.Use function. and it says "if not ply.Keydown "ACT_WALK" Then return false end, and i want the ply.use function to be able to be used in the primary fire of the SWEP.
Sorry, you need to Log In to post a reply to this thread.