mirror of
https://github.com/ND-Framework/ND_Core.git
synced 2026-08-16 21:46:03 +01:00
Start of ND 2.0
This commit is contained in:
@@ -1,54 +1,36 @@
|
||||
-- For support join my discord: https://discord.gg/Z9Mxu72zZ6
|
||||
|
||||
NDCore = {}
|
||||
NDCore.SelectedCharacter = nil
|
||||
NDCore.Characters = {}
|
||||
NDCore.Functions = {}
|
||||
NDCore.Config = config
|
||||
|
||||
-- discord rich precense will show on a users profile.
|
||||
if config.enableRichPresence then
|
||||
Citizen.CreateThread(function()
|
||||
while true do
|
||||
if NDCore.SelectedCharacter then
|
||||
SetDiscordAppId(config.appId)
|
||||
SetRichPresence(" Playing : " .. config.serverName .. " as " .. NDCore.SelectedCharacter.firstName .. " " .. NDCore.SelectedCharacter.lastName)
|
||||
SetDiscordRichPresenceAsset(config.largeLogo)
|
||||
SetDiscordRichPresenceAssetText("Playing: " .. config.serverName)
|
||||
SetDiscordRichPresenceAssetSmall(config.smallLogo)
|
||||
SetDiscordRichPresenceAssetSmallText("Playing as: " .. NDCore.SelectedCharacter.firstName .. " " .. NDCore.SelectedCharacter.lastName)
|
||||
SetDiscordRichPresenceAction(0, config.firstButtonName, config.firstButtonLink)
|
||||
SetDiscordRichPresenceAction(1, config.secondButtonName, config.secondButtonLink)
|
||||
end
|
||||
Citizen.Wait(config.updateIntervall * 1000)
|
||||
CreateThread(function()
|
||||
SetDiscordAppId(Config.discordAppId)
|
||||
SetDiscordRichPresenceAsset(Config.discordAsset)
|
||||
SetDiscordRichPresenceAssetSmall(Config.discordAssetSmall)
|
||||
SetDiscordRichPresenceAction(0, Config.discordActionText, Config.discordActionLink)
|
||||
SetDiscordRichPresenceAction(1, Config.discordActionText2, Config.discordActionLink2)
|
||||
local presenceText = ("Playing: %s"):format(Config.serverName)
|
||||
while true do
|
||||
if NDCore.player then
|
||||
local presence = ("Playing: %s as % %"):format(Config.serverName, NDCore.player.firstname, NDCore.player.lastname)
|
||||
local presenceTextSmall = ("Playing as: %s %s"):format(NDCore.player.firstname, NDCore.player.lastname)
|
||||
SetRichPresence(presence)
|
||||
SetDiscordRichPresenceAssetText(presenceText)
|
||||
SetDiscordRichPresenceAssetSmallText(presenceTextSmall)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
-- show server name, first name, last name, and the amount of money the character has in the pause menu.
|
||||
if config.customPauseMenu then
|
||||
Citizen.CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
if NDCore.SelectedCharacter then
|
||||
if IsPauseMenuActive() then
|
||||
BeginScaleformMovieMethodOnFrontendHeader("SET_HEADING_DETAILS")
|
||||
AddTextEntry("FE_THDR_GTAO", config.serverName)
|
||||
ScaleformMovieMethodAddParamPlayerNameString(NDCore.SelectedCharacter.firstName .. " " .. NDCore.SelectedCharacter.lastName)
|
||||
PushScaleformMovieFunctionParameterString("Cash: $" .. tostring(NDCore.SelectedCharacter.cash))
|
||||
PushScaleformMovieFunctionParameterString("Bank: $" .. tostring(NDCore.SelectedCharacter.bank))
|
||||
EndScaleformMovieMethod()
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
-- Enables pvp if it's selected in the config.
|
||||
AddEventHandler("playerSpawned", function()
|
||||
if config.enablePVP then
|
||||
SetCanAttackFriendly(PlayerPedId(), true, false)
|
||||
NetworkSetFriendlyFireOption(true)
|
||||
Wait(60000)
|
||||
end
|
||||
print("^0This framework is created by ^5Andyyy#7666 ^0for support you can join the ^5discord: ^0https://discord.gg/Z9Mxu72zZ6")
|
||||
end)
|
||||
end)
|
||||
|
||||
CreateThread(function()
|
||||
AddTextEntry("FE_THDR_GTAO", Config.serverName)
|
||||
local sleep = 500
|
||||
while true do
|
||||
Wait(sleep)
|
||||
if NDCore.player and IsPauseMenuActive() then
|
||||
sleep = 0
|
||||
BeginScaleformMovieMethodOnFrontendHeader("SET_HEADING_DETAILS")
|
||||
ScaleformMovieMethodAddParamPlayerNameString(("%s %s"):format(NDCore.player.firstname, NDCore.player.lastname))
|
||||
PushScaleformMovieFunctionParameterString(("Cash: $%d"):format(NDCore.player.cash))
|
||||
PushScaleformMovieFunctionParameterString(("Bank: $%d"):format(NDCore.player.bank))
|
||||
EndScaleformMovieMethod()
|
||||
elseif sleep == 0 then
|
||||
sleep = 500
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user