ESX Simcard
FiveM Script - Usable Simcard
Download: https://forum.cfx.re/t/release-esx-usable-simcard/4847008
Discord: https://discord.gg/5hHSBRHvJE
Description
➥ Usable Simcard Item
➥ Changes the Phonenumber
If you are using Chezza Phone, have a look at the Phone Guides at https://chezza.dev/ and search for Updating Phonenumber!
Config
Code
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.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) -- 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
Player.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
Alles anzeigen
Requirements
➥ ESX 1.2 (v1-final) // Legacy
➥ QBCore
➥ mysql-async // oxmysql