[ESX/QBCore] MSK Simcard - Change your phonenumber

Tebex [2.10€]: https://mskscripts.tebex.io/
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
  • Chezza Phone v2, D-Phone, GcPhone, GksPhone, HighPhone

Config

Config = {}
----------------------------------------------------------------
Config.Locale = 'de' -- 'de', 'en', 'es', 'dk'
Config.VersionChecker = true
Config.Debug = true
----------------------------------------------------------------
-- You can choose between 'ESX' and 'QBCore'
Config.Framework = 'ESX' -- 'ESX' or 'QBCore'
-- Chezza Phone v2 // GcPhone // D-Phone // GKSphone // HighPhone
Config.Phone = 'chezza' -- 'chezza', 'gcphone', 'dphone', 'gksphone' or 'highphone'
Config.CustomNotify = false -- Phone Notify will be triggerd (see function notification below)
Config.dialogBox = false -- If true then you need an_dialogBox
----------------------------------------------------------------
Config.needPhone = true -- Player has to have a phone in inventory
Config.phoneItem = 'phone' -- This should be your phone item
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 = "094" -- the starting digits for phone number // Number would be 094XXXXXX
----------------------------------------------------------------
-- 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
----------------------------------------------------------------
Config.Database = {
    usersDB = 'users', -- ESX default: 'users' // Users Table
    usersIdentifierTB = 'identifier', -- ESX default: 'identifier' // identifier for users table
    ----------------------------------------------------------------
    numberDB = 'phones', -- default: 'users' // Chezza Phone: 'phones' // GKSphone: 'gksphone_settings'
    numberTB = 'phone_number', -- default: 'phone_number' // Table for phonenumber
    identifierTB = 'identifier' -- ESX default: 'identifier' // 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
        TriggerEvent('gcPhone:allUpdate')
    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)
    end
    
    notification(src, 'server', Player, newNumber, Translation[Config.Locale]['updateNumber'] .. newNumber .. Translation[Config.Locale]['updateNumber2'])
end

function notification(src, type, Player, newNumber, message) -- Player = ESX.GetPlayerFromId(src) / QBCore.Functions.GetPlayer(src)
    if Config.Framework:match('ESX') then
        if type == 'client' then
            ESX.ShowNotification(message)
        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
                Player.showNotification(message)
            end
        end
    elseif Config.Framework:match('QBCore') then
        if type == 'client' then
            QBCore.Functions.Notify(message, 'primary', 5000)
        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)
            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.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
Update v1.7
  • Fixed number not updating for GKSphone
Update v1.6
  • Added new Item to insert a number you desire

You need NativeUI for this Update! ([Release][Dev] NativeUILua)

Update v1.5
  • Added Support for HighPhone
  • Changed Notification function
Update v1.4
  • Added Support for GKS Phone
  • Changed updateNumber function
Update v1.3.1
  • [QBCore] Fixed Callback for generate new Number
Update v1.3
  • Added Support for QBCore
  • Some Minor Bugfixes
Update v1.2
  • Fixed Error with ServerCallback and Notification 'SIM card was not recognized. Try again!'
  • Fixed Config.needPhone = false
Update v1.1
  • Added support for GcPhone and D-Phone
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