command opens a menu for everyone rather than one player
1 replies, posted
so basically, as the title says, anytime a player uses the command !craft, it opens the crafting menu for everyone rather than only that player only. Anyone know what might be causing this? help is appreciated.
[code]--[[/////---------- Panel Setup ----------\\\\\]]--
function CraftingMenu(ply)
local Window = vgui.Create("DFrame")
Window:SetSkin("Pistachio");
Window:SetSize(ScrW() * 0.65, ScrH() * 0.75);
Window:SetTitle("Crafting - Pistachio");
Window:SetSizable(false);
Window:SetDraggable(false);
Window:ShowCloseButton(true);
Window:Center();
Window:MakePopup();
Window.propertySheet = vgui.Create("DPropertySheet", Window);
Window.propertySheet:Dock(FILL);
Window.propertySheet:AddSheet("Craft", vgui.Create("ps_Craft", Window.propertySheet));
end
--[[/////---------- Call Panel ----------\\\\\]]--
function OpenMenu(ply, text)
if string.lower(text) == "!craft" then
CraftingMenu(ply)
end
end
hook.Add("OnPlayerChat", "OpenCraftMenu", OpenMenu)
[/code]
OnPlayerChat is called whenever [B]any[/B] player chats. Compare the player object passed by the hook to LocalPlayer() to make sure only that player's menu is opened.
Sorry, you need to Log In to post a reply to this thread.