SA-MP Forums Archive
Need Help To Get Player Weapon ID - 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: Need Help To Get Player Weapon ID (/showthread.php?tid=633783)



Need Help To Get Player Weapon ID - akib - 07.05.2017

Hi
how to get player weapon id?

like:
Код:
GetPlayerWeaponID(playerid);
or get all weapon id like:
Код:
if(GetPlayerWeapon(playerid) == i)



Re: Need Help To Get Player Weapon ID - Dayrion - 07.05.2017

GetPlayerWeapon return the weaponid which the player is currently holding.
But no, you can't do this for get all player's weapon. You have to use GetPlayerWeaponData (took from the wiki):
PHP код:
// 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 
0<= 12i++)
{
    
GetPlayerWeaponData(playeridiweapons[i][0], weapons[i][1]);




Re: Need Help To Get Player Weapon ID - akib - 07.05.2017

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
GetPlayerWeapon return the weaponid which the player is currently holding.
But no, you can't do this for get all player's weapon. You have to use GetPlayerWeaponData (took from the wiki):
PHP код:
// 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 
0<= 12i++)
{
    
GetPlayerWeaponData(playeridiweapons[i][0], weapons[i][1]);

bro i wanna get all weapons

if killer kill player then send msg to player that he killed by weapon %s


Re: Need Help To Get Player Weapon ID - StrikerZ - 07.05.2017

PHP код:
public OnPlayerDeath(playeridkilleridreason)
{
     if(
killerid != INVALID_PLAYER_IDSendDeathMessage(killeridplayeridreason);
     return 
1;




Re: Need Help To Get Player Weapon ID - Jelly23 - 07.05.2017

Quote:
Originally Posted by Sunehildeep
Посмотреть сообщение
PHP код:
public OnPlayerDeath(playeridkilleridreason)
{
     if(
killerid != INVALID_PLAYER_IDSendDeathMessage(killeridplayeridreason);
     return 
1;

According to wiki, it's no problem if the killerid is invalid when sending a death message.