[ESX / QBCore] MSK Simcard - Change your phonenumber

Tebex [5.59€ incl. VAT] - Source Code
Documentation

Description

  • With the simcard item you get a random number
  • With the simcard_wish item you can set the number you want to have yourself
  • Discord Logs

Compatible Phones

Config

Config = {}
----------------------------------------------------------------
Config.Locale = 'de' -- 'de', 'en', 'es', 'dk', 'fr', 'pl'
Config.VersionChecker = true
Config.Debug = true
----------------------------------------------------------------
-- Add the Webhook Link in server_discordlog.lua
Config.DiscordLog = true
Config.botColor = "6205745"
Config.botName = "MSK Simcard"
Config.botAvatar = "https://i.imgur.com/PizJGsh.png"
----------------------------------------------------------------
Config.Framework = 'ESX' -- 'ESX' or 'QBCore'

Config.Phone = 'chezza' -- 'chezza', 'gcphone', 'dphone', 'gksphone', 'highphone', 'roadphone', 'qsphone', 'qbphone', 'npwd'

-- If false you need NativeUI installed
Config.dialogBox = true -- If true then you need an_dialogBox (https://github.com/notaymanTV/an_dialogBox)
----------------------------------------------------------------
Config.needPhone = true -- Player has to have a phone in inventory
Config.phoneItem = {'phone'} -- {'phone', 'phone2'} // This should be your phone item // You can set multiple items
Config.usableItem = 'simcard' -- Item to generate a random Number // Add this to your items table in database
Config.removeItem = true -- Set to false if you dont want the item to be deleted after use
Config.StartingDigit = {
    enable = true, -- Set false to disable StartingDigit
    value = "094" -- the starting digits for phone number
}
----------------------------------------------------------------
-- If 'number' then the number would be 094XXXXXX if StartingDigit enabled or XXXXXX if StartingDigit disabled
-- If 'gc' then the number would be 094-XXXX if StartingDigit enabled or XXX-XXXX if StartingDigit disabled
-- If 'canada' then the number would be 094-XXX-XXXX if StartingDigit enabled or XXX-XXX-XXXX if StartingDigit disabled
Config.numberFormat = 'number' -- 'number', 'gc' or 'canada'
----------------------------------------------------------------
-- You need NativeUI installed !!!
-- Config.numberLength is only for Config.wishItem
Config.wishItem = 'simcard_wish' -- Item to insert a Number by yourself // Add this to your items table in database
Config.numberLength = 9 -- max numbers // default: 9 - Number would be 094XXXXXX // numberLength doesn't work for 'gc' and 'canada' option!
----------------------------------------------------------------
-- Read the Readme.md for more information
Config.Database = {
    usersDB = 'users', -- Users Table // ESX default: 'users' // QBCore default: 'players'
    usersIdentifierTB = 'identifier', -- identifier for users table // ESX default: 'identifier' // QBCore default: citizenid

    numberDB = 'phones', -- In which table is the phonenumber located // ESX default: 'users' // QBCore default: 'players'
    numberTB = 'phone_number', -- Column for phonenumber // ESX default: 'phone_number'  // QBCore default: 'charinfo'
    identifierTB = 'identifier' -- identifier for numberDB table // ESX default: 'identifier'  // QBCore default: 'citizenid'
}
----------------------------------------------------------------
-- Change the Event in this function to the Event that changes the Number in your Phone.
-- You can add your own Events here

-- !!! This function is serverside !!!
Config.updateNumber = function(src, newNumber, xPlayer)
    if Config.Phone:match('chezza') then -- Chezza Phone V2
        TriggerEvent('phone:changeNumber', src, newNumber)
    elseif Config.Phone:match('gcphone') then -- GcPhone
        TriggerClientEvent("gcPhone:myPhoneNumber", src, newNumber)
    elseif Config.Phone:match('dphone') then -- D-Phone
        TriggerClientEvent("d-phone:client:changenumber", src, newNumber)
    elseif Config.Phone:match('gksphone') then -- GKSphone
        TriggerEvent('gksphone:gkssc:playerLoad', src)
    elseif Config.Phone:match('highphone') then -- HighPhone
        TriggerClientEvent("high_phone:updateData", src)
    elseif Config.Phone:match('roadphone') then -- RoadPhone
        TriggerEvent("roadphone:playerLoad", src)
    elseif Config.Phone:match('qsphone') then -- Quasar Phone
        -- Only working with version lower than v2.2.5 !!!
        TriggerClientEvent('qs-smartphone:RefreshContacts', src)
    elseif Config.Phone:match('qbphone') then -- QBCore Phone
        -- Add your own Events here
    elseif Config.Phone:match('npwd') then -- NPWD Phone
        exports.npwd:setPhoneNumber(src, newNumber)
    end
    
    Config.Notification(src, 'server', xPlayer, newNumber, Translation[Config.Locale]['updateNumber'] .. newNumber .. Translation[Config.Locale]['updateNumber2'])
end
----------------------------------------------------------------
-- !!! This function is clientside AND serverside !!!
-- Look for type == 'client' and type == 'server'
-- How to change Notification: https://musiker15.gitbook.io/msk-scripts/simcard/installation/notifications
-- xPlayer = ESX.GetPlayerFromId(src) / QBCore.Functions.GetPlayer(src)

Config.Notification = function(src, action, xPlayer, newNumber, message)
    if Config.Framework:match('ESX') then
        if action == 'client' then
            ESX.ShowNotification(message) -- replace this with your Notify
        elseif action == 'server' then
            xPlayer.showNotification(message) -- replace this with your Notify
            -- This is for Chezza Phone: TriggerClientEvent('phone:notify', src, { app = 'settings', title = Translation[Config.Locale]['phoneHeading'], content = Translation[Config.Locale]['phoneText'] })
        end
    elseif Config.Framework:match('QBCore') then
        if action == 'client' then
            QBCore.Functions.Notify(message, 'primary', 5000) -- replace this with your Notify
        elseif action == 'server' then
            TriggerClientEvent('QBCore:Notify', src, message, 'primary', 5000) -- replace this with your Notify
            -- This is for Chezza Phone: TriggerClientEvent('phone:notify', src, { app = 'settings', title = Translation[Config.Locale]['phoneHeading'], content = Translation[Config.Locale]['phoneText'] })
        end
    end
end

Installation

Please read the Readme.md and the Documentation: Installation - MSK Scripts

Optional Requrements

Code accessible Yes
Subscription based No
Lines (approximately) ~ 200
Requirements ESX or QBCore, oxmysql
Support Yes

Latest Update

My other Scripts

Paid

Free

8 Likes

so nice

2 Likes

if use phone from gksphone is work ?

You have to change the Event in updateNumber function that changes the Phonenumber.
It is all discribed in config.lua

Update v1.1

  • Added support for GcPhone and D-Phone
3 Likes

thank you sir!

1 Like

no working sir …


any one know how to work for gksphone

If you get this notification, the number that was generated by the script already exist on database.
Do what it says and try again.

so what i can do now sir

Link not working

Now working again

1 Like

Update v1.2

  • Fixed Error with ServerCallback and Notification 'SIM card was not recognized. Try again!'
  • Fixed Config.needPhone = false
1 Like

Update v1.3

  • Added Support for QBCore
  • Some Minor Bugfixes
2 Likes

Update v1.3.1

  • [QBCore] Fixed Callback for generate new Number
1 Like

The notification issue is already fixed with latest version. For GKSphone I need the Event that is changing the phonenumber like the other Events in config.lua. I cant find that in the documentation of gksphone.

i pm you , give script gks

Update v1.4

  • Added Support for GKS Phone
  • Changed updateNumber function
1 Like

Update v1.5

  • Added Support for HighPhone
  • Changed Notification function
1 Like

Hi nice worrk!
Can you add for qb-phone? Thanks again.

I can take a look but I can’t promise anything

1 Like