SetPlayerSkillLevel

From SA-MP Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 08:47, 27 August 2019
OstGot (Talk | contribs)

← Previous diff
Current revision
OstGot (Talk | contribs)

Line 8: Line 8:
{{Param|playerid|The ID of the player to set the weapon skill of.}} {{Param|playerid|The ID of the player to set the weapon skill of.}}
{{Param|skill|The [[Weapon_Skills|weapon]] to set the skill of.}} {{Param|skill|The [[Weapon_Skills|weapon]] to set the skill of.}}
-{{Param|level|The skill level to set for that weapon, ranging from 0 to 999. A level out of range will max it out.}}+{{Param|level|The [[Skill Levels|skill level]] to set for that weapon, ranging from 0 to 999. A level out of range will max it out.}}
{{ReturnsSuccess||This means the player specified does not exist.}} {{ReturnsSuccess||This means the player specified does not exist.}}

Current revision



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


Description:

Set the skill level of a certain weapon type for a player.


Parameters:
(playerid, skill, level)
playeridThe ID of the player to set the weapon skill of.
skillThe weapon to set the skill of.
levelThe skill level to set for that weapon, ranging from 0 to 999. A level out of range will max it out.


Return Values:

  • 1: The function was executed successfully.
  • 0: The function failed to execute. This means the player specified does not exist.


Image:32px-Circle-style-warning.png

Important
Note

The skill parameter is NOT the weapon ID, it is the skill type. Click here for a list of skill types.


Example Usage:

public OnPlayerSpawn(playerid)
{
    SetPlayerSkillLevel(playerid, WEAPONSKILL_SAWNOFF_SHOTGUN, 1);
    // This will make the player use single-handed sawn-off shotguns.
    return 1;
}

Related Functions

The following functions may be helpful as they relate to this function in one way or another.

Personal tools
In other languages