Is there a way to get what weapons a player has?

Just wondering if i can fetch somehow what weapons a player has in the weapon wheel.

Your best bet is to iterate through a list of all weapons then check if they own that weapon, if so, add it to a table

idk how to check if they have a weapon tho

https://runtime.fivem.net/doc/reference.html#_0x3A87E44BB9A01D54

Here you go

doesnt that get only the weapon they have out?

Ahhhhh I didn’t understand it that way.

Then, as @sadboilogan said, best option is to iterate through the list of all weapon. To check if he has X weapon, use this https://runtime.fivem.net/doc/reference.html#_0x8DECB02F88F428BC

1 Like

alright thanks :smiley:

1 Like

I have this code for checking when a player tries to rob a store. This checks if the player has a gun and sets a bool with the result:

local weaponStealeableList = {453432689, 1593441988, 584646201, 2578377531, 324215364, 736523883, 4024951519, 3220176749, 2210333304, 2937143193, 2634544996, 2144741730, 487013001} -- https://www.se7ensins.com/forums/threads/weapon-and-explosion-hashes-list.1045035/ weapon's codes
for i=1, #weaponStealeableList do
	if GetCurrentPedWeapon(GetPlayerPed(-1), weaponStealeableList[i], false) then
	   haveWeapon = true
	end
end

if haveWeapon == true then
	-- your code
end
1 Like

i got it working thanks thoxD