• Name on top of spray
    9 replies, posted
Hi there! Would it be possible if someone could make or link to me a plugin for a server, that will place someones name on their spray. This would help stop people spraying discussing pictures.. Thanks
For now do what I did and create a script to spray their decal below you. Created one today and caught 3 people in half an hour. :) But I'd also be interested in such a thing.
If anyone experienced in LUA wants to do this, I could but I have no free time to code/test this out Hook: [url]http://wiki.garrysmod.com/page/GM/PlayerSpray[/url] Get the player's eye positions with Player:GetEyeTrace(), use whatever data here to see where it hits, if its a wall and they're within a certain range then put the data into a table, make the table shared with usermessages/net library and either make the name always show there with surface.DrawText() or something along them lines. You could make a box around the spray, so when a player looks at the same location the name will appear, rather than always being shown and wasting FPS. That's all I can say for now fellahs, maybe someone might come along and help you, or you could look to pay someone to do it for you, in this thread: [url]http://wiki.garrysmod.com/page/GM/PlayerSpray[/url]
Okay so I've managed to do this by using an existing server radar script and sending data: spray location, steam id, name. Then make it print their details at their location in the client.
Doesn't the spray path have the community ID of the player at the end of it? (EG: materials/tmp/5692395) You could probably grab that and use it to find the player. This would be a little simpler and you could make it pure clientside.
its pretty easy dude. MS paint should do the job?
[QUOTE=GUNHaMMER5000;40044872]its pretty easy dude. MS paint should do the job?[/QUOTE] Did you even read the OP... Either way, welcome to FP. He is talking about a server-wide plugin that would show names for everyone, not just him.
-snip-
use the PlayerSpray hook, get the trace, use cam.Start3D2D then (along with surface library)
I was looking through some of my old scripts and found this. It's not that great of code but it *should* work. You will need to change some things around though. [b]Server[/b] [lua] hook.Add( "PlayerSpray", "TribeSpray", function(ply) if ply:Alive() then if ply:Team() == TEAM_SPEC then return false end umsg.Start( "UpdateSprays" ) umsg.Entity( ply ) umsg.Vector( ply:GetEyeTraceNoCursor().HitPos ) umsg.End() end end) [/lua] [b]Client[/b] [lua] local Sprays = {} -- learn to locals faggot. function UpdateSprays( um ) Sprays[ um:ReadEntity():EntIndex() ] = um:ReadVector() end usermessage.Hook( "UpdateSprays", UpdateSprays ) hook.Add( "HUDPaint", "TribePaintSpray", function() for entid, position in pairs( Sprays ) do if position:Distance( LocalPlayer():GetEyeTrace().HitPos ) < 48 then draw.SimpleText( "Sprayed by: " .. (Entity(entid):IsValid() and Entity(entid):Nick()) or "Unknown", "MenuLarge", 10, ScrH() / 2, Color( 255, 255, 255 ), 0, 1 ) end end end) hook.Add( "TTTEndRound", "TribeClearPaint", function(result) table.Empty(Sprays) end) [/lua]
Sorry, you need to Log In to post a reply to this thread.