SA-MP Forums Archive
Help in /sling - 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: Help in /sling (/showthread.php?tid=461767)



Help in /sling - CROSS_Hunter - 03.09.2013

Well, its a command thats used in RP Servers mainly and its based on removing the player's weapon and saves it for him until he /unsling's again and the slung weapon appears for him.. like /sling M4 and /unsling M4 so.. i need an idea about it. note that the player can only sling one weapon at a time


Re: Help in /sling - Konstantinos - 03.09.2013

Use GetPlayerWeaponData and get the player's weapon data. Store them to an array and get the weaponid from its name (****** it, you'll find results). Reset the weapons of the player and give them back with a for loop (like the example GetPlayerWeaponData shows at the Wiki), but check if the 3rd parameter which is the weaponid is different (inside the loop) to the id of the weapon you typed (in that case, M4).

Pretty much the same to give it back, but without exceptions. Just loop without any if statement to check the weaponid.