Textbox sending to both players

Hey all,
Got a little problem where my Usermessage is being sent to both players, which I only want it to send to the person infront of them, Here is the code:

[lua]
function Finethem(ply, args)
local pos = ply:GetShootPos()
local ang = ply:GetAimVector()
local tracedata = {}
tracedata.start = pos
tracedata.endpos = pos+(ang*80)
tracedata.filter = ply
local trace = util.TraceLine(tracedata)
if trace.Entity:IsPlayer() then

price = tonumber(args)
name = tostring(trace.Entity:Nick())
local receiver = FindReceiver(name)
nams = tostring(receiver:Nick())

if !price then return "" end

receiver:SetPData("fineamount", price)

receiver:SetPData("finer", nams)

receiver:ConCommand("Testfine")

Notify(ply, 1, 4, string.format("Fine sent to " .. name .. "!", s))
else
Notify(ply, 1, 4, string.format("You are not looking at a player who cant be fined!", s))
return ""
end
return ""

end
AddChatCommand("/fine", Finethem)

function Testfine(ply)

umsg.Start( "Fines" );
umsg.String( ply:GetPData("finer") );
umsg.Float( ply:GetPData("fineamount") );
umsg.End();

end
concommand.Add( “Testfine”, Testfine )

[/lua]

Yes the code is sloppy but its just till I get rid of this bug. Thanks for reading, Any help much appreciated.

umsg.Start() can take 2 arguments; the umsg name and a recipientfilter / player. Do this:

[lua]
function Testfine(ply)
umsg.Start( “Fines”, ply );
umsg.String( ply:GetPData(“finer”) );
umsg.Float( ply:GetPData(“fineamount”) );
umsg.End();
end
[/lua]

Works Perfectly Thanks!

You’re also using string.format, though what you do isn’t affected by that function at all.

You might want to read this page: http://wiki.garrysmod.com/?title=String.format
Or: http://wiki.garrysmod.com/?title=Format

Oh thanks for the tip :slight_smile:

-snip-