Editable Files
Last updated
Last updated
function disableKeys()
DisableAllControlActions(0)
EnableControlAction(0, 249, true)
EnableControlAction(0, 1, true)
EnableControlAction(0, 2, true)
EnableControlAction(0, 32, true)
end
function open()
sendNui("app-main", "open")
SetNuiFocus(true, true)
end
function close()
SetNuiFocus(false, false)
end
RegisterNetEvent("tgiann-musical-chairs:musicStatus")
AddEventHandler("tgiann-musical-chairs:musicStatus", function(play, data)
if config.soundScript == "tgiann-sound" then
if play then
TriggerEvent("tgiann-sounds:play-sound", {
name = data.key,
coord = data.coord,
youtube = data.music,
checkDistance = true,
maxDistance = 50,
soundMaxVolume = 0.4,
loop = true,
})
else
TriggerEvent("tgiann-sounds:stop-sound", {
name = data.key
})
end
elseif config.soundScript == "xsound" then
if play then
exports["xsound"]:PlayUrlPos(data.key, data.music, 0.4, data.coord, true)
exports["xsound"]:Distance(data.key, 50.0)
else
exports["xsound"]:Destroy(data.key)
end
end
end)
local tgiCore = tgiCoreExports:getCore()
local lang = config.langs[config.lang]
if config.framework == "qb" then
tgiCore.core.Commands.Add(config.command, lang.commandDesc, {}, false, function(source, args)
TriggerClientEvent("tgiann-musical-chairs:client:createGame", source)
end)
else
tgiCore.core.RegisterCommand({config.command}, 'user', function(xPlayer, args, showError)
TriggerClientEvent("tgiann-musical-chairs:client:createGame", xPlayer.source)
end, false, {
help = lang.commandDesc,
})
end
config.langs.en = {
helpMessage = "After the Music stops press [E] to sit",
commandDesc = "Start musical chairs game",
joinError1 = "Slot full",
joinError2 = "The game reached the maximum players!",
joinError2 = "This game already started!",
join = "~g~[E]~w~ Join Game",
leave = "~r~[X]~w~ Leave Game",
leaveError = "You can't leave! Game started!",
player = "Player",
playerAmount = "Player number",
customMusic = "Custom Music",
youtubeUrl = "Youtube URL",
selectMusic = "Select Music",
cancel = "Cancel",
startGame = "Create Game",
cancaled = "Game cancelled",
errorMusic = "Music can't be played!",
errorPlayer = "Choose a player number",
earlySit = "A player sat down before the music stopped! After 5 Seconds, the Game Will Start with 1 Chair Missing!",
}