• How to display name of sprayer?
    5 replies, posted
I'm wondering if there's some lua code or a way to make it so when you look at someones spray it'll show you which player sprayed that spray. [i]The main reason for this is for administration so that on the server that I'm on we'll be able to give punishments to those that don't adhere to the spraying rules.[/i]
you could just disable spraying instead, but if you want to see the name of the user [lua]local PLUGIN = {} PLUGIN.Title = "Sprays" PLUGIN.Description = "Displays names of players who drew sprays. Allows immediate spraying for players who has privilege." PLUGIN.Author = "camcole1" PLUGIN.Privileges = { "Immediate spraying" } if CLIENT then function PLUGIN:Initialize() EV_Sprays = {} local function UpdateSprays( um ) EV_Sprays[ um:ReadString() ] = um:ReadVector() end usermessage.Hook( "EV_UpdateSprays", UpdateSprays ) end function PLUGIN:HUDPaint() for name, position in pairs( EV_Sprays ) do if position:Distance( LocalPlayer():GetEyeTrace().HitPos ) < 48 then draw.SimpleText( "Sprayed by: " .. name, "Trebuchet24", 10, ScrH() / 2, Color( 255, 0, 0 ), 0, 1 ) break end end end end if SERVER then function PLUGIN:PlayerSpray( ply ) umsg.Start( "EV_UpdateSprays" ) umsg.String( ply:Name() ) umsg.Vector( ply:GetEyeTraceNoCursor().HitPos ) umsg.End() end function PLUGIN:Think() for _, ply in pairs( player.GetAll() ) do if ply:EV_HasPrivilege( "Immediate spraying" ) then ply:AllowImmediateDecalPainting() end end end end evolve:RegisterPlugin( PLUGIN )[/lua]
What if he doesn't use Evolve?
[QUOTE=camcole1;32966055]you could just disable spraying instead, but if you want to see the name of the user [lua]// blag PLUGIN.Author = "camcole1" // blah[/lua][/QUOTE] [url]http://evolve.overvprojects.nl/plugins/sh_sprays.lua[/url] Did you do anything except take credit for work that wasnt yours?
[url]http://solidfiles.com/d/67c35/[/url] [url]http://solidfiles.com/d/11570/[/url] put sprayfinder.lua in autorun/server/ put cl_sprayfinder.lua in autorun/client and you can edit the two hard-coded steam IDs and stuff to change the "special" colors and messages that certain players have
[QUOTE=camcole1;32966055]you could just disable spraying instead, but if you want to see the name of the user [lua]local PLUGIN = {} PLUGIN.Title = "Sprays" PLUGIN.Description = "Displays names of players who drew sprays. Allows immediate spraying for players who has privilege." PLUGIN.Author = "camcole1" PLUGIN.Privileges = { "Immediate spraying" } if CLIENT then function PLUGIN:Initialize() EV_Sprays = {} local function UpdateSprays( um ) EV_Sprays[ um:ReadString() ] = um:ReadVector() end usermessage.Hook( "EV_UpdateSprays", UpdateSprays ) end function PLUGIN:HUDPaint() for name, position in pairs( EV_Sprays ) do if position:Distance( LocalPlayer():GetEyeTrace().HitPos ) < 48 then draw.SimpleText( "Sprayed by: " .. name, "Trebuchet24", 10, ScrH() / 2, Color( 255, 0, 0 ), 0, 1 ) break end end end end if SERVER then function PLUGIN:PlayerSpray( ply ) umsg.Start( "EV_UpdateSprays" ) umsg.String( ply:Name() ) umsg.Vector( ply:GetEyeTraceNoCursor().HitPos ) umsg.End() end function PLUGIN:Think() for _, ply in pairs( player.GetAll() ) do if ply:EV_HasPrivilege( "Immediate spraying" ) then ply:AllowImmediateDecalPainting() end end end end evolve:RegisterPlugin( PLUGIN )[/lua][/QUOTE] ....Wow...Your just one big leecher, You probably have a darkrp server and pretend you made the gamemode.. Anywho. I never could get that plugin to work, So I used [lua]PLUGIN = {} PLUGIN.Title = "Spray owner" PLUGIN.Description = "Shows who sprayed." PLUGIN.Author = "Whocares." PLUGIN.Privileges = { "Immediate spraying" } if CLIENT then function PLUGIN:HUDPaint() local Trace = LocalPlayer():GetEyeTrace() local LookAt = Trace.HitPos for _, pl in pairs(player.GetAll()) do local SPos = pl:GetNWVector( "SprayPos" ) local RPos = SPos - Vector(0, 0, 50) if SPos != Vector(0, 0, 0) and LookAt:Distance( SPos ) < 32 and Trace.HitWorld and LocalPlayer():GetPos():Distance( SPos ) < 1024 then local Text = pl:Nick() .. "'s Spray" surface.SetFont( "ScoreboardText" ) local w, h = surface.GetTextSize( Text ) w = w + 5 h = h + 5 draw.WordBox( 8, ScrW() / 2 - w / 2, ScrH() / 2 - h / 2, Text, "ScoreboardText", Color( 0, 0, 0, 128 ), team.GetColor( pl:Team() ) ) end end end end if SERVER then function PLUGIN:PlayerSpray( ply ) local pos = ply:GetEyeTrace().HitPos ply:SetNWVector( "SprayPos", pos ) return false end function PLUGIN:PlayerSpawn( ply ) ply:SetNWVector( "SprayPos", Vector( 0, 0, 0 ) ) end function PLUGIN:Think() for _, ply in pairs( player.GetAll() ) do if ply:EV_HasPrivilege( "Immediate spraying" ) then ply:AllowImmediateDecalPainting() end end end end evolve:RegisterPlugin( PLUGIN )[/lua] I really dont take credit from this since most of the code is from that plugin or NewAdmin
Sorry, you need to Log In to post a reply to this thread.