MSK Scripts
Search…
Getting Started
Documentation for msk_simcard
msk_simcard

Description

  • This Script changes your current phonenumber to a new one
  • With the simcard item you get a random number
  • With the simcard_wish item you can set the number you want to have yourself

Supported Phones

The listed phones are already integrated and should work perfectly
  • Chezza Phone
  • D-Phone
  • GcPhone
  • GksPhone
  • HighPhone
  • RoadPhone
  • Quasar Phone
  • QB Phone
If you are using Chezza Phone, have a look at the Phone Guides at https://chezza.dev/ and search for Updating Phonenumber!

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

Requirements

  • ESX 1.2 (v1-final) // Legacy // QBCore
  • mysql-async // oxmysql
  • NativeUI
Copy link
On this page
Description
Supported Phones
Config
Requirements