[Release][ES] Weapon Store [v1.1]

Removing myself from police didn’t help, as i mentioned it’s when i load model-menu or clothing-shop then i don’t get them. Putting es_weashop as the 1st script or last didn’t help.

Hello, I am new to the forum, I just made this account because I was able to make a version of your weapon store based on Async MySQL and compatible with model-menu so I can use it with CouchDB, would it be okay to make a post about it giving you the credits for it ofc?

1 Like

To fix that go on the sv_weashop.lua and replace:

RegisterServerEvent("weaponshop:playerSpawned")
AddEventHandler("weaponshop:playerSpawned", function(spawn)
	TriggerEvent('es:getPlayerFromId', source, function(user)
		TriggerEvent('weaponshop:GiveWeaponsToPlayer', source)
	end)
end)

for this:

RegisterServerEvent("weaponshop:playerSpawned")
AddEventHandler("weaponshop:playerSpawned", function(spawn)
    SetTimeout(2500, function()
		TriggerEvent('es:getPlayerFromId', source, function(user)
			TriggerEvent('weaponshop:GiveWeaponsToPlayer', source)
		end)
	end)
end)

Also replace this on your model-menu/server.lua:

RegisterServerEvent("mm:savemodel")
AddEventHandler("mm:savemodel",function(model)
	TriggerEvent('es:getPlayerFromId', source, function(target)
		MySQL.Sync.execute("UPDATE modelmenu SET mpmodel = 0 WHERE identifier=@user",{['@user']= target.identifier})
		MySQL.Sync.execute("UPDATE modelmenu SET model=@model WHERE identifier=@user",{['@model']= model,['@user']= target.identifier})
		TriggerClientEvent("mm:changemodel", source, model)
	end)
end)

for:

RegisterServerEvent("mm:savemodel")
AddEventHandler("mm:savemodel",function(model)
	TriggerEvent('es:getPlayerFromId', source, function(target)
		MySQL.Sync.execute("UPDATE modelmenu SET mpmodel = 0 WHERE identifier=@user",{['@user']= target.identifier})
		MySQL.Sync.execute("UPDATE modelmenu SET model=@model WHERE identifier=@user",{['@model']= model,['@user']= target.identifier})
		TriggerClientEvent("mm:changemodel", source, model)
		TriggerEvent("weaponshop:GiveWeaponsToPlayer", source)
	end)
end)

to get your weapons back after changing model on the stores.
Good Luck.

Glad you ask that question… You can use the script as you like. adding credits or not, I don’t really care as long as it helps you. I don’t seek fame or will take actions to remove modified content based on this.
You are all free to do what you want :slight_smile:

1 Like

Does this mean you have a model_menu working for couchDB?

and im just trying what you recommended above, will let you know if it works.

so replacing

RegisterServerEvent("weaponshop:playerSpawned")
AddEventHandler("weaponshop:playerSpawned", function(spawn)
	TriggerEvent('es:getPlayerFromId', source, function(user)
		TriggerEvent('weaponshop:GiveWeaponsToPlayer', source)
	end)
end)

with

RegisterServerEvent("weaponshop:playerSpawned")
AddEventHandler("weaponshop:playerSpawned", function(spawn)
    SetTimeout(2500, function()
		TriggerEvent('es:getPlayerFromId', source, function(user)
			TriggerEvent('weaponshop:GiveWeaponsToPlayer', source)
		end)
	end)
end)

Worked but i get this error

https://gyazo.com/cef2ceb96ca678cc2ed0a46e3359c5f8

Edit - again if i disable model-menu or clothes_shop and spawn as Michael i get my weapons and no error?.

Edit by Havoc: Added code tags to make code readable :wink:

Hello all,

From now on, I stop all development with FiveM. This means that I will not give any support on this release. I will keep the github online so that you can copy all the files.
You all have full access regarding the code. I will not hunt you down like some do and remove all versions.
Feel free to use it. You don’t have to credit me if you don’t want.

Keep doing amazing stuff.

Regards,
Hoegarden31

Do you have a working version of ES Weapon Store for Async or Couch db?! If so I would greatly love you. Been trying to convert it, can’t seem to get it going.

there is a couchDB version posted above [Release][ES] Weapon Store [v1.1]

And to fix my issue above with not getting weapons when my player spawns i used the original

RegisterServerEvent("weaponshop:playerSpawned")
AddEventHandler("weaponshop:playerSpawned", function(spawn)
	TriggerEvent('es:getPlayerFromId', source, function(user)
		TriggerEvent('weaponshop:GiveWeaponsToPlayer', source)
	end)
end)

but changed the delay on line 58 to 4000 and now works fine.

Appreciate it man, figures it would be @rjross2013 , he is seriously a badass!

Thanks for the love man, but dont forget to give your love to the original creator as well!

Update for CouchDB? @hoegarden31

He’s mentioned above that he isn’t working on it anymore. Mr rjross has converted it for couchDB already though.

But, what script do i copy and paste it for? server lua or client lua ?

Download weapon store then paste what rjross posted into sv_weashop

Ok i have used the updated couchDB version and the shop and menus are working and money gets deducted when buy a weapon, however the player is not receiving the weapon?:S any ideas appreciated

Welcome back :slight_smile:

Did you delete your essentialmode document when adding weapon shop and starting server? When a new couchDb document is being created you need to delete essentialmode document and let it generate a new one.

All working thanks for the reply

Only issue I see now, is there’s nothing at the gunstores that give me a option to buy a weapon? There’s no indication. Just the gun store blimps