Skip to content

OnPlayerGrimeChange

A player’s dirt or blood changed.

In their game - the road, a fight, a wash - or by the mode’s own SetPlayerDirt, SetPlayerBlood or WashPlayer. Twice a second at most per player, and only when a value moved (the road’s dirt grows slowly: every few dozen metres of riding). A player who is clean at the spawn does not call it. GetPlayerGrime, GetPlayerDirt and GetPlayerBlood read the new values. The answer is not read.

function OnPlayerGrimeChange(pid)
-- ...
end
Parameter Type
pid number the player
-- a word when a player has become filthy, once
local filthy = {}
function OnPlayerGrimeChange(pid)
local skin, clothes = GetPlayerDirt(pid)
local now = math.max(skin, clothes) >= 0.8
if now and not filthy[pid] then SendClientMessage(pid, COLOR_GOLD, "You stink. A bath would do you good.") end
filthy[pid] = now
end

GetPlayerDirt · GetPlayerBlood · GetPlayerGrime · the Dirt and blood group of the index