There are no errors but nothing happens when !stats is typed into chat. How do I get PlayerSay to run clientside so it will work? this is the script:
stat={}
stat.npckilled=0
stat.durgzuse=0
stat.bosskill=0
stat.pvpkill=0
stat.crateopen=0
function npcaddstat(victim,killer,weapon)
if victim:GetClass()=="npc_slenderman" or "npc_spiderqueen" then
stat.bosskill=stat.bosskill+1
print(stat.bosskill)
else
stat.npckilled=stat.npckilled+1
print(stat.npckilled)
end
end
function durgzaddstat(ply, entity)
if entity:GetClass()== "" or "" then
stat.durgzuse=stat.durgzuse+1
end
end
function pvpaddstat(victim, inflictor, killer)
if killer:IsPlayer() then
stat.pvpkill=stat.pvpkill+1
end
end
function crateaddstat(ply, entity)
if entity:GetClass()== "" then
stat.crateopen=stat.crateopen+1
end
end
function statmenucommand(ply, text, public)
if (CLIENT) and (string.sub(text, 1,6)=="!stats") then
local DermaPanel=vgui.Create( "DFrame" )
DermaPanel:SetPos( 50, 50 )
DermaPanel:SetSize( 300, 325 )
DermaPanel:SetTitle( "Fishing Statistics" )
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( true )
DermaPanel:ShowCloseButton( true )
DermaPanel:MakePopup()
local TestingPanel = vgui.Create( "DPanel", DermaPanel )
TestingPanel:SetPos( 25, 50 )
TestingPanel:SetSize( 250, 250 )
TestingPanel.Paint = function()
surface.SetDrawColor( 50, 50, 50, 255 )
surface.DrawRect( 0, 0, TestingPanel:GetWide(), TestingPanel:GetTall()
end
end
end
hook.Add("OnNPCKilled","npcstat",npcaddstat)
hook.Add("PlayerUse","durgzstat",durgzaddstat)
hook.Add("PlayerDeath","pvpstat",pvpaddstat)
hook.Add("PlayerSay", "stats chat command", statmenucommand)
I don't know why you're saying there isn't errors when there are.
You're trying to make a clientside menu serverside.
there are no console errors
Like brandonj4 said you're trying to make a client side menu run server side, I would make the menu activate with a console command and then make the chat command run that console command, or there's some other methods of doing it also.
Sorry, you need to Log In to post a reply to this thread.