Jump to content

Bruno R dos Santos

Members
  • Posts

    36
  • Joined

  • Last visited

Everything posted by Bruno R dos Santos

  1. não deu certo, é esse meu script :c 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 ( "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 ) table.insert(notifyServerPlayers,player) end if #notifyServerPlayers ~= 0 then triggerServerEvent ( "voice_muteTableForPlayer", localPlayer, notifyServerPlayers ) end setSoundVolume (player, 1) 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 --
  2. As configs do mtaserverconf estão nas melhores possíveis, e como sou novo em script, qual a função para aumentar o volume do script de voice, ou até mesmo em que linha coloca-lo. Alguém poderia me ajudar?
  3. ah agora vou ter que te pedir desculpas, pois não vi que você moveu e criei outro topico '-', se puder apagar um... pensei que vc ia apenas excluir esse ?
  4. Ok, mas eu queria aprender também kk, gosto de aprender e fazer, mas np, vou mandar.
  5. To desenvolvendo um sistema de gangue, onde todas as gangues tem que ter um painel de roubo (o script do roubo está feito, o problema é que não da para adicionar todos os grupos da ACL nele, só um) Tem alguma forma disso acontecer? Todas as gangues do meu servidor ter acesso ao script? Lembrando que: Não posso deixar todas as gangues na mesma ACL, as gangues tem que ter ACL diferentes.
  6. ah, eu tentei postar no lugar mais correto possivel, desculpa. Então, o que eu queria fazer é que quando o Jogador deslogasse, ele iria sair de alguns groupACL automaticamente.
  7. Mas como eu vou vincular os dois? pq no script em si, já tem a ACL, mas é apenas um, então por exemplo eu só posso por na CV! se eu botar a ACL de roubar jogador para todas as gangues, logo todas as gangues vão conseguir abrir o portão da base de todas as gangues. é meio confuso mas é isso ._. Eu não sei como colocar por exemplo, o script de roubar para ACLS diferentes exemplo: ACLGROUP = roubar (script de roubar) ACLGROUP DE GANGUES: "CV, PCC, TRD" etc... Eu não posso colocar as ACL da gangue igual, tem que ser diferente, porem queria que todas pudessem ter acesso ao script de roubo.
  8. há alguma maneira de que o jogador assim que deslogasse, perdesse todas as tag? (acl group), ou que vc escolhesse qual ele perdesse?
  9. eu quero que meus scripts de roubar e prender funcionem para todas as corporações, e gangues do meu servidor. No caso eu só consigo colocar em 1 pelo painel P > resources > Manage ACL > CreateGroup > Gangue01 > add right > user.exemplo1 pq minhas bases são por ACL também, se eu colocar todas as bases na mesma ACL, pode ter invasão de jogador em bases adversarias. No caso eu queria que toda GANGUE tivesse acesso ao script de roubar, lembrando que todas as gangues são de grupos diferentes da ACL. Talvez seja algo muito besta de fazer, mas não estou conseguindo achar 1 solução para isso oaksdokasd
  10. Eu estou desenvolvendo um servidor de RP, e quero que as corporações do meu servidor, tenha acesso ao painel de policia... Tem alguma forma? pelo script, ou pelo painelP?
×
×
  • Create New...