SetPlayerArmedWeapon

From SA-MP Wiki

(Difference between revisions)
Jump to: navigation, search
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




SetPlayerArmedWeapon was added in SA-MP 0.3a This function was added in SA-MP 0.3a and will not work in earlier versions!


Description:

Sets the armed weapon of the player.


Parameters:
(playerid, weaponid)
playeridThe ID of the player to arm with a weapon.
weaponidThe 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.

In other languages