Need help with /give weapon
#1

Hey there guy (and girls), I am trying to make a cmd that players can give the gun that they are currently holding to nearby players, Only Problem is, What function should I use to remove/reset the gun that the player is currently holding, for after he "gave" it to the other player?

If anyone could tell me, I will appreciate it
Reply
#2

There is no function that removes only one weapon. But there is a function that removes all player's weapons. So you can put all player's weapons into an array using GetPlayerWeaponData, then remove all weapons using ResetPlayerWeapons and then give all weapons back (excluding a weapon that player should give to another player).
Reply
#3

Quote:
Originally Posted by Norck
Посмотреть сообщение
There is no function that removes only one weapon. But there is a function that removes all player's weapons. So you can put all player's weapons into an array using GetPlayerWeaponData, then remove all weapons using ResetPlayerWeapons and then give all weapons back (excluding a weapon that player should give to another player).
Hmm, that is making it more complicated then it should be, but if it is the only solution thanks for helping

I really think there should be a function like ClearPlayerWearingWeapon or something,.. would be usefull
Reply
#4

I'm fairly certain there'll be a function out there somewhere, possibly in the 'Useful Functions' topic or in an include. If not, I could attempt to make it.
Reply
#5

1-Get player weapon data storing it in variables
2-use ResetPlayerWeapons
3-give back all weapons except the one you want to remove

P.S: Weapon Data is tricky and annoys, but this is possible ^^

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

EDIT:

Use GetPlayerWeapon to see the weapon the player is holding and give it to the other player, then the method above.
Reply
#6

http://pastebin.com/phU8Ffrc

There you go. Tested - seems to work fine. Tell me if there's any problems.
Reply
#7

Yaaaay, dreams come true.

lol

seems nothings wrong with that ^^ hope it works




This forum requires that you wait 120 seconds between posts. Please try again in 19 seconds.

TIME, Y U NO GO FASTER
Reply
#8

thanks, Could you explain me what stocks do? I am not very experienced with them.
Reply
#9

stocks are basically normal functions, but they dont display a warning when compile if u dont use it, and people usually use those in includes because of that.
Reply
#10

-removed-
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)