function AdvDupe.SendClientError(ply, errormsg, NoSound)
if ( !IsValid(ply) or !ply:IsPlayer() or !errormsg ) then return end
MsgN("AdvDupe: Sending this ErrorMsg to ",tostring(ply),"\nAdvDupe-ERROR: \"",tostring(errormsg).."\"")
umsg.Start("AdvDupeCLError", ply)
umsg.String(errormsg)
umsg.Bool(NoSound)
umsg.End("AdvDupeCLError")
end
usermessage.Hook("AdvDupeCLError", AdvDupeCLError)
To become:
if(SERVER) then
util.AddNetworkString("AdvDupeCLError")
else
function AdvDupeCLError(len, ply)
AdvDupeClient.Error( net.ReadString(), net.ReadBool() )
end
net.Receive("AdvDupeCLError", AdvDupeCLError)
end
--- Somewhere in the server code
function AdvDupe.SendClientError(ply, errormsg, NoSound)
if ( not (IsValid(ply) and ply:IsPlayer()) ) then return end -- Validate player only to check for empty error messages
MsgN("AdvDupe: Sending this error message to ",ply:Nick(),"\nAdvDupe-ERROR: \"",tostring(errormsg ).."\"")
net.Start("AdvDupeCLError")
net.WriteString(errormsg)
net.WriteBool(NoSound)
net.Send(ply)
end
Consider user messages being deprecated:
To become:
AdvSupe1 better switch to the net library.