mirror of
https://github.com/ND-Framework/ND_Core.git
synced 2026-08-18 22:36:03 +01:00
Update main.lua
Added old money hud and fixed issue with characters refreshing.
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
-- For support join my discord: https://discord.gg/Z9Mxu72zZ6 --
|
-- For support join my discord: https://discord.gg/Z9Mxu72zZ6 --
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
local background = config.backgrounds[math.random(1, #config.backgrounds)]
|
||||||
local started = true
|
local started = true
|
||||||
registered = false
|
registered = false
|
||||||
admin = false
|
admin = false
|
||||||
@@ -59,6 +59,9 @@ end)
|
|||||||
|
|
||||||
RegisterNetEvent("returnCharacters")
|
RegisterNetEvent("returnCharacters")
|
||||||
AddEventHandler("returnCharacters", function(characters)
|
AddEventHandler("returnCharacters", function(characters)
|
||||||
|
SendNUIMessage({
|
||||||
|
type = "refresh"
|
||||||
|
})
|
||||||
for i = 1, #characters do
|
for i = 1, #characters do
|
||||||
index = characters[i]
|
index = characters[i]
|
||||||
SendNUIMessage({
|
SendNUIMessage({
|
||||||
@@ -75,7 +78,7 @@ AddEventHandler("returnCharacters", function(characters)
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
characterAmount = #characters
|
characterAmount = #characters
|
||||||
SetDisplay(true, "ui")
|
SetDisplay(true, "ui", background)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Creating a character
|
-- Creating a character
|
||||||
@@ -95,24 +98,6 @@ RegisterNUICallback("newCharacter", function(data)
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterNetEvent("returnNewCharacter")
|
|
||||||
AddEventHandler("returnNewCharacter", function(id, character)
|
|
||||||
characterAmount = characterAmount +1
|
|
||||||
SendNUIMessage({
|
|
||||||
type = "character",
|
|
||||||
id = character.id,
|
|
||||||
firstName = character.firstName,
|
|
||||||
lastName = character.lastName,
|
|
||||||
dateOfBirth = character.dob,
|
|
||||||
gender = character.gender,
|
|
||||||
twtName = character.twt,
|
|
||||||
department = character.department,
|
|
||||||
startingCash = character.cash,
|
|
||||||
startingBank = character.bank,
|
|
||||||
characterAmount = characterAmount .. "/" .. config.characterLimit
|
|
||||||
})
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- editing a character
|
-- editing a character
|
||||||
RegisterNUICallback("editCharacter", function(data)
|
RegisterNUICallback("editCharacter", function(data)
|
||||||
newCharacter = {
|
newCharacter = {
|
||||||
@@ -175,11 +160,23 @@ AddEventHandler("returnMoney", function(newCash, newBank)
|
|||||||
end
|
end
|
||||||
cash = newCash
|
cash = newCash
|
||||||
bank = newBank
|
bank = newBank
|
||||||
SendNUIMessage({
|
if config.legacyMoneyDisplay then
|
||||||
type = "Money",
|
if registered then
|
||||||
cash = "Cash: $" .. cash,
|
while true do
|
||||||
bank = "Bank: $" .. bank
|
Citizen.Wait(0)
|
||||||
})
|
text("💵", 0.885, 0.028, 0.35)
|
||||||
|
text("💳", 0.885, 0.068, 0.35)
|
||||||
|
text("~g~$~w~".. cash, 0.91, 0.03, 0.55)
|
||||||
|
text("~b~$~w~".. bank, 0.91, 0.07, 0.55)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
SendNUIMessage({
|
||||||
|
type = "Money",
|
||||||
|
cash = "Cash: $" .. cash,
|
||||||
|
bank = "Bank: $" .. bank
|
||||||
|
})
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Teleporting
|
-- Teleporting
|
||||||
@@ -209,11 +206,14 @@ RegisterNUICallback("tpDoNot", function(data)
|
|||||||
TriggerServerEvent("getMoney", mainCharaterId)
|
TriggerServerEvent("getMoney", mainCharaterId)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
function SetDisplay(bool, typeName)
|
function SetDisplay(bool, typeName, bg)
|
||||||
|
if not bg then
|
||||||
|
background = config.backgrounds[math.random(1, #config.backgrounds)]
|
||||||
|
end
|
||||||
SetNuiFocus(bool, bool)
|
SetNuiFocus(bool, bool)
|
||||||
SendNUIMessage({
|
SendNUIMessage({
|
||||||
type = typeName,
|
type = typeName,
|
||||||
background = config.backgrounds[math.random(1, #config.backgrounds)],
|
background = background,
|
||||||
status = bool,
|
status = bool,
|
||||||
serverName = config.serverName,
|
serverName = config.serverName,
|
||||||
characterAmount = characterAmount .. "/" .. config.characterLimit
|
characterAmount = characterAmount .. "/" .. config.characterLimit
|
||||||
@@ -324,3 +324,16 @@ function getCharacterInfo(infoType)
|
|||||||
return "Error: Player not registered"
|
return "Error: Player not registered"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function text(text, x, y, scale)
|
||||||
|
SetTextFont(7)
|
||||||
|
SetTextProportional(0)
|
||||||
|
SetTextScale(scale, scale)
|
||||||
|
SetTextEdge(1, 0, 0, 0, 255)
|
||||||
|
SetTextDropShadow(0, 0, 0, 0,255)
|
||||||
|
SetTextOutline()
|
||||||
|
SetTextJustification(1)
|
||||||
|
SetTextEntry("STRING")
|
||||||
|
AddTextComponentString(text)
|
||||||
|
DrawText(x, y)
|
||||||
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user