SetPlayerArmedWeapon
From SA-MP Wiki
(Difference between revisions)
Revision as of 00:00, 19 May 2012 Smithy (Talk | contribs) (Link to weapons list) ← Previous diff |
Revision as of 03:03, 4 February 2014 Connor Mead (Talk | contribs) Next diff → |
||
Line 38: | Line 38: | ||
[[Category:Scripting Functions]] | [[Category:Scripting Functions]] | ||
+ | |||
+ | [[fr:SetPlayerArmedWeapon]] |
Revision as of 03:03, 4 February 2014
Description:
Sets the armed weapon of the player.
(playerid, weaponid)
playerid | The ID of the player to arm with a weapon. |
weaponid | The ID of the weapon that the player should be armed with. |
Return Values:
This function does not return any specific values.
public OnPlayerUpdate(playerid) { SetPlayerArmedWeapon(playerid,0); // disables weapons return 1; }
// SMG driveby by [03]Garsino (for SA:MP 0.3c) public OnPlayerStateChange(playerid, newstate, oldstate) { if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER) { new Weap[2]; GetPlayerWeaponData(playerid, 4, Weap[0], Weap[1]); // Get the players SMG weapon in slot 4 SetPlayerArmedWeapon(playerid, Weap[0]); // Set the player to driveby with SMG } return 1; }
Related Functions
The following functions may be useful, as they are related to this function in one way or another.
- GivePlayerWeapon: Give a player a weapon.
- GetPlayerWeapon: Check what weapon a player is currently holding.