Team Spartan Cookies & Milk Forums
  • Issue Tracker
  • Donations
  • Search
  • Member List
  • Help

Register

Team Spartan Cookies & Milk Forums Garry's Mod Starfall v
« Previous 1 … 7 8 9 10 11 … 18 Next »
input._KEY_* problem
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Linear Mode
input._KEY_* problem
26-06-2017, 01:14 PM,
#9
Kosmos Offline
GMod Admin
Posts: 180
Threads: 3
Joined: Dec 2013
RE: input._KEY_* problem
If you want to be extra fancy you could record all pressed buttons using the "playerbuttondown" hook (which should run on the server too). For the client you can obviously use "input.isButtonDown".
Without ever having used custom player functions (except for testing this code), here's how I imagine it would look (you're encouraged to modify this so it only tracks the buttons you need):
Code:
local Player = starfall.getTypeDef("Player") function Player:buttonDown(btn) local buttons = self[Player.buttonDown] if not buttons then return false end return buttons[btn] or false end hook.add("PlayerButtonDown", tostring(Player.buttonDown), function(plr, btn) local buttons = plr[Player.buttonDown] if not buttons then buttons = {} plr[Player.buttonDown] = buttons end buttons[btn] = true end) hook.add("PlayerButtonUp", tostring(Player.buttonDown), function(plr, btn) local buttons = plr[Player.buttonDown] if buttons then buttons[btn] = nil end end) hook.add("think", "", function() if ents.owner():buttonDown(input.KEY_B) then error("LEL") end end)
Find
Reply
« Next Oldest | Next Newest »


Messages In This Thread
input._KEY_* problem - by The17thDoctor - 24-06-2017, 11:24 PM
RE: input._KEY_* problem - by TheOneAndOnlyTee - 24-06-2017, 11:37 PM
RE: input._KEY_* problem - by Person8880 - 25-06-2017, 10:07 AM
RE: input._KEY_* problem - by The17thDoctor - 25-06-2017, 11:36 AM
RE: input._KEY_* problem - by 4N0NYM - 25-06-2017, 03:56 PM
RE: input._KEY_* problem - by Person8880 - 25-06-2017, 04:39 PM
RE: input._KEY_* problem - by 4N0NYM - 25-06-2017, 05:53 PM
RE: input._KEY_* problem - by Person8880 - 25-06-2017, 07:42 PM
RE: input._KEY_* problem - by Kosmos - 26-06-2017, 01:14 PM

  • View a Printable Version
Forum Jump:


Users browsing this thread: 2 Guest(s)
Contact UsTeam Spartan Cookies & MilkReturn to TopLite (Archive) ModeMark all forums readRSS Syndication

Powered By MyBB, © 2002-2026 MyBB Group.