Created
April 10, 2020 01:23
-
-
Save BadgerCode/4c5c2874b58c6fa052db83c69ded9b38 to your computer and use it in GitHub Desktop.
Adds shortcuts for the player model selector
This file contains hidden or 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
-- Allows players to press F3 or type !skin or !playermodel in chat to enter the player model selector | |
-- Where to put this file: garrysmod\addons\customscripts\lua\autorun\playermodel_help_command.lua | |
if SERVER then | |
AddCSLuaFile() | |
hook.Remove("PlayerSay", "PlayerModelHelpCommand") | |
hook.Add("PlayerSay", "PlayerModelHelpCommand", function(ply, text) | |
text = string.Trim(string.lower(text)) | |
if(text != "!skin" and text != "!playermodel") then return end | |
ply:ConCommand("playermodel_selector") | |
end) | |
else | |
local shortcutKeyDown = false | |
hook.Remove("Think", "PlayerModelHelpShortcut") | |
hook.Add("Think", "PlayerModelHelpShortcut", function() | |
if shortcutKeyDown == false and input.IsKeyDown(KEY_F3) then | |
shortcutKeyDown = true | |
RunConsoleCommand("playermodel_selector") | |
elseif shortcutKeyDown and !input.IsKeyDown(KEY_F3) then | |
shortcutKeyDown = false | |
end | |
end) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment