SetPickupVisibleForPlayers: Difference between revisions
From Onset Developer Wiki
No edit summary |
No edit summary |
||
Line 18: | Line 18: | ||
local players = {} | local players = {} | ||
for _, v in pairs(GetAllPlayers()) do | for _, v in pairs(GetAllPlayers()) do | ||
--Only players who's property tag of "team" has been set to "zombie" | |||
if GetPlayerPropertyValue(v, 'team') == "zombie" then | if GetPlayerPropertyValue(v, 'team') == "zombie" then | ||
table.insert(players, v) | table.insert(players, v) |
Revision as of 21:44, 13 November 2019
Description
Set pickup visible only for a certain array of players
Syntax
SetPickupVisibleForPlayers(Pickup, Players)
Parameters
- Pickup
ID of the pickup - Players
Player list in a form of an array
Return Value
- Returns true on success.
Example
function OnPackageStart()
local pickup = CreatePickup(2, 1000, 5330, 1503)
local players = {}
for _, v in pairs(GetAllPlayers()) do
--Only players who's property tag of "team" has been set to "zombie"
if GetPlayerPropertyValue(v, 'team') == "zombie" then
table.insert(players, v)
end
end
SetPickupVisibleForPlayers(pickup, players)
end
AddEvent('OnPackageStart', OnPackageStart)
See also
__EDIT_ME__