CreatePickup
From Onset Developer Wiki
Description
Creates an object that spins around its axis. When a player or vehicle picks it up an event is called. OnPlayerPickupHit, OnVehiclePickupHit
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
__EDIT_ME__