Weapons
#1

Hello people, sorry for my bad English but I'm using the ****** translator.

I wanted to know if you can create a command that removes the ammunition of a specific weapon, I explain:

I type the command / ammo deagle
and the bullets disappear from the Desert Eagle, shotgun, sniper, molotov, if you do not have that weapon, tell him an error message explaining that he does not have the gun or the bullets.
I hope you understand me, thank you.
Reply
#2

Agh, I actually don't understand, sry, can u explain it better?
Reply
#3

https://sampwiki.blast.hk/wiki/SetPlayerAmmo
Reply
#4

how do I do that if I want to use / ammo 24 (24 = desert eagle id) is the other player and if you do not have that weapon do not let the function run?
Reply
#5

You need to use GetPlayerWeaponData to get weapon data about the weapon you want to remove, and to find out if that weapon is owned by the player.

Put it in a loop from 0 to (including) 11 (12 slots). It will give you the weapon ID and the ammo for that slot.
If the weaponid is the one you typed AND ammo isn't zero, remove that weapon by using SetPlayerAmmo and return.

If the loop finishes to execute, it was not found and you can send a failure message to the player.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)