No categories assigned

LUA:SetPlayerProximityFunction

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