• A "Who Sprayed This Spraypaint" Mod
    25 replies, posted
Hello, I was wondering if someone can create an addon where people can know who sprayed a spray paint by looking at it? I remember this was implemented in CS:S but I'm not sure if it's in GMod. If there is one already, pardon me. Thanks.
It's also implemented in TF2 sometimes. If I knew how sprays worked then maybe I would be able to. (Are they ent_spray or something similar?)
I don't think they are a ENTs :(
Then how are they detected? As I asked, are they something easily detected by lua?
How about make a hook to see if a players spray key is pressed?
Wouldn't that only detect when it was sprayed and not after it was sprayed?
[QUOTE=gamei56]I don't think they are a ENTs :([/QUOTE] Everything in source is an entity
Technically everything except the level itself and water. But enough of that, somebody needs to find out how to do this!
Aren't sprays decals or something? Info_decal?
Hmmm... :raise: We need somebody who knows this stuff.
Bump because I would also like this.
Look in NewAdmin.
[QUOTE=tepholman;12121182]Aren't sprays decals or something? Info_decal?[/QUOTE] It's infodecal.
Well, as of now I don't know if there is a way to get the actual entity object of the spray, but there is the GM:PlayerSpray hook. You could make it so that it prints the name and steamid of a player when he sprays something. The example is untested but it gives the idea of how you would do it. [lua] function GM:PlayerSpray(ply) MsgAll(ply:Name() .. " (" .. ply:SteamID() .. ") sprayed a spray at " .. os.time() .. ".\n") return true end [/lua] [url]http://wiki.garrysmod.com/?title=Gamemode.PlayerSpray[/url]
NewAdmin has a plugin for it. You should check it out.
[QUOTE=Jamie932;17359218]NewAdmin has a plugin for it. You should check it out.[/QUOTE] Are they sponsoring you or something? Do they pay you for advertising?
[QUOTE=TacoNinja;17361716]Are they sponsoring you or something? Do they pay you for advertising?[/QUOTE] Or maybe he's telling us that NewAdmin has this feature so we can take a look at how they did it.
[QUOTE=CowThing;17361825]Or maybe he's telling us that NewAdmin has this feature so we can take a look at how they did it.[/QUOTE] HAH. :v:
[QUOTE=CowThing;17361825]Or maybe he's telling us that NewAdmin has this feature so we can take a look at how they did it.[/QUOTE] He brings up newadmin every chance he gets....
Because NewAdmin has a lot of cool, unique features. AS WELL AS AN EASY MENU SYSTEM AND CHAT COMMANDS! YEAH!....
Well since he told us to do it, I looked and here is exactly how the plugin in NewAdmin handled sprays. [lua] function ResetSpray( ply ) ply:SetNWVector( "SprayPos", Vector( 0, 0, 0 ) ) end hook.Add( "PlayerInitialSpawn", "ResetSpray", ResetSpray ) function OnSpray( ply ) local pos = ply:GetEyeTrace().HitPos ply:SetNWVector( "SprayPos", pos ) end hook.Add( "PlayerSpray", "HandleSpray", OnSpray ) function ShowSprayOwner() local Trace = LocalPlayer():GetEyeTrace() local LookAt = Trace.HitPos for _, pl in pairs(player.GetAll()) do local SPos = pl:GetNWVector( "SprayPos" ) 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 hook.Add( "HUDPaint", "ShowSprayOwner", ShowSprayOwner ) [/lua]
[QUOTE=Skapocalypse;17364983]Because NewAdmin has a lot of cool, unique features. AS WELL AS AN EASY MENU SYSTEM AND CHAT COMMANDS! YEAH!....[/QUOTE] Well, it screwed up my kill icons (it wouldn't say who killed who), and it made me mad, so I dislike it.
[QUOTE=TacoNinja;17372578]Well, it screwed up my kill icons (it wouldn't say who killed who), and it made me mad, so I dislike it.[/QUOTE] [sp]That means we dislike you too.[/sp] It had what the OP was asking for, which was why I mentioned it.
[QUOTE=Jamie932;17373155][sp]That means we dislike you too.[/sp] It had what the OP was asking for, which was why I mensioned it.[/QUOTE] Kind of, he asked for a script, not a system of scripts.
[QUOTE=TacoNinja;17377550]Kind of, he asked for a script, not a system of scripts.[/QUOTE] Please remember, I only said take a [b]look[/b] at NewAdmins plugin. I didnt say put it onto his server.
[lua]function SprayInfoPaint() for _, ent in pairs( ents.FindByClass( "info_spray" ) ) do local owner = ent:GetOwner() if (owner and owner:IsPlayer()) and ent:GetPos():Distance(LocalPlayer():EyePos()) < 120 then local pos = ent:GetPos():ToScreen() text = owner:Name() draw.SimpleText( text, font, pos.x+1, pos.y+1, Color(0,0,0,120),1 ) draw.SimpleText( text, font, pos.x+2, pos.y+2, Color(0,0,0,50),1 ) draw.SimpleText( text, font, pos.x+0, pos.y+0, self:GetTeamColor( owner ),1 ) text = ent:GetNWString("SteamID", "SteamID: N/A") draw.SimpleText( text, font, pos.x+1, pos.y+18, Color(0,0,0,120),1 ) draw.SimpleText( text, font, pos.x+2, pos.y+19, Color(0,0,0,50),1 ) draw.SimpleText( text, font, pos.x+0, pos.y+17, self:GetTeamColor( owner ),1 ) end end end[/lua]
Sorry, you need to Log In to post a reply to this thread.