[RELEASE] esx_simcards

AddEventHandler(‘matriarch_simcards:useSimCard’, function(args)

local _source = source

local rawNumber = args[1] <--- line 8

local xPlayer = ESX.GetPlayerFromId(_source)

local numFirstThree = string.sub(rawNumber, 1, 3)

local numLastFour = string.sub(rawNumber, 4, 7)

local numFinal = numFirstThree .. '-' .. numLastFour

local result = MySQL.Sync.fetchAll("SELECT * FROM users WHERE phone_number = @phone_number", {['@phone_number'] = numFinal})

if result[1] ~= nil then

    TriggerClientEvent('esx:showNotification', _source, '~r~That number is already in use')

else       

    TriggerClientEvent('matriarch_simcards:startNumChange', _source, numFinal)

end     

end)

My bad, on my last update I forgot to update something. Repo updated, thanks for bringing it up @MicLovin1

Amazing… Thank you so much!

1 Like

a suggestion i think would be nice

when u buy a simcard from shop it will be blank and when u use the simcard it will generate a random number and set it permanently on that simcard, so when a player “insert” in phone will be set as the player phone_number.

use case:
lets say that police do a body search and find used simcards (they contain numbers) and later read thru secret gang messages or find some other incriminating info like calls/messages linking suspects to a crime.

its late and im brainstorming a little, might be to much out of scope

4 Likes

Will you update it to the newest ESX?

anyway so i can do so it just make a random phone number so you not need to make one you self?

1 Like

That’s a really cool idea, I’ll see what I can implement

2 Likes

Not for at least, perhaps in the future

i think gcphone already updated to the newest esx tho :smiley:
would be a shame to leave this script behind

this script works with latest ESX, i use it myself

thou i did 1 or 2 edits… xD

2 Likes

I think it’s a great idea. Much better than the alternative of having multiple phones. Just insert a sims card to read messages.

1 Like

After dragging simcard to use, im unable to press anything. The inventory is freeze.

whenever i start my server an error comes error loading script server.lua in resource esx_simcard @esx simcard server.lua:34

1 Like

Its not working with inventoryhud mod

Same here are you using inventoryhud?

Just add “sim_card” to Config.CloseUiItems in inventoryhud like this Config.CloseUiItems = {“sim_card” ,“meth”}

where i should add this lines in inventoryhud

Hello guys!I have a prolem with the script.The problem is when I going to a shop and i buy a SIM card and i go in my inventory there is no option to use it. I inserted everything into the database.

esx_inventoryhud - config.lua, add item in list Config.CloseUiItems = {“sim_card”, “meth”}

start the script correctly, it should let you use it.