No categories assigned

LUA:SetPlayerProximityFunction

Revision as of 18:48, 9 May 2013 by Thefoof (talk | contribs) (Usage)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This sets a range around a spawn to detect when a player is within the set range, and when they leave the range, calling functions each time. The out of range parameter is optional.

Syntax

SetPlayerProximityFunction(target, range, "In range function", ["out of range function"])

Usage

function spawn(NPC)
	SetPlayerProximityFunction(NPC, 10, "InRange", "LeaveRange")
end

When a player enters within 10 meters of a spawn with this function in their script, a function named InRange will be called, and when they leave LeaveRange will be called.


Back to LUA General Functions Index