SA-MP Forums Archive
Giving guns - 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: Giving guns (/showthread.php?tid=519735)



Giving guns - xdarren - 15.06.2014

Hello, I kinda have problem with this. I want to make command /givegun ID that gives a gun to the player from player. So Lets say I'm holding Colt and script checks my hand and it gives the guy I put the ID in that colt and removes from my hand.


Re: Giving guns - HeLiOn_PrImE - 15.06.2014

for this type of script you need to use GetPlayerWeaponData
It will return everything that you are holding. Study it a little, and see what you can come up with.

https://sampwiki.blast.hk/wiki/GetPlayerWeaponData


Re: Giving guns - DavidBilla - 15.06.2014

pawn Код:
CMD:givegun(playerid,params[])
{
   new id;
   If(sscanf(params,"u",id)) return SendClientMessage(playerid,-1,"USAGE: /givegun [id]");
   GivePlayerWeapon(id,GetPlayerWeapon(playerid),GetPlayerAmmo(playerid));
    SetPlayerAmmo(playerid,GetPlayerWeapon(playerid),0);
return 1;
}