
Bruno R dos Santos
Members-
Posts
36 -
Joined
-
Last visited
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
Bruno R dos Santos's Achievements

Rat (9/54)
1
Reputation
-
Olá, meu problema é o seguinte, eu consegui deixar todos do meu servidor com a voz mais alta utilizando o setSoundVolume, o problema é que se eu estou logado no servidor, e 1 player novo entra na cidade, o voz dele é baixo, e só resolve dando restart no script, alguém consegue me dar alguma solução? eu tentei fazer o player dar um trigger na função que está aumentando o volume qnd logasse no servidor, mas não funcionou... local DATA_NAME = "voice:chatting" local xmlCache = {} local VOICE_IDLE = { type = "image", src = ":voice/images/voice_small.png", color = tocolor(255,255,255,64), width = 20, height = 20, } local VOICE_CHATTING = { type = "image", src = ":voice/images/voice_small.png", color = tocolor(255,255,255,255), width = 20, height = 20, } local VOICE_MUTED = { type = "image", src = ":voice/images/voice_small_muted.png", color = tocolor(255,255,255,255), width = 20, height = 20, } addEventHandler ( "onClientPlayerVoiceStart", root, function() if globalMuted[source] then cancelEvent() return end setElementData ( source, DATA_NAME, VOICE_CHATTING, false ) end ) addEventHandler ( "onClientPlayerVoiceStart2", root, function() if globalMuted[source] then cancelEvent() return end setElementData ( source, DATA_NAME, VOICE_CHATTING, false ) end ) addEventHandler ( "onClientPlayerVoiceStop", root, function() setElementData ( source, DATA_NAME, VOICE_IDLE, false ) end ) --Mute a remote player for the local player only. It informs the server as an optimization, so speech is never sent. function setPlayerVoiceMuted ( player, muted, synchronise ) if not checkValidPlayer ( player ) then return false end if player == localPlayer then return false end if muted and not globalMuted[player] then globalMuted[player] = true addMutedToXML ( player ) setElementData ( player, DATA_NAME, VOICE_MUTED, false ) if synchronise ~= false then triggerServerEvent ( "voice_mutePlayerForPlayer", player ) end elseif not muted and globalMuted[player] then globalMuted[player] = nil removeMutedFromXML ( player ) setElementData ( player, DATA_NAME, VOICE_IDLE, false ) if synchronise ~= false then triggerServerEvent ( "voice_unmutePlayerForPlayer", player ) end end return false end function isPlayerVoiceMuted ( player ) if not checkValidPlayer ( player ) then return false end return not not globalMuted[player] end --Muting commands addCommandHandler ( "mutevoice", function ( cmd, playerName ) if not playerName then outputConsole ( "Syntax: muteplayer <playerName>" ) return end local player = getPlayerFromName ( playerName ) if not player then outputConsole ( "mutevoice: Unknown player '"..playerName.."'" ) return end if isPlayerVoiceMuted ( player ) then outputConsole ( "mutevoice: Player '"..playerName.."' is already muted!" ) return end if player == localPlayer then outputConsole ( "mutevoice: You cannot mute yourself!" ) return end setPlayerVoiceMuted ( player, true ) outputConsole ( "mutevoice: Player '"..playerName.."' has been muted" ) end ) --Muting commands addCommandHandler ( "unmutevoice", function ( cmd, playerName ) if not playerName then outputConsole ( "Syntax: unmuteplayer <playerName>" ) return end local player = getPlayerFromName ( playerName ) if not player then outputConsole ( "unmutevoice: Unknown player '"..playerName.."'" ) return end if not isPlayerVoiceMuted ( player ) then outputConsole ( "unmutevoice: Player '"..playerName.."' is not muted" ) return end setPlayerVoiceMuted ( player, false ) outputConsole ( "ubmutevoice: Player '"..playerName.."' has been unmuted" ) end ) --Scoreboard/muted player list hook addEventHandler ( "onClientResourceStart", resourceRoot, function() if isVoiceEnabled() then cacheMutedFromXML () if getResourceFromName"scoreboard" then -- For some reason, without this timer scoreboard moves the column to a different position if you've just joined setTimer ( call, 50, 1, getResourceFromName"scoreboard", "scoreboardAddColumn", DATA_NAME, 30, "Voice", 1 ) addEventHandler ( "onClientPlayerScoreboardClick", root, scoreboardClick ) addEventHandler ( "onClientPlayerJoin", root, handleJoinedPlayer ) end local notifyServerPlayers = {} for i,player in ipairs(getElementsByType"player") do if xmlCache[getPlayerName(player)] then -- Don't synchronise the player muting. Instead let's send one bigger packet setPlayerVoiceMuted ( player, true, false ) setSoundVolume (player, 30) table.insert(notifyServerPlayers,player) end if #notifyServerPlayers ~= 0 then triggerServerEvent ( "voice_muteTableForPlayer", localPlayer, notifyServerPlayers ) end setElementData ( player, DATA_NAME, isPlayerVoiceMuted ( player ) and VOICE_MUTED or VOICE_IDLE, false ) end end end ) function handleJoinedPlayer() player = source if xmlCache[getPlayerName(player)] then setPlayerVoiceMuted ( player, true ) end setElementData ( player, DATA_NAME, isPlayerVoiceMuted ( player ) and VOICE_MUTED or VOICE_IDLE, false ) end function scoreboardClick ( row, x, y, columnName ) if getElementType(source) == "player" and columnName == DATA_NAME then local player = source if player == localPlayer then return end setPlayerVoiceMuted ( player, not isPlayerVoiceMuted ( player ) ) exports.scoreboard:scoreboardForceUpdate() end end --Player muting XML parsing function cacheMutedFromXML () local file = xmlLoadFile ( "mutedlist.xml" ) if not file then return end local nodes = xmlNodeGetChildren ( file ) for i,node in ipairs(nodes) do local name = xmlNodeGetAttribute ( node, "name" ) if name then xmlCache[name] = true end end xmlUnloadFile(file) end function addMutedToXML ( player ) if not isElement(player) then return end if xmlCache[getPlayerName(player)] then return end local name = getPlayerName ( player ) local file = xmlLoadFile ( "mutedlist.xml" ) file = file or xmlCreateFile ( "mutedlist.xml", "mutedlist" ) local node = xmlCreateChild ( file, "mute" ) xmlNodeSetAttribute ( node, "name", name ) xmlSaveFile(file) xmlUnloadFile(file) xmlCache[name] = true end function removeMutedFromXML ( player ) if not isElement(player) then return end local name = getPlayerName ( player ) local file = xmlLoadFile ( "mutedlist.xml" ) if not file then return end local nodes = xmlNodeGetChildren ( file ) for i,node in ipairs(nodes) do if xmlNodeGetAttribute ( node, "name" ) == name then xmlDestroyNode ( node ) break end end xmlSaveFile(file) xmlUnloadFile(file) xmlCache[name] = nil end -- Functions for backward compatibility only -- DO NOT USE THESE AS THEY WILL BE REMOVED IN A LITTLE WHILE -- function isPlayerMuted ( player ) return isPlayerVoiceMuted ( player ) end function setPlayerMuted ( player, muted ) return setPlayerVoiceMuted ( player, muted ) end isVoiceEnabled = isVoiceEnabled or function() return getElementData(resourceRoot,"voice_enabled") end -- DO NOT USE THESE AS THEY WILL BE REMOVED IN A LITTLE WHILE --
-
As vezes quando estou jogando, eu caiu do servidor, e aparece esses erros, e quando tento voltar para o servidor da o erro cc23! Procurei em alguns topicos, e vi que sempre recomendaram desativar o firewall, atualizar o driver de rede, e também usar um arquivo e depois reiniciar o pc! fiz isso tudo, e não mudou nada, aqui é o log do MTA https://pastebin.mtasa.com/1000000705
-
estou com um painel dx aqui, e na hora que vou digitar algo que contem as letras "T", "M" e "U" abre o chat do RP que estão bindadas nessas teclas, eu lembro que há uma forma de bloquear isso no client enquanto o painel dx está aberto, como é? eu tentei dessa maneira, adicionando o guisetvisible e o setimput, e não consegui function abrir (_,state) if painel == true then if state == "down" then if isCursorOnElement(639, 403, 104, 35 ) then if guiGetText(edit) == "alto" then guiSetInputEnabled(true) -- ocultar a janela e todos os componentes guiSetVisible(abrir, true) triggerServerEvent ("abrir", localPlayer) removeEventHandler ("onClientRender", root, painela) showCursor (false) painel = false guiSetVisible(edit, false) else outputChatBox ('[ ATENÇAO ] - Senha incorreta') end end end end end addEventHandler ("onClientClick", root, abrir)
-
Bruno R dos Santos started following Blaack
-
Ok, eu tentei dessa maneira aqui mas não deu certo, consegue me explicar o por que? Esse code é da onde vem o killer, e eu adicionei isso nele: addEventHandler("onPlayerWasted", root, function (ammo, killer, weapon, bodypart) setElementData(ammo, killer, weapon, bodypart) embaixo disso ai, ta o restante do code que eu acredito ser irrelevante. agora indo para o outro script, eu adicionei isso: function getkillerID(player) return getElementData(player,"killer") end e depois isso: outputChatBox("Você morreu para o jogador: #00ff55"..getkillerID(player,"killer").."", player, 255, 255, 255, true) O que eu fiz de errado?
-
Eu tentei dar frozen nele, mas não funcionou.
-
Eu quero que essa linha não se torne boolean outputChatBox("Você morreu para o jogador: #00ff55"..getPlayerName(killer).."", source, 255, 255, 255, true) mas o (killer) vem de outro script (outro server-side), é possivel? ou eu teria que passar tudo para o mesmo script? Ja tentei adicionar no mesmo meta Também tentei passar tudo para o mesmo script, porem ficou muito complicado pois o script que quero adicionar essa linha, tem muitas diferenças de source e player.
-
é exatamente o que eu estou tentando fazer D:, mas não estou conseguindo, e nem informa o erro no debugscript 3. Essa parte do meu code function SetarCaidoComHS() player = source if attacker and attacker ~= source then if getElementType(attacker) == "player" then -- Obter o ID, nickname e vida de quem matou local attackerId = getElementData(attacker, "ID") or "?" local attackerName = getPlayerName(attacker) local attackerHealth = getElementHealth(attacker) if not getElementData(player, "playerFallen") then removePedFromVehicle(player) setPlayerFallen(player, true) setElementFrozen(player, true) setPedAnimation(player, "SWEET", "Sweet_injuredloop", 1, false, true, false) triggerClientEvent(player, "startDeadTime", player) -- Enviamos esses dados que pegamos acima para quem morreu triggerClientEvent(source, "showInfoWhenPlayerIsDead", resourceRoot, {attackerId, attackerName, attackerHealth}) end outputDxBox(player, 'Digite "/192" e espere que um SAMU venha e o cure ou morrerá em 3 minutos.', "warning") setTimer(function() if getElementData(player, "playerFallen") then setElementData(player, "playerFallen", false) setPlayerFallen(player, false) triggerClientEvent(player, "stopDeadTime", player) if isElement ( blip[player] ) then destroyElement(blip[player]) end killPlayer(player) outputDxBox(player, "Você demorou para ser curado e acabou morrendo!", "info") end end, 180000, 1) else setPedAnimation(player, "SWEET", "Sweet_injuredloop", 1, false, true, false) end end end setTimer(checkHealth, 1000, 0) addEvent("OnHS", true) addEventHandler("OnHS", getRootElement(), SetarCaidoComHS, root, (attacker)) foi o que eu adicionei as infos que você me passou, como na linha 1 ao 7, e na ultima linha adicionei no eventhandler! mas simplesmente parou de funcionar o HS no player (essa parte do script, se vc atirar na cabeça do jogador, ele cai e fica no chão até um "samu" vir e curar). a minha intenção de primeiro era fazer funcionar conforme ficou o seu exemplo, e assim ir melhorando e aperfeiçoando, colocando a arma que o atingiu, se foi hs ou não, e por ai vai, mas eu não to conseguindo nem imaginar como fazer funcionar o seu EXEMPLO no meu SCRIPT pra começar.
-
Bruno R dos Santos started following androksi
-
no caso eu tenho que mudar o evento "showInfoWhenPlayerIsDead" para "setplayerFallen" pois dessa sua maneira, só mostraria o ID de quem te matou, quando você morresse e perdesse tudo, no caso eu quero que quando o jogador ficasse no chão por ter sofrido muito dano, aparecesse na tela quem causou isso, estou correto?
-
era para ser mensagem privada uahausdhuahsda, desculpa
(se puder apagar eu acho que aprendi como funciona o exemplo que você me deu
agradecido irmão)