You are viewing an old version of this page. Return to the latest version.
Version of 18:48, 9 May 2013 by I need to Update My Profile
Difference between revisions of "LUA:SetPlayerProximityFunction"
(Created page with "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 option...") |
(→Usage) |
||
| Line 10: | Line 10: | ||
end | end | ||
</pre> | </pre> | ||
| − | When a player enters within 10 meters of a spawn with this function in their script, a function | + | 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. |
[[LUA:MiscFunctions|Back to LUA General Functions Index]] | [[LUA:MiscFunctions|Back to LUA General Functions Index]] | ||
Latest revision as of 18:48, 9 May 2013
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.