[ESX/QBCore] MSK Simcard - Change your phonenumber

Tebex [2.80€]: https://www.msk-scripts.de/
Documentation: Getting Started - MSK Scripts

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

  • Chezza Phone
  • D-Phone
  • GcPhone
  • GksPhone
  • HighPhone
  • RoadPhone
  • Quasar Phone
  • QBCore Phone

Config

Config = {}
----------------------------------------------------------------
Config.Locale = 'de' -- 'de', 'en', 'es', 'dk'
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"
----------------------------------------------------------------
-- You can choose between 'ESX' and 'QBCore'
Config.Framework = 'QBCore' -- 'ESX' or 'QBCore'
-- Chezza Phone v2 // GcPhone // D-Phone // GKSphone // HighPhone // RoadPhone // Quasar Phone // QBPhone
Config.Phone = 'qbphone' -- 'chezza', 'gcphone', 'dphone', 'gksphone', 'highphone', 'roadphone', 'qsphone', 'qbphone'
Config.CustomNotify = false -- Phone Notify will be triggerd (see function notification below)
Config.dialogBox = false -- 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.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!
----------------------------------------------------------------
Config.Database = {
    usersDB = 'players', -- ESX default: 'users' // QBCore default: 'players' // Users Table
    usersIdentifierTB = 'citizenid', -- ESX default: 'identifier' // QBCore default: citizenid // identifier for users table
    ----------------------------------------------------------------
    numberDB = 'players', -- ESX default: 'users' // QBCore default: 'players' // Chezza Phone: 'phones' // GKSphone: 'gksphone_settings'
    numberTB = 'charinfo', -- ESX default: 'phone_number'  // QBCore default: 'charinfo' // Table for phonenumber
    identifierTB = 'citizenid' -- ESX default: 'identifier'  // QBCore default: 'citizenid' // identifier for numberDB table
}
----------------------------------------------------------------
-- Change the Event in this function to the Event that changes the Number in your Phone.
-- If you are using Chezza Phone, have a look at the Phone Guides at https://chezza.dev and search for 'Updating Phonenumber'

-- !!! This function is serverside !!!
function updateNumber(src, newNumber, Player)
    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
        TriggerClientEvent('qs-smartphone:RefreshContacts', src)
    elseif Config.Phone:match('qbphone') then -- QBCore Phone
        -- Add your own Events here
    end
    
    Config.Notification(src, 'server', Player, 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://msk-scripts.gitbook.io/msk-scripts/simcard/getting-started/notifications
-- xPlayer = ESX.GetPlayerFromId(src) / QBCore.Functions.GetPlayer(src)
Config.Notification = function(src, type, xPlayer, newNumber, message)
    if Config.Framework:match('ESX') then
        if type == 'client' then
            ESX.ShowNotification(message) -- replace this with your Notify
        elseif type == 'server' then
            if Config.CustomNotify then
                if Config.Phone:match('chezza') then
                    TriggerClientEvent('phone:notify', src, { app = 'settings', title = Translation[Config.Locale]['phoneHeading'], content = Translation[Config.Locale]['phoneText'] })
                end
            else
                xPlayer.showNotification(message) -- replace this with your Notify
            end
        end
    elseif Config.Framework:match('QBCore') then
        if type == 'client' then
            QBCore.Functions.Notify(message, 'primary', 5000) -- replace this with your Notify
        elseif type == 'server' then
            if Config.CustomNotify then
                if Config.Phone:match('chezza') then
                    TriggerClientEvent('phone:notify', src, { app = 'settings', title = Translation[Config.Locale]['phoneHeading'], content = Translation[Config.Locale]['phoneText'] })
                end
            else
                TriggerClientEvent('QBCore:Notify', src, message, 'primary', 5000) -- replace this with your Notify
            end
        end
    end
end

Installation

Please read the Readme.md !!

ESX: Execute database.sql
QBCore: Add item to your qb-core/shared/items.lua

['simcard'] = {['name'] = 'simcard', ['label'] = 'Simcard', ['weight'] = 1000, ['type'] = 'item', ['image'] = 'simcard.png', ['unique'] = true, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'Simcard that will change your phone number'},

Chezza Phone

If you are using Chezza Phone, have a look at the Phone Guides at https://chezza.dev and search for Updating Phonenumber!

Optional Requrements

Code accessible No
Subscription based No
Lines (approximately) ~ 190
Requirements ESX 1.2 or Legacy, QBCore, mysql-async or oxmysql, NativeUI
Support Yes

My other Scripts

Changelogs

Update v2.8
  • QBcore Phone is now supported!

Please look at the documentation: Installation - MSK Scripts

Re-download msk_simcard at your keymaster

Update v2.7
  • Updated support for QBCore Framework

The Update is necessary for QBCore Framework!
qb-phone is still not supported but I’m working on that.

Re-download msk_simcard at your keymaster

Update v2.6
  • Added Discord Logs
  • From now on the Quasar Phone is supported

Re-download msk_simcard at your keymaster

Update v2.4
  • Fixed checkNumbers to prevent double numbers
  • Added RoadPhone support

Re-download msk_simcard at your keymaster

Update v2.3
  • Added new Numberformats [XXX-XXX and XXX-XXX-XXXX]

Re-download msk_simcard at your keymaster

Update v2.2
  • Added multiple items for needed phone item

Re-download msk_simcard at your keymaster

Update v2.1
  • Fixed Config.numberLength for an_dialogBox
Update v2.0
  • Added an_dialogBox

You can toggle it in config.lua - Config.dialogBox = true
You need to have this installed: [STANDALONE] NUI Dialog Box [FREE]

Update v1.9
  • Fixed Notifications
Update v1.8
  • Changed Notiication function
  • Fixed wishItem if Number already exist
  • Added max length for wishItem number
4 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
2 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

Update v1.2

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

Update v1.3

  • Added Support for QBCore
  • Some Minor Bugfixes
1 Like

Update v1.3.1

  • [QBCore] Fixed Callback for generate new Number

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

Update v1.5

  • Added Support for HighPhone
  • Changed Notification function

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

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

1 Like