UserMessage Not Working

Autorun/Server/Money.lua
[lua]function SaidCheck(player, text, public)

-- Fix Valve's errors.
text = string.Replace(text, " ' ", "'")
text = string.Replace(text, " : ", ":")

if (string.sub(text, 1, 6) == “!money”) then
if player:IsAdmin() then
umsg.Start( “OpenMoneyMenu”, player )
umsg.End()
else
cider.player.notify(player, “You do not have the right permissions to run this command!”, 1)
end
end
end

hook.Add( “PlayerSay”, “ISaid”, SaidCheck );

function MoneyFunc( player, cmd, arg )
if player:IsAdmin() then
if arg[1] and arg[2] and arg[3] then
	if arg[3] == 1 then
	AddMoney(arg[1],arg[2])
	elseif arg[3] == 2 then
	TakeMoney(arg[1],arg[2])
	elseif arg[3] == 3 then
	SetMoney(arg[1],arg[2])
	end
	end
	end
	end

concommand.Add("moneycontrol",MoneyFunc)


function AddMoney(player, Amount)
cider.player.giveMoney(player, Amount);
cider.player.notify(player, "You have been given $"..Amount.." by an admin!", 1)
end

function TakeMoney(player, Amount)
cider.player.giveMoney(player, -Amount);
cider.player.notify(player, "An admin has taken $"..Amount.." from you!", 1)
end

local NextPrintTime = 0
function SecondPrint()
if (CurTime() >= NextPrintTime) then
for _, player in pairs(player.GetAll()) do
cider.player.notify(player, “This Server Is Owned By [FoR] Toby and developed by RTM xBEASTx.”, 1)
end
NextPrintTime = CurTime() + 180
end
end
hook.Add(“Think”, “SecondPrint”, SecondPrint)[/lua]

Autorun/Client/Money.lua
[lua]function OpenMoneyMenu()

local DermaPanel = vgui.Create( "DFrame" )
DermaPanel:SetSize( 400, 60 )
DermaPanel:Center() 
DermaPanel:SetTitle( "Money Control" ) 
DermaPanel:SetVisible( true )
DermaPanel:SetBackgroundBlur( true )
DermaPanel:SetDraggable( true )
DermaPanel:ShowCloseButton( true )
DermaPanel:MakePopup()
 
local Wang = vgui.Create( "DNumberWang", DermaPanel )
Wang:SetPos( 10, 30 )
Wang:SetSize(100,20)
Wang:SetMin( 1 )
Wang:SetMax( 10000 )
Wang:SetDecimals(0)

local List= vgui.Create( "DMultiChoice", DermaPanel)
List:SetPos(120,30)
List:SetSize( 100, 20 )
List.OnSelect = function(panel,index,value)
NameS = value
print("[DEV] Option " .. value .. " has been picked at the index " .. index )

end

for k,v in pairs(player.GetAll()) do
	List:AddChoice(v:Nick())
	PlayerAtt = v
end

local List1= vgui.Create( "DMultiChoice", DermaPanel)
List1:SetPos(230,30)
List1:SetSize( 100, 20 )
List1:AddChoice("Add")
List1:AddChoice("Take")
List1:AddChoice("Set")
List1.OnSelect = function(panel,index,value)
Type = value
print("[DEV] Option " .. value .. " has been picked at the index " .. index )

end

local button = vgui.Create( "DButton", DermaPanel )
button:SetSize( 50, 20 )
button:SetPos( 340, 30 )
button:SetText( "Complete" )
button.DoClick = function( ply )
Amount = Wang:GetValue()
Name1 = FindPlayer(NameS)
if Type == "Add" then
OutType = 1
elseif Type == "Take" then
OutType = 2
elseif Type == "Set" then
OutType = 3
end
ply:ConCommand("moneycontrol", Name1, Amount, OutType)
end
end

function FindPlayer(info)
    local pls = player.GetAll()

    for k, v in pairs(pls) do
        if string.find(string.lower(v:Name()), string.lower(tostring(info)), 1, true) ~= nil then
            return v
        end
    end
    return nil
end

usermessage.Hook( “OpenMoneyMenu”, OpenMoneyMenu )[/lua]

I keep getting an error saying


Unhandled usermessage.

Line? Time that it happens?

You have a lua error clientside that is stopping it usermessage hook from running post the error

Ok, I will post the message in 30 mins.

[editline]26th March 2011[/editline]

I’ll change it to a concommand instead of a chat command then I’ll post the error.

  • Snip -
    Misread

probably you have no argument clientside for the usermessage…

Why would you need arguments if your not receiving any data

Really? Just really?

I am not sending anything so why would I need arguments.
You should read more before trying to find a fault.

This is the error:


] cider_money
Warning: Unhandled usermessage 'OpenMoneyMenu'


Clientside
[lua]function OpenMoneyMenu()

local DermaPanel = vgui.Create( "DFrame" )
DermaPanel:SetSize( 400, 60 )
DermaPanel:Center() 
DermaPanel:SetTitle( "Money Control" ) 
DermaPanel:SetVisible( true )
DermaPanel:SetBackgroundBlur( true )
DermaPanel:SetDraggable( true )
DermaPanel:ShowCloseButton( true )
DermaPanel:MakePopup()
 
local Wang = vgui.Create( "DNumberWang", DermaPanel )
Wang:SetPos( 10, 30 )
Wang:SetSize(100,20)
Wang:SetMin( 1 )
Wang:SetMax( 10000 )
Wang:SetDecimals(0)

local List= vgui.Create( "DMultiChoice", DermaPanel)
List:SetPos(120,30)
List:SetSize( 100, 20 )
List.OnSelect = function(panel,index,value)
NameS = value
print("[DEV] Option " .. value .. " has been picked at the index " .. index )

end

for k,v in pairs(player.GetAll()) do
	List:AddChoice(v:Nick())
	PlayerAtt = v
end

local List1= vgui.Create( "DMultiChoice", DermaPanel)
List1:SetPos(230,30)
List1:SetSize( 100, 20 )
List1:AddChoice("Add")
List1:AddChoice("Take")
List1:AddChoice("Set")
List1.OnSelect = function(panel,index,value)
Type = value
print("[DEV] Option " .. value .. " has been picked at the index " .. index )

end

local button = vgui.Create( "DButton", DermaPanel )
button:SetSize( 50, 20 )
button:SetPos( 340, 30 )
button:SetText( "Complete" )
button.DoClick = function( ply )
Amount = Wang:GetValue()
Name1 = FindPlayer(NameS)
if Type == "Add" then
OutType = 1
elseif Type == "Take" then
OutType = 2
elseif Type == "Set" then
OutType = 3
end
ply:ConCommand("moneycontrol", Name1, Amount, OutType)
end
end

function FindPlayer(info)
    local pls = player.GetAll()

    for k, v in pairs(pls) do
        if string.find(string.lower(v:Name()), string.lower(tostring(info)), 1, true) ~= nil then
            return v
        end
    end
    return nil
end

usermessage.Hook( “OpenMoneyMenu”, OpenMoneyMenu )[/lua]

ServerSide
[lua]function RunTheMenu( player, cmd, arg )
if player:IsAdmin() then
umsg.Start( “OpenMoneyMenu”, player )
umsg.End()
else
–cider.player.notify(player, “You do not have the right permissions to run this command!”, 1)
Msg(“No permissions”)
end
end

concommand.Add("cider_money", RunTheMenu)


function MoneyFunc( player, cmd, arg )
if player:IsAdmin() then
if arg[1] and arg[2] and arg[3] then
	if arg[3] == 1 then
	AddMoney(arg[1],arg[2])
	elseif arg[3] == 2 then
	TakeMoney(arg[1],arg[2])
	elseif arg[3] == 3 then
	SetMoney(arg[1],arg[2])
	end
	end
	end
	end


concommand.Add("moneycontrol",MoneyFunc)


function AddMoney(player, Amount)
--cider.player.giveMoney(player, Amount);
--cider.player.notify(player, "You have been given $"..Amount.." by an admin!", 1)
end

function TakeMoney(player, Amount)
--cider.player.giveMoney(player, -Amount);
--cider.player.notify(player, "An admin has taken $"..Amount.." from you!", 1)
end

local NextPrintTime = 0
function SecondPrint()
if (CurTime() >= NextPrintTime) then
for _, player in pairs(player.GetAll()) do
–cider.player.notify(player, “This Server Is Owned By [FoR] Toby and developed by RTM xBEASTx.”, 1)
end
NextPrintTime = CurTime() + 180
end
end
hook.Add(“Think”, “SecondPrint”, SecondPrint)

[/lua]

[editline]26th March 2011[/editline]

I commented out all the cider functions just to test in sandbox, but still no luck.

–Opps read the code wrong–

No you didn’t fix anything.

You just ended my function early and that does not help in the slightest