No categories assigned

LUA:GetPlayersInZone

LUA - GetPlayersInZone

Return to: LUA | Tutorials | Portal | Forum | Project Manager | Bug Tracker


LUA Functions: GetPlayersInZone()

Gets a list of all players in the zone


Syntax

local var = GetPlayersInZone(param1)


Parameters

Required - param1 (Zone)
param1 is the zone we want to get players from


Returns

LUA table with all the players in the zone, or nil if there are none

Usage

function death(NPC, Spawn)
	local bridgeGate = GetSpawn(NPC, GateLower)
	if bridgeGate ~= nil and GetY(bridgeGate) ~= GateOpenedY then
		UseWidget(bridgeGate)
		local players = GetPlayersInZone(GetZone(NPC))
		for index, player in pairs(players) do
			SendPopUpMessage(player, "With the slaying of Vigo, the Deathfist Citadel gate is unlocked!", 255, 0, 0)
			SendMessage(player, "With the slaying of Vigo, the Deathfist Citadel gate is unlocked!", "red")
		end
	end
end

This is the death function for Vigo Cerebus in Zek, when he dies a pop up and normal message are sent to all players in the zone.