HitmanLM Posted July 22, 2020 Share Posted July 22, 2020 alguém sabe me dizer como faço music aparar depois que o login e feito? addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function() setTimer(function() playSound("joinsound.mp3") end, 2000, 1) end ) Link to comment
DNL291 Posted July 22, 2020 Share Posted July 22, 2020 Movido para Programação em Lua Link to comment
Blaack Posted July 23, 2020 Share Posted July 23, 2020 5 hours ago, HitmanLM said: alguém sabe me dizer como faço music aparar depois que o login e feito? addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function() setTimer(function() playSound("joinsound.mp3") end, 2000, 1) end ) Crie o lado server.lua com o evento "onPlayerLogin", quando ele logar execute um triggerClientEvent e no lado client voce para o som com stopSound Link to comment
HitmanLM Posted July 24, 2020 Author Share Posted July 24, 2020 On 23/07/2020 at 00:02, ~#BlackSCR said: Crie o server.lua com o evento "onPlayerLogin", quando ele executar um triggerClientEvent e no lado do cliente, você ouvirá um som com stopSound já existe, oque acontece não sei porque fizeram o sistema de tocar musica individual fora dos outros sistemas, e um sistema de login, aqui o server: local badChars = {"!","\"","§","&","/","=","?","`","´","\\","{","}","³","²","@","€","*","+","#","'","~","|","<",">",".",":",",",";","%","(",")","$","[","]"} addEventHandler("onResourceStart", resourceRoot, function() for _, player in ipairs(getElementsByType"player") do logOut(player) end end) local function containsBadChars(n) for _, theChar in ipairs(badChars) do if string.find(n, tostring(theChar), 1, true) then return true end end return false end local function isPlayerRegistered(player) if #getAccountsBySerial(getPlayerSerial(player)) ~= 0 then return true else return false end end local function getPlayersFirstAccount(player) if #getAccountsBySerial(getPlayerSerial(player)) ~= 0 then return getAccountsBySerial(getPlayerSerial(player))[1] else return false end end addEvent("onClientFinishedLoading", true) addEventHandler("onClientFinishedLoading", root, function() local firstAccount = getPlayersFirstAccount(client) triggerClientEvent(client, "onServerRequestLoginRegister", getRootElement(), firstAccount and getAccountName(firstAccount) or false) end ) local function isAccountRegistered(n) local account = getAccount(n) if account then return true else return false end end addEvent("onClientExecute", true) addEventHandler("onClientExecute", root, function(s, inputs) if source ~= client then return end if s == 1 then local pA = getAccount(inputs[1]) if pA then local pL = logIn(client, pA, inputs[2]) if pL then triggerClientEvent(client, "onClientSuccess", client) triggerEvent("onClientLoggedIn", resourceRoot, client) triggerClientEvent(client, "addClientMessage", client, "|Info| #ff8000Type /report [text] for super very fast support :)", 255, 255, 255) return else triggerClientEvent(client, "showErrorMessage", client, "Senha incorreta") end else triggerClientEvent(client, "showErrorMessage", client, "Não foi possível encontrar essa conta!") end elseif s == 2 then for _, t in ipairs(inputs) do if t == nil or t == "" then triggerClientEvent(client, "showErrorMessage", client, "Nome de usuário ou senha incorreta") return end end if containsBadChars(inputs[1]) then triggerClientEvent(client, "showErrorMessage", client, "O nome da conta tem carateres inválidos") return elseif #inputs[2] < 6 then triggerClientEvent(client, "showErrorMessage", client,"Sua senha deve ter mais de 6 caracteres.") return elseif inputs[2] ~= inputs[3] then triggerClientEvent(client, "showErrorMessage", client,"Senhas não coincidem.") return elseif isAccountRegistered(inputs[1]) then triggerClientEvent(client, "showErrorMessage", client,"Esta conta já está registrada.") return elseif isPlayerRegistered(client) then triggerClientEvent(client, "showErrorMessage", client, "Você já está registrado.") return end local nA = addAccount(inputs[1], inputs[2]) if nA then logIn(client, nA, inputs[2]) triggerClientEvent(client, "onClientSuccess", client) setPlayerTeam(client, getTeamFromName("User")) --setAccountData(nA, "cash", 250000) triggerClientEvent(client, "onClientSuccess", client) else triggerClientEvent(client, "showErrorMessage", client, "Um erro ocorreu durante a criação da conta.") end end end) addEventHandler("onPlayerCommand", root, function(cmd) if cmd == "login" or cmd == "register" or cmd == "logout" then cancelEvent() end end) Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now