Hi,
i want creat module for force players bind key for open a cutom Inventory
I created to addons/customInv/lua/
sv_customInv.lua
hook.Add("PlayerKeyPress","BindMenu",function(pl,key)
if key == KEY_F3 then openInventory()
end)
i want wen players press F3 open my menu Inv
by default Inventory open by PlayerSay
is possible add this or something this
hook.Add("PlayerSay", "PlayerKeyPress", function( ply, text, team )
if text == "/inv" then
if key == KEY_F3 then
end
net.Start("openInventory")
thx for reply
Clientsided chat script
[code]
hook.Add('OnPlayerChat', 'Inv', function(ply, text)
if ply != LocalPlayer() then return end
if text == '/inv' then
openInventory()
end
end)
[/code]
Also, there is no [B]PlayerKeyPress[/B] hook, here is the table [url]http://wiki.garrysmod.com/page/Category:GM_Hooks[/url]
[QUOTE=iJohnny;49986374]Clientsided chat script
[code]
hook.Add('OnPlayerChat', 'Inv', function(ply, text)
if ply != LocalPlayer() then return end
if text == '/inv' then
openInventory()
end
end)
[/code]
Also, there is no [B]PlayerKeyPress[/B] hook, here is the table [url]http://wiki.garrysmod.com/page/Category:GM_Hooks[/url][/QUOTE]
by default my inv have this
hook.Add("PlayerSay", "INV_Say", function( ply, text, team )
if text == "/inv" then
end
net.Start("openInventory")
but I want creat module for open this by press key
exemple
hook.Add("PlayerKeyPress","BindMenu",function(pl,key)
if key == KEY_F3 then openInventory()
end)
[code]hook.Add('ShowSpare1', 'Inv', function(ply)
net.Start("openInventory")
-- part of code from your PlayerSay
-- ends with net.Send(ply)
end)[/code]
[QUOTE=iJohnny;49986457][code]hook.Add('ShowSpare1', 'Inv', function(ply)
net.Start("openInventory")
-- part of code from your PlayerSay
-- ends with net.Send(ply)
end)[/code][/QUOTE]
thx for reply
I creat this to addons/custominv/lua/sv_inv.lua ?
Just append file with [B]PlayerSay[/B] hook
[QUOTE=iJohnny;49986547]Just append file with [B]PlayerSay[/B] hook[/QUOTE]
I changed PlayerSAY by
hook.Add('ShowSpare1', 'inv', function(ply)
-- if text == "/inv" then
if ply.inv == nil then
ply.inv = {}
end
net.Start("openInventory")
net.WriteTable(ply.inv)
-- net.Send(ply)
return ""
end)
but don't work
[code]
hook.Add('ShowSpare1', 'inv', function(ply)
if ply.inv == nil then
ply.inv = {}
end
net.Start("openInventory")
net.WriteTable(ply.inv)
net.Send(ply)
end)
[/code]
Try this
BTW, Seems like a paid script from scriptfodder :ohno:
[QUOTE=iJohnny;49986748][code]
hook.Add('ShowSpare1', 'inv', function(ply)
if ply.inv == nil then
ply.inv = {}
end
net.Start("openInventory")
net.WriteTable(ply.inv)
net.Send(ply)
end)
[/code]
Try this
BTW, Seems like a paid script from scriptfodder :ohno:[/QUOTE]
Thx work now
Sorry, you need to Log In to post a reply to this thread.