[Async][FX]fgunshop v1.0

Another weapon shop for fivem with licenses…

Made this a while ago and thought i’d release it cause i have nothing better to do…:wink:
###Requirements

  • pNotify (Notifications)
  • Essentialmode (for money only, easily changed)
  • mysql-async

####Features:

  • Buy guns
  • Sell guns
  • Gun licenses
  • Legal and illegal gunshops

####Some info to the people who annoy me:

  • I won’t make it compatible with vRP
  • I won’t make it couchDB
  • I won’t make it using es.2x MySQL
  • If you have modified it and it isn’t working correctly don’t even bother contacting me.

####Some event handlers… (server)

AddEventHandler("ws:giveweapons", function(source)

use this to give weapons to people…
e.g. in client

AddEventHandler('playerSpawned', function(spawn)
    TriggerServerEvent("ws:giveweapons")
end)

AddEventHandler("ws:deleteweapons", function()

Use this to remove all the users weapons from the database
####client

AddEventHandler("ws:removeWeapons", function()

Just removes all of the users weapons


####(optional) modification Cops FiveM(check inventory)

	MySQL.Async.fetchAll("SELECT * FROM gunshop WHERE identifier = '"..identifier.."'", { ['@username'] = identifier }, function (result)
		local strResult = "Weapons of " .. GetPlayerName(target) .. " : "
				
		for _, v in ipairs(result) do
			strResult = strResult .. v.weapon_name .. " - lvl "..v.licenselvl..", "
		end
		local probs = "Weapons of " .. GetPlayerName(target) .. " : "
		if strResult == probs then
			strResult = GetPlayerName(target).." has no weapons"
		end
		TriggerClientEvent("pNotify:SendNotification", source, {
            text = strResult,
            type = "error",
            queue = "left",
            timeout = 20000,
            layout = "centerRight"
        })
	end)

Github
Download

####Screenshots





4 Likes

thanks great job…

Hey are u releasing a player garage script for fx @Frazzle

I haven’t had to make one yet so probably not?

How come you use Sync functions instead of Async to update data in MySQL?

#1146 - Tabela ‘gta5_gamemode_essential.users’ nu exista

Error importing database
How can i fix it ?

yeah in the script change use;essentialmode or your db name

1 Like

yeah but in my DB can’t find any “.users” tabel

my guns are not getting saved

1 Like

me too Game_loker

“my guns are not getting saved”

Hello,
Nice gunshop! I have a question why some weapons don’t stay on inventory and diseapear after 2 secondes?
Thanks for help!

this is your framework n3tv if you not cop weapon disapear :wink:

Ahhh you have the anwser so!!
Could you please tell me where I have to add citizen?
thanks in advance!!

FR: Franchement Sir_Smog1 tu es plus q’une aide! vraiment merci

@Frazzle for me no weapon is give after relogin in server …
the weapon its correctly save in BDD …
its possible to add a timer for give weapon after de skin … ?

This is the police_client script on N3Mtv causing this problem . The guns is trying to buy are not lootable on corpse like Police, Bodyguard , Military . There is a list somewhere in this script where you can find wich gun youre not able to have if you are citizen .

Fr : C’est dans le script de police_client sur la base N3MTV qui cause ce problème . Les armes qu’il tente d’acheter ne sont pas pillable sur les corps comme les police, garde du corps ou militaire. Il y a une liste à quelque part dans le script où il peut trouver quel arme que tu ne peut pas avoir en tant que citoyen .

I have the same problem too on N3MTV . Weapon are saved corectly in database too . I don’t know what is causing this.

For me when I post the “SQL”, it gives an error saying that it does not have ‘sql.users’
How to solve?

IMG:
Imgur

How I can add something like clip. When don’t have ammo I buy 120 000$ gun again for just ammo? (XD)

Can someone help me because i got a “Error”. The Scripts starting normally and when i go to the license sell point the license are written but i can’t press Enter to buy it and i have enought Money.

Closed due to it being a very old topic.

Will remain open for reference