CreatePickup: Difference between revisions
From Onset Developer Wiki
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
{{Info|Function|Server|1.0}} | {{Info|Function|Server|1.0}} | ||
{{FuncDescription|Creates an object that spins around its axis. When a player | {{FuncDescription|Creates an object that spins around its axis. When a player ''picks'' it up an event [[OnPlayerPickupHit]] is called.}} | ||
{{FuncSyntax|CreatePickup(modelid, x, y, z)}} | {{FuncSyntax|CreatePickup(modelid, x, y, z)}} |
Latest revision as of 14:41, 27 February 2020
Description
Creates an object that spins around its axis. When a player picks it up an event OnPlayerPickupHit is called.
Syntax
CreatePickup(modelid, x, y, z)
Parameters
- modelid
See Objects. - x
Coordinate X where to create this pickup. - y
Coordinate Y where to create this pickup. - z
Coordinate Z where to create this pickup.
Return Value
- Returns the identifier to this newly created pickup.
Example
local WeaponPickups = { }
local function OnPackageStart()
for i=1,19 do
WeaponPickups[i] = CreatePickup(i + 3, 129898.9453125, 81860.2421875 - (i * 200.0), 1566.9010009766)
end
end
AddEvent("OnPackageStart", OnPackageStart)
local function OnPlayerPickupHit(player, pickup)
--AddPlayerChat(player, "You have hit pickup id "..pickup)
for i, p in pairs(WeaponPickups) do
if p == pickup then
SetPlayerWeapon(player, i + 1, 450, true, 1)
return
end
end
end
AddEvent("OnPlayerPickupHit", OnPlayerPickupHit)
See also
- GetPickupCount
- GetStreamedPickups
- GetPickupLocation
- SetPickupPropertyValue
- GetPickupPropertyValue
- SetPickupVisibleForPlayers
- GetAllPickups
- CreatePickup
- DestroyPickup
- IsValidPickup
- SetPickupScale
- GetPickupScale
- SetPickupDimension
- GetPickupDimension
- SetPickupVisibility
- SetPickupOutline
- IsPickupStreamedIn