SA-MP Forums Archive
GetPlayerWeapon/GetPlayerWeaponData - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: GetPlayerWeapon/GetPlayerWeaponData (/showthread.php?tid=631530)



GetPlayerWeapon/GetPlayerWeaponData - LeeXx - 31.03.2017

So i'm trying to make a command that give me a list of weapons that the player does currently have. I want to know exactly the difference between GetPlayerWeapon and GetPlayerWeaponData? And which one i'll be using for my command here?

And thank you guys for your time and your help in advance


Re: GetPlayerWeapon/GetPlayerWeaponData - Dayrion - 31.03.2017

GetPlayerWeapon give you the ID of the currently holding weapon by the player (https://sampwiki.blast.hk/wiki/GetPlayerWeapon) and GetPlayerWeaponData give you informations with details (https://sampwiki.blast.hk/wiki/GetPlayerWeaponData)
Code from the wiki to get a list of all player's weapon:
Код:
new weapons[13][2];
 
for (new i = 0; i <= 12; i++)
{
    GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
}



Re: GetPlayerWeapon/GetPlayerWeaponData - GoldenLion - 31.03.2017

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
GetPlayerWeapon give you the ID of the currently holding weapon by the player (https://sampwiki.blast.hk/wiki/GetPlayerWeapon) and GetPlayerWeaponData give you informations with details (https://sampwiki.blast.hk/wiki/GetPlayerWeaponData)
Code from the wiki to get a list of all player's weapon:
Код:
new weapons[13][2];
 
for (new i = 0; i <= 12; i++)
{
    GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
}
This, but if you are going to use it only for listing weapons then you don't need an array, just two variables "weapon" and "ammo".
Код:
for (new i, weapon, ammo; i <= 12; i++)
{
    GetPlayerWeaponData(playerid, i, weapon, ammo);
    //send a message here maybe
}
I don't think it's that important, but just so you know. :P


Re: GetPlayerWeapon/GetPlayerWeaponData - LeeXx - 31.03.2017

Yes your both answers was really helpfull. Thank you for clearing things to me


Re: GetPlayerWeapon/GetPlayerWeaponData - Jefff - 01.04.2017

https://sampforum.blast.hk/showthread.php?tid=571253