SetPlayerWeaponSlot: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
No edit summary |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server client function}} | {{Server client function}} | ||
{{Deprecated}} | |||
Please use [[setPedWeaponSlot]] | |||
This function sets the player's weapon slot. This affects the current weapon. | This function sets the player's weapon slot. This affects the current weapon. | ||
Line 9: | Line 13: | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''theplayer:''' | *'''theplayer:''' the [[player]] whose weapon slot you want to set. In a clientside script, this can only be the local player. | ||
*'''weapon_slot:''' weapon slot to set | *'''weapon_slot:''' the weapon slot to set. | ||
{{Weapon_Slots}} | {{Weapon_Slots}} | ||
Latest revision as of 21:38, 20 April 2011
This function is deprecated. This means that its use is discouraged and that it might not exist in future versions, but there should be a more generic way to perform what it does. | |
Please use setPedWeaponSlot
This function sets the player's weapon slot. This affects the current weapon.
Syntax
bool setPlayerWeaponSlot ( player theplayer, int weapon_slot )
Required Arguments
- theplayer: the player whose weapon slot you want to set. In a clientside script, this can only be the local player.
- weapon_slot: the weapon slot to set.
Weapon Slots
- 0: WEAPONSLOT_TYPE_UNARMED
- 1: WEAPONSLOT_TYPE_MELEE
- 2: WEAPONSLOT_TYPE_HANDGUN
- 3: WEAPONSLOT_TYPE_SHOTGUN
- 4: WEAPONSLOT_TYPE_SMG (used for driveby's)
- 5: WEAPONSLOT_TYPE_RIFLE
- 6: WEAPONSLOT_TYPE_SNIPER
- 7: WEAPONSLOT_TYPE_HEAVY
- 8: WEAPONSLOT_TYPE_THROWN
- 9: WEAPONSLOT_TYPE_SPECIAL
- 10: WEAPONSLOT_TYPE_GIFT
- 11: WEAPONSLOT_TYPE_PARACHUTE
- 12: WEAPONSLOT_TYPE_DETONATOR
Returns
Returns true if successful in setting the player's equipped weapon slot, false otherwise.
Example
Click to collapse [-]
ServerThis example allows the player to type the command 'giveweapons', which gives the player a weapon for every slot. Instead of equipping the last given weapon, the script randomly decides which weapon to equip after all the weapons are given.
function givePlayerWeapons ( player, commandName ) --Give the player a weapon for each slot giveWeapon ( player, 1, 1 ) giveWeapon ( player, 2, 1 ) giveWeapon ( player, 22, 1 ) giveWeapon ( player, 25, 1 ) giveWeapon ( player, 28, 1 ) giveWeapon ( player, 30, 1 ) giveWeapon ( player, 33, 1 ) giveWeapon ( player, 35, 1 ) giveWeapon ( player, 16, 1 ) giveWeapon ( player, 42, 1 ) giveWeapon ( player, 10, 1 ) giveWeapon ( player, 44, 1 ) giveWeapon ( player, 40, 1 ) --Randomly select which weapon to equip, slots 1 through 12 setPlayerWeaponSlot ( player, math.random ( 1, 12) ) end addCommandHandler ( "giveweapons", givePlayerWeapons )
See Also
- getPlayerTeam
- getPlayerBlurLevel
- setPlayerBlurLevel
- getPlayerSerial
- forcePlayerMap
- getPlayerScriptDebugLevel
- getPlayerFromName
- getPlayerMoney
- getPlayerName
- getPlayerNametagColor
- getPlayerNametagText
- getPlayerPing
- getPlayerWantedLevel
- givePlayerMoney
- isPlayerMapForced
- isPlayerNametagShowing
- setPlayerHudComponentVisible
- setPlayerMoney
- setPlayerNametagColor
- setPlayerNametagShowing
- setPlayerNametagText
- takePlayerMoney
- countPlayersInTeam
- getPlayersInTeam
- isVoiceEnabled
- setControlState
- getControlState