GetPlayerWeaponData
From SA-MP Wiki
(Difference between revisions)
Revision as of 03:06, 4 February 2014 Connor Mead (Talk | contribs) ← Previous diff |
Revision as of 03:07, 4 February 2014 Connor Mead (Talk | contribs) Next diff → |
||
Line 1: | Line 1: | ||
{{Scripting}} | {{Scripting}} | ||
- | {{Description|Récupère l'ID de l'arme et le nombre de munitions dans le slot spécifique d'arme d'un joueur.}} | + | {{Description|Get the weapon and ammo in a specific player's weapon slot.}} |
- | {{ParametersFR|playerid, slot, &weapons, &ammo}} | + | {{Parameters|playerid, slot, &weapons, &ammo}} |
- | {{Param|playerid|L'ID du joueur dont on veut récupérer les données.}} | + | {{Param|playerid|The ID of the player whose weapon data to retrieve.}} |
- | {{Param|slot|Le [[Weapons FR|slot d'arme]] dont on veut récupérer les données (0-12).}} | + | {{Param|slot|The [[Weapons|weapon slot]] to get data for (0-12).}} |
- | {{Param|&weapons|La variable où stocker l'ID de l'arme.}} | + | {{Param|&weapons|The variable in which to store the weapon ID, passed by reference.}} |
- | {{Param|&ammo|La variable où stocker le nombre de munitions.}} | + | {{Param|&ammo|The variable in which to store the ammo, passed by reference.}} |
- | {{NoReturnFR}} | + | {{NoReturn}} |
<pawn> | <pawn> | ||
- | // Utilisation courante: on récupère toute les données d'armes dans un tableau de 13 cases | + | // Common use: get all weapons and store info in an array containing 13 slots |
+ | // The first value is the weapon ID, and second is the ammo | ||
- | new weapons[13][2]; // La première valeur est l'ID de l'arme, la seconde est le nombre de munition | + | new weapons[13][2]; |
for (new i = 0; i < 13; i++) | for (new i = 0; i < 13; i++) | ||
Line 22: | Line 23: | ||
</pawn> | </pawn> | ||
- | {{RelatedFunctionsFR}} | + | {{RelatedFunctions}} |
- | {{GetPlayerWeapon_FR}} | + | {{GetPlayerWeapon}} |
- | {{GivePlayerWeapon_FR}} | + | {{GivePlayerWeapon}} |
- | [[Category:Scripting Functions FR]] | + | [[Category:Scripting Functions]] |
- | [[en:GetPlayerWeaponData]] | + | [[fr:GetPlayerWeaponData]] |
[[de:GetPlayerWeaponData]] | [[de:GetPlayerWeaponData]] | ||
[[ru:GetPlayerWeaponData]] | [[ru:GetPlayerWeaponData]] |
Revision as of 03:07, 4 February 2014
Description:
Get the weapon and ammo in a specific player's weapon slot.
(playerid, slot, &weapons, &ammo)
playerid | The ID of the player whose weapon data to retrieve. |
slot | The weapon slot to get data for (0-12). |
&weapons | The variable in which to store the weapon ID, passed by reference. |
&ammo | The variable in which to store the ammo, passed by reference. |
Return Values:
This function does not return any specific values.
// Common use: get all weapons and store info in an array containing 13 slots // The first value is the weapon ID, and second is the ammo new weapons[13][2]; for (new i = 0; i < 13; i++) { GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]); }
Related Functions
The following functions may be useful, as they are related to this function in one way or another.
- GetPlayerWeapon: Check what weapon a player is currently holding.
- GivePlayerWeapon: Give a player a weapon.