SetPickupVisibleForPlayers: Difference between revisions

From Onset Developer Wiki
(Created page with "{{Info|Function|Server|1.0}} {{FuncDescription|Set pickup visible only for a certain array of players}} {{FuncSyntax|StartPackage(PackageName)}} {{FuncParameters}} {{FuncPa...")
 
No edit summary
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Info|Function|Server|1.0}}
{{Info|Function|Server|1.0}}
'''This function is now obsolete.'''


{{FuncDescription|Set pickup visible only for a certain array of players}}
{{FuncDescription|Set pickup visible only for a certain array of players}}


{{FuncSyntax|StartPackage(PackageName)}}
{{FuncSyntax|SetPickupVisibleForPlayers(Pickup, Players)}}


{{FuncParameters}}
{{FuncParameters}}
Line 18: Line 20:
   local players = {}
   local players = {}
   for _, v in pairs(GetAllPlayers()) do
   for _, v in pairs(GetAllPlayers()) do
       if GetPlayerPropertyValue(v, 'team') == "zombie" then
      --Only players who's property tag of "team" has been set to "zombie"
       if GetPlayerPropertyValue(v, "team") == "zombie" then
         table.insert(players, v)
         table.insert(players, v)
       end
       end
Line 28: Line 31:
AddEvent('OnPackageStart', OnPackageStart)
AddEvent('OnPackageStart', OnPackageStart)
</syntaxhighlight>
</syntaxhighlight>


{{RelatedFunctions}}
{{RelatedFunctions}}
__EDIT_ME__
*[[SetPickupVisibleForPlayers]]
*[[GetPickupCount]]
*[[GetAllPickups]]
*[[CreatePickup]]
*[[DestroyPickup]]
*[[IsValidPickup]]
*[[SetPickupScale]]
*[[GetPickupScale]]

Latest revision as of 16:12, 17 November 2019

SetPickupVisibleForPlayers

Type: Function
Context: Server
Introduced: v1.0

This function is now obsolete.

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