GetPlayerWeapon/GetPlayerWeaponData
#1

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
Reply
#2

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]);
}
Reply
#3

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
Reply
#4

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)