Listing player weapons
#1

hello i have a take gun and put gun command. I can list my weapons in car that i can take but i cant list the weapons that player has on himself. anyone has an idea or tutorail how to list these weapons ?

Example:
if i have weapon id 24(desert eagle) with 87 bullets and a weapon id 25(shotgun) with 24 bullets i want to see them on DIALOG_TYPE_LIST without holding it in my hand. both ammo and weapon name
Reply
#2

You could use GetPlayerWeaponData for it, there is even an example on the wiki page how to get all those weapons: https://sampwiki.blast.hk/wiki/GetPlayerWeaponData
Reply
#3

but it lists like

emptyline
emptyline
desert eagle
shotgun
emptyline
...
..

i need to list like only 2 weapons and when i put the weapon to car it cant search for specific weapon on my character and delete it. thats why i need a tutorial

i mean i cant say in code like delete weapon id 25 from player i need to say delete weapon slot 3 from player shotgun is id 3 i believe
Reply
#4

Well, you have to check if the line is empty or not. How? Check the length of the line with strlen. If strlen = 0, the player doesn't have the weapon.
Reply
#5

yeah i dont know how to do that thats my ptoblem i need tutorials that i can develop on. for take gun i did like carslot1 carslot2 carslot3 if theres no gun in carslots they return 0 to me and if they are 0 i told to format the string to freeslot and write that but i dont know how to skip empty lines
Reply
#6

https://sampforum.blast.hk/showthread.php?tid=571253
Reply
#7

thank you its more like what i want i can play on this
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)