SetPlayerWeapon

From Onset Developer Wiki
Revision as of 16:26, 13 August 2019 by BlueMountains (talk | contribs) (Created page with "{{Info|Function|Server|1.0}} {{FuncDescription|Gives the player a weapon.}} {{FuncSyntax|SetPlayerWeapon(player, weapon_model, ammo, equip, weapon_slot)}} {{FuncParameters}...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
SetPlayerWeapon

Type: Function
Context: Server
Introduced: v1.0

Description

Gives the player a weapon.

Syntax

SetPlayerWeapon(player, weapon_model, ammo, equip, weapon_slot)

Parameters

  • player
    The player identifier.
  • weapon_model
    The weapon model Weapons.
  • ammo
    How many bullets the player gets.
  • equip
    true for the player to equip the weapon. false to just assign this new weapon to a weapon slot.
  • weapon_slot
    The slot to assign 1-3.

Return Value

  • Returns true on success, false on error.

Example

function cmd_w(player, weapon, slot, ammo)
	if (weapon == nil or slot == nil or ammo == nil) then
		return AddPlayerChat(player, "Usage: /w <weapon> <slot> <ammo>")
	end

	SetPlayerWeapon(player, weapon, ammo, true, slot)
end
AddCommand("w", cmd_w)
AddCommand("weapon", cmd_w)

See also

__EDIT_ME__