Spraycan: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 17: | Line 17: | ||
Can be used to spray a spray of a chosen connected player. Following function takes player handle of a player from whose eye position and angles spraycan is created at and handle of the player whose spray we want to use. | Can be used to spray a spray of a chosen connected player. Following function takes player handle of a player from whose eye position and angles spraycan is created at and handle of the player whose spray we want to use. | ||
<syntaxhighlight lang=js> | <syntaxhighlight lang=js> | ||
function SprayDummy() {} | |||
function Spray(sprayer, sprayowner) { | function Spray(sprayer, sprayowner) { | ||
local spraycan = SpawnEntityFromTable("spraycan", { | local spraycan = SpawnEntityFromTable("spraycan", { | ||
origin = sprayer. | origin = sprayer.GetCenter() + Vector(0,0,32), | ||
angles = sprayer.EyeAngles().ToKVString(), | angles = sprayer.EyeAngles().ToKVString(), | ||
vscripts = "spraycan_setup", //vscripts key needs to be non-empty for the entity to work, can be even non existent file but that prints warning to console | vscripts = "spraycan_setup", //vscripts key needs to be non-empty for the entity to work, can be even non existent file but that prints warning to console | ||
nextthink = 1, //won't work without this | nextthink = 1, //won't work without this | ||
thinkfunction = " | thinkfunction = "SprayDummy" //thinkfunction key needs to be non-empty for the entity to work | ||
}); | }); | ||
NetProps.SetPropEntity( | NetProps.SetPropEntity(spraycan, "m_hOwnerEntity", sprayowner); | ||
EmitSoundOn("SprayCan.Paint", | EmitSoundOn("SprayCan.Paint", spraycan); | ||
EntFireByHandle(spraycan, "Kill", "", 2, null, null); | |||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 13:49, 2 April 2025

![]() |
---|
CSprayCan |
![]() |
spraycan
is an entity available in all Source games except
Counter-Strike: Global Offensive. This is the entity that applies player-chosen spray on walls when they use their spray bind (impulse 201).
ConVars
Cvar/Command | Parameters or default value | Descriptor | Effect |
---|---|---|---|
decalfrequency | 10 | seconds | How much must a player wait in seconds before they are able to spray another time |
r_spray_lifetime | 10 | Number of rounds player sprays are visible | |
cl_logofile | Spraypoint logo decal. | ||
cl_playerspraydisable | 0 | Disable visibility of player sprays. |
Example vscript use
Can be used to spray a spray of a chosen connected player. Following function takes player handle of a player from whose eye position and angles spraycan is created at and handle of the player whose spray we want to use.
function SprayDummy() {}
function Spray(sprayer, sprayowner) {
local spraycan = SpawnEntityFromTable("spraycan", {
origin = sprayer.GetCenter() + Vector(0,0,32),
angles = sprayer.EyeAngles().ToKVString(),
vscripts = "spraycan_setup", //vscripts key needs to be non-empty for the entity to work, can be even non existent file but that prints warning to console
nextthink = 1, //won't work without this
thinkfunction = "SprayDummy" //thinkfunction key needs to be non-empty for the entity to work
});
NetProps.SetPropEntity(spraycan, "m_hOwnerEntity", sprayowner);
EmitSoundOn("SprayCan.Paint", spraycan);
EntFireByHandle(spraycan, "Kill", "", 2, null, null);
}