Bruno R dos Santos
-
Posts
36 -
Joined
-
Last visited
Posts posted by Bruno R dos Santos
-
-
-
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)
-
7 hours ago, ~#BlackSCR said:
OFF. Deixa o thanks ai kk
Vou deixar!
Só ta acontecendo uma coisa agora, dps de um dia de teste, é que por algum motivo, algumas vezes o script buga inteiro, e os player não morrem, mas estou tentando resolver, de qualquer forma agradecido estou
-
3 hours ago, Bruno R dos Santos said:
Funcionou no meu servidor aberto em casa, upei no host e não funcionou! WTF?
só atualizando que depois de algum esforcinho, consegui fazer funcionar, mt obrigado pela ajuda
-
Funcionou no meu servidor aberto em casa, upei no host e não funcionou! WTF?
-
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 codefunction 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. -
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?
-
Eu sempre quis fazer um script dessa forma, mas não consigo imaginar como começar, alguém consegue dar uma luz?
na real eu quero colocar o ID de quem matou o X na tela dele. -
9 hours ago, Bruno R dos Santos said:
a linha que você não entendeu, ela verifica se o player está na ACL para abrir o marker, (não era para ser assim, então tirei a verificação, porem quando eu retiro essa linha, o script também buga '-')
edit: o Script foi perfeitamente, muito obrigado amigo, ajudou bastantena real, não foi perfeitamente não ele ta entrando na ACL só de passar pelo marker (para abrir o painel de senha do portao), e no caso ele teria que acertar a senha para entrar na ACL
-
a linha que você não entendeu, ela verifica se o player está na ACL para abrir o marker, (não era para ser assim, então tirei a verificação, porem quando eu retiro essa linha, o script também buga '-')
edit: o Script foi perfeitamente, muito obrigado amigo, ajudou bastante -
eu to com esse script aqui, tentando fazer que com que após o jogador acertasse a senha do portão, entrasse na ACL "PMESP"
porem está dando erro, e não sei o porque :T
function createThelift () mylift = createObject(980, 1539.634765625,-1627.90625,15.3828125, 0, 0, 270) ---- portao principal end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createThelift ) --function createThelift1 () -- mylift1 = createObject(980, 1539.634765625,-1627.90625,15.3828125, 0, 0, 270) ----rr no script e ele aparece em outro lugar --end --addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createThelift1 ) --function createThelift2 () -- mylift12 = createObject(980, 1539.634765625,-1627.90625,15.3828125, 0, 0, 270) --end --addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createThelift2 ) local marker = createMarker (1545.08020, -1627.61438, 12.38281, "cylinder", 6, 0, 255, 255, 0) function open2 (psource) login3 = getAccountName(getPlayerAccount(psource)) isObjectInACLGroup("user."..login3, aclGetGroup("Guest")) aclGroupAddObject (aclGetGroup("BOPE"), "user."..getAccountName(getPlayerAccount(source))) triggerClientEvent (psource, "open2", root) end addEventHandler ("onMarkerHit", marker, open2) --------------------- SCRIPT function abrir (source) moveObject(mylift, 980, 1539.634765625,-1327.90625,15.3828125, 0, 90,0) ---abre o primeiro portao pro lado esquerdo setTimer ( function() moveObject(mylift, 980, 1539.634765625,-1627.90625,15.3828125, 0, -90, 0) ---fecha o primeiro portao pro lado direito end, 5000, 1 ) end addEvent ("abrir", true) addEventHandler ("abrir", getRootElement(), abrir) -------------------- SCRIPT 2 local marker2 = createMarker (1588.90808, -1637.59497, 13.44030, "cylinder", 6, 0, 255, 255, 0) function open22 (psource) login2 = getAccountName(getPlayerAccount(psource)) if isObjectInACLGroup("user."..login2, aclGetGroup("CV")) then triggerClientEvent (psource, "open22", root) end end addEventHandler ("onMarkerHit", marker2, open22) function abrir2 (source) moveObject(mylift1, 980, 1539.634765625,-1327.90625,15.3828125, 0, 90,0) setTimer ( function() moveObject(mylift1, 980, 1539.634765625,-1627.90625,15.3828125, 0, 0, 0) end, 5000, 1 ) end addEvent ("abrir2", true) addEventHandler ("abrir2", getRootElement(), abrir2)
na linha 19, eu adicionei a função para entrar no group da ACL, mas está dando erro no debugscript 3
"server.lua:20: attempt to concatenate a boolean value"
alguém poderia me ajudar? sou novo nisso.
E se também alguém conseguir me explicar o porque ele está acusando de um boolean value ou me explicar o porque da esses tipo de erro em alguns scripts eu agradeço, para eu poder arrumar futuros bugs -
Alguém poderia me ajudar? eu to afim de botar o ID de quem me matou no meu sistema de samu, só que eu não sei por onde começar.
esse é o client se precisar do server eu posto :T
local screenW, screenH = guiGetScreenSize() local resW, resH = 1360,768 local x, y = (screenW/resW), (screenH/resH) local screenWidth, screenHeight = guiGetScreenSize() local myScreenSource = dxCreateScreenSource(screenWidth, screenHeight) local flickerStrength = 0 local dxfont0_fonte = dxCreateFont("font/fonte.ttf", 13) addEventHandler("onClientKey", root, function (button, press) if getElementData(getLocalPlayer(),"playerFallen") then if button == "F1" or button == "F2" or button == "F3" or button == "F4" or button == "F5" or button == "F6" or button == "F7" or button == "b" or button == "F9" or button == "F10" or button == "F11" or button == "F12" then cancelEvent() end end end ) function blockDead() if getElementHealth(localPlayer) <= 20 then if not getElementData(localPlayer, "jobSAMU") then if not getElementData(localPlayer, "playerFallen") then cancelEvent() end end end end addEventHandler("onClientPlayerDamage", localPlayer, blockDead) function text() for _, player in ipairs(getElementsByType('player')) do if isElementOnScreen(player) and getElementData(player, "playerFallen") then local x, y, z = getElementPosition(player) local cx, cy, cz = getCameraMatrix() local vx, vy, vz = getPedBonePosition(player, 8) local dist = getDistanceBetweenPoints3D(cx, cy, cz, vx, vy, vz) local drawDistance = 30.0 if (dist < drawDistance or player == target) then if(isLineOfSightClear(cx, cy, cz, vx, vy, vz, true, false, false)) then local x, y = getScreenFromWorldPosition (vx, vy, vz + 0.6) if(x and y) then local px, py = getScreenFromWorldPosition (vx, vy, vz + 0.3) local w = dxGetTextWidth("PRECISANDO DE CURA!", 1, "default-bold") local h = dxGetFontHeight(1, "default-bold") dxDrawImage(x -6 - w / 2,y - 15 - h - 12, w + 25, h + 115, 'images/hp.png', 0, 0, 0, tocolor(255, 0, 0, math.abs(math.sin(getTickCount()/170))*200)) dxDrawRectangle(x -6 - w / 2,y - 15 - h - 12, w + 9, h, tocolor(0, 0, 0, 194), false) dxDrawText("#FFFFFFPRECISANDO DE #FF0000CURA#FFFFFF!", x - 0 - w / 2,y - 15 - h - 12, w, h, tocolor(255,0,0, math.abs(math.sin(getTickCount()/170))*200), 1, "default-bold", "left", "top", false, false, false, true, false) end end end end end end addEventHandler("onClientRender", root, text) function convertTime(ms) local min = math.floor ( ms/60000 ) local sec = math.floor( (ms/1000)%60 ) return min, sec end function isEventHandlerAdded( sEventName, pElementAttachedTo, func ) if type( sEventName ) == 'string' and isElement( pElementAttachedTo ) and type( func ) == 'function' then local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo ) if type( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then for i, v in ipairs( aAttachedFunctions ) do if v == func then return true end end end end return false end function contador() local timer = interpolateBetween(deadTime, 0, 0, 0, 0, 0, (getTickCount()-tick)/deadTime, "Linear") local minutes, seconds = convertTime(timer) if minutes < 10 then minutes = "0"..minutes end if seconds < 10 then seconds = "0"..seconds end dxDrawRectangle(screenW * 0.3580, screenH * 0.8099, screenW * 0.2621, screenH * 0.1328, tocolor(0, 0, 0, 182), false) dxDrawText("BRUXARIA EMERGÊNCIA", screenW * 0.3580, screenH * 0.7878, screenW * 0.6201, screenH * 0.8151, tocolor(255, 25, 25, 255), 1.20, "default-bold", "center", "top", false, false, false, false, false) dxDrawText("Você está ferido e precisa de um médico", screenW * 0.3580, screenH * 0.8229, screenW * 0.6201, screenH * 0.8477, tocolor(255, 255, 255, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("Chame os paramédicos no /192 e aguarde", screenW * 0.3580, screenH * 0.8477, screenW * 0.6201, screenH * 0.8724, tocolor(255, 255, 255, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("um paramédico chegar.", screenW * 0.3580, screenH * 0.8724, screenW * 0.6201, screenH * 0.8971, tocolor(255, 255, 255, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("TEMPO DE VIDA:", screenW * 0.3616, screenH * 0.9154, screenW * 0.4305, screenH * 0.9375, tocolor(255, 254, 254, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) dxDrawText("#ff0000".. minutes.."#ffffff:#ff0000"..seconds, screenW * 0.3580, screenH * 0.9023, screenW * 0.6201, screenH * 0.9505, tocolor(255, 25, 25, 255), 1.40, "default-bold", "center", "center", false, false, false, true, false) end function createShader() oldFilmShader, oldFilmTec = dxCreateShader("shaders/old_film.fx") end function DxChamar() dxDrawText("Você chamou um paramédico, aguarde.", screenW * 0.3580, screenH * 0.7500, screenW * 0.6223, screenH * 0.7799, tocolor(245, 254, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) end function updateShader() upDateScreenSource() if (oldFilmShader) then local flickering = math.random(100 - flickerStrength, 100)/100 dxSetShaderValue(oldFilmShader, "ScreenSource", myScreenSource); dxSetShaderValue(oldFilmShader, "Flickering", flickering); dxDrawImage(0, 0, screenWidth, screenHeight, oldFilmShader) end end function upDateScreenSource() dxUpdateScreenSource(myScreenSource) end function render() if not isEventHandlerAdded("onClientRender", root, contador) then tick = getTickCount() createShader() addEventHandler("onClientRender", root, contador) addEventHandler("onClientPreRender", root, updateShader) end end addEvent("startDeadTime", true) addEventHandler("startDeadTime", root, render) function remove() if isEventHandlerAdded("onClientRender", root, contador) then removeEventHandler("onClientRender", root, contador) removeEventHandler("onClientPreRender", root, updateShader) end end addEvent("stopDeadTime", true) addEventHandler("stopDeadTime", root, remove) function ModSamu(attacker, weapon, bodypart) if ( bodypart == 9 ) then cancelEvent() triggerServerEvent("OnHS", source) end end addEventHandler("onClientPlayerDamage",root,ModSamu)
-
Não funcionou.
Vou mostrar o script todo (sim, eu sei que apenas adicionei via comando /roubar e não por click, pensei em adicionar depois que descobrisse como fazer isso)--[[ /\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\/ Curta a Minha Página <3 https://www.facebook.com/danilinmtascr/ ::::::::: ::: :::: ::: ::::::::::: ::: ::::::::::: :::: ::: :+: :+: :+: :+: :+:+: :+: :+: :+: :+: :+:+: :+: +:+ +:+ +:+ +:+ :+:+:+ +:+ +:+ +:+ +:+ :+:+:+ +:+ +#+ +:+ +#++:++#++: +#+ +:+ +#+ +#+ +#+ +#+ +#+ +:+ +#+ +#+ +#+ +#+ +#+ +#+ +#+#+# +#+ +#+ +#+ +#+ +#+#+# #+# #+# #+# #+# #+# #+#+# #+# #+# #+# #+# #+#+# ######### ### ### ### #### ########### ########## ########### ### #### /\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\/ --]] Tempo_Roubo = {} Desativar_Roubo_Ladrao = {} Desativar_Roubo_Player = {} --===================================-- ------------ ROUBAR PLAYER ------------ --===================================-- local rendido = { } addCommandHandler("render", function (player) rendido[player] = true setPedAnimation ( player, "shop", "shp_rob_handsup", -1, true, false, false ) outputChatBox("#000000║#ffffff✘ #FFD700Info #ffffff ✘#000000║ - #04ED00Digite /Abaixar Para Abaixar As Maos", player, 255, 25, 25, true) end) addCommandHandler("abaixar", function (player) rendido[player] = false setPedAnimation ( player ) end) function Roubar_Player ( Player ) local cx, cy, cz = getElementPosition ( Player ) local px, py, pz = getElementPosition ( source ) local distance = getDistanceBetweenPoints3D ( cx, cy, cz, px, py, pz ) if ( distance <= 5 ) then if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("painelroubo")) then if not getPedOccupiedVehicle(source) then if not getPedOccupiedVehicle(Player) then if getPlayerMoney(Player) >= 500 then if getElementData(source, "DNL:Roubando") == false then if getElementData(Player, "DNL:Sendo_Roubado") == false then if getElementData(source, "DNL:Roubou_Recentemente") == false then if getElementData(Player, "DNL:Roubado_Recentemente") == false then if Player == source then return end Player_Roubado = Player Player_Ladrao = source setPedAnimation( source, "BOMBER", "BOM_Plant_Loop", -1, true, false, false, false) setPedAnimation( Player, "CRACK", "crckidle1", -1, true, false, false, false) setElementData ( Player, "DNL:Sendo_Roubado", true) setElementData ( source, "DNL:Roubando", true) setElementData ( source, "Dinheiro_Ladrao", tonumber(math.floor(getPlayerMoney(Player))/3)) setElementData ( source, "Dinheiro", tonumber(math.floor(getPlayerMoney(Player))/3)) triggerClientEvent (Player, "DNL:Abrir_Roubo_Player", Player, Player_Roubado, Player_Ladrao) triggerClientEvent (source, "DNL:Abrir_Roubo_Ladrao", source) triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffVocê está roubando o jogador "..getPlayerName(Player).."") triggerClientEvent(Player, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffVocê está sendo roubado pelo jogador "..getPlayerName(source).."") Tempo_Roubo[source] = setTimer(function(source) local Dinheiro_Ladrao = tonumber(getElementData(source, "Dinheiro_Ladrao")) or 0 local Dinheiro_Dx = tonumber(getElementData(source, "Dinheiro_Dx")) or 0 givePlayerMoney(source, 500) takePlayerMoney(Player, 500) playSoundFrontEnd (source, 12) playSoundFrontEnd (Player, 12) setElementData ( source, "Dinheiro_Ladrao", Dinheiro_Ladrao -500) setElementData ( source, "Dinheiro_Dx", Dinheiro_Dx +500) local Dinheiro_Ladrao_ = tonumber(getElementData(source, "Dinheiro_Ladrao")) or 0 if Dinheiro_Ladrao_ <= 0 then local Dinheiro = tonumber(getElementData(source, "Dinheiro")) or 0 killTimer(Tempo_Roubo[source]) setElementData ( source, "Dinheiro_Ladrao", 0) setElementData ( source, "Dinheiro_Dx", 0) setElementData ( source, "Dinheiro", 0) setElementData ( source, "DNL:Roubando", false) setElementData ( Player, "DNL:Sendo_Roubado", false) setPedAnimation(source) setPedAnimation(Player) setElementData ( Player, "DNL:Roubado_Recentemente", true) setElementData ( source, "DNL:Roubou_Recentemente", true) triggerClientEvent (source, "DNL:Fechar_Roubo_Ladrao", source) triggerClientEvent (Player, "DNL:Fechar_Roubo_Player", Player) Desativar_Roubo_Ladrao[source] = setTimer(function(source) setElementData ( source, "DNL:Roubou_Recentemente", false) triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffVocê já pode efetuar roubos") end, 30000, 1, source) Desativar_Roubo_Player[Player] = setTimer(function(Player) setElementData ( Player, "DNL:Roubado_Recentemente", false) triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffVocê já pode ser roubado novamente, Tome cuidado") end, 60000, 1, Player) triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffVocê Conseguiu Roubar #00FF00R$ #FFFFFF"..tonumber(math.floor(Dinheiro)).." do Jogador #00ff00"..getPlayerName(Player).."") triggerClientEvent(Player, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffFoi roubado de você #00FF00R$ #FFFFFF"..tonumber(math.floor(Dinheiro)).." pelo Jogador #00ff00"..getPlayerName(source).."") end end, 1000, 0, source) else triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffEsse jogador já foi roubado recentemente") end else triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffVocê efetuou um roubo recentemente") end else triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffEsse Jogador já está sendo roubado") end else triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffVocê já está efetuando algum roubo") end else triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffEsse jogador não tem dinheiro para que possa ser roubado") end else triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffO Jogador que você deseja roubar deve está fora do veículo") end else triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffVocê deve sair do veículo para efetuar o roubo") end end end end addEvent ( "DNL:Roubar_Player", true ) addEventHandler ( "DNL:Roubar_Player", root, Roubar_Player) function Roubar_Player_CMD ( source, _, Player_ ) if (Player_) then local playerID = tonumber(Player_) if(playerID) then local Player = getPlayerID(playerID) if isElement(Player) then local cx, cy, cz = getElementPosition ( Player ) local px, py, pz = getElementPosition ( source ) local distance = getDistanceBetweenPoints3D ( cx, cy, cz, px, py, pz ) if ( distance <= 5 ) then if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("painelroubo")) then if rendido[source] then if not getPedOccupiedVehicle(source) then if not getPedOccupiedVehicle(Player) then if getPlayerMoney(Player) >= 500 then if getElementData(source, "DNL:Roubando") == false then if getElementData(Player, "DNL:Sendo_Roubado") == false then if getElementData(source, "DNL:Roubou_Recentemente") == false then if getElementData(Player, "DNL:Roubado_Recentemente") == false then if Player == source then return end Player_Roubado = Player Player_Ladrao = source setPedAnimation( source, "BOMBER", "BOM_Plant_Loop", -1, true, false, false, false) setPedAnimation( Player, "CRACK", "crckidle1", -1, true, false, false, false) setElementData ( Player, "DNL:Sendo_Roubado", true) setElementData ( source, "DNL:Roubando", true) setElementData ( source, "Dinheiro_Ladrao", tonumber(math.floor(getPlayerMoney(Player))/3)) setElementData ( source, "Dinheiro", tonumber(math.floor(getPlayerMoney(Player))/3)) triggerClientEvent (Player, "DNL:Abrir_Roubo_Player", Player, Player_Roubado, Player_Ladrao) triggerClientEvent (source, "DNL:Abrir_Roubo_Ladrao", source) triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffVocê está roubando o jogador "..getPlayerName(Player).."") triggerClientEvent(Player, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffVocê está sendo roubado pelo jogador "..getPlayerName(source).."") Tempo_Roubo[source] = setTimer(function(source) local Dinheiro_Ladrao = tonumber(getElementData(source, "Dinheiro_Ladrao")) or 0 local Dinheiro_Dx = tonumber(getElementData(source, "Dinheiro_Dx")) or 0 givePlayerMoney(source, 500) takePlayerMoney(Player, 500) playSoundFrontEnd (source, 12) playSoundFrontEnd (Player, 12) setElementData ( source, "Dinheiro_Ladrao", Dinheiro_Ladrao -500) setElementData ( source, "Dinheiro_Dx", Dinheiro_Dx +500) local Dinheiro_Ladrao_ = tonumber(getElementData(source, "Dinheiro_Ladrao")) or 0 if Dinheiro_Ladrao_ <= 0 then local Dinheiro = tonumber(getElementData(source, "Dinheiro")) or 0 killTimer(Tempo_Roubo[source]) setElementData ( source, "Dinheiro_Ladrao", 0) setElementData ( source, "Dinheiro_Dx", 0) setElementData ( source, "Dinheiro", 0) setElementData ( source, "DNL:Roubando", false) setElementData ( Player, "DNL:Sendo_Roubado", false) setPedAnimation(source) setPedAnimation(Player) setElementData ( Player, "DNL:Roubado_Recentemente", true) setElementData ( source, "DNL:Roubou_Recentemente", true) triggerClientEvent (source, "DNL:Fechar_Roubo_Ladrao", source) triggerClientEvent (Player, "DNL:Fechar_Roubo_Player", Player) Desativar_Roubo_Ladrao[source] = setTimer(function(source) setElementData ( source, "DNL:Roubou_Recentemente", false) triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffVocê já pode efetuar roubos") end, 30000, 1, source) Desativar_Roubo_Player[Player] = setTimer(function(Player) setElementData ( Player, "DNL:Roubado_Recentemente", false) triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffVocê já pode ser roubado novamente, Tome cuidado") end, 60000, 1, Player) triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffVocê Conseguiu Roubar #00FF00R$ #FFFFFF"..tonumber(math.floor(Dinheiro)).." do Jogador #00ff00"..getPlayerName(Player).."") triggerClientEvent(Player, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffFoi roubado de você #00FF00R$ #FFFFFF"..tonumber(math.floor(Dinheiro)).." pelo Jogador #00ff00"..getPlayerName(source).."") end end, 1000, 0, source) else triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffEsse jogador já foi roubado recentemente") end else triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffVocê efetuou um roubo recentemente") end else triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffEsse Jogador já está sendo roubado") end else triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffVocê já está efetuando algum roubo") end else triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffEsse jogador não tem dinheiro para que possa ser roubado") end else triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffO Jogador que você deseja roubar deve está fora do veículo") end else triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffVocê deve sair do veículo para efetuar o roubo") end else triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffVocê não tem permissão para roubar outros jogadores") end else triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffChegue mais perto do jogador") end else triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffJogador(a) não encontrado") end end end end end addCommandHandler("roubar", Roubar_Player_CMD) --===================================-- ------------ CANCELAR ROUBO ----------- --===================================-- function Cancelar_Roubo (source) if getElementData(Player_Ladrao, "DNL:Roubando") == true then local Dinheiro = tonumber(getElementData(Player_Ladrao, "Dinheiro")) or 0 killTimer(Tempo_Roubo[Player_Ladrao]) setElementData ( Player_Ladrao, "Dinheiro_Ladrao", 0) setElementData ( Player_Ladrao, "Dinheiro_Dx", 0) setElementData ( Player_Ladrao, "Dinheiro", 0) setElementData ( Player_Ladrao, "DNL:Roubando", false) setElementData ( Player_Roubado, "DNL:Sendo_Roubado", false) setPedAnimation(Player_Ladrao) setPedAnimation(Player_Roubado) triggerClientEvent (Player_Ladrao, "DNL:Fechar_Roubo_Ladrao", Player_Ladrao) triggerClientEvent (Player_Roubado, "DNL:Fechar_Roubo_Player", Player_Roubado) triggerClientEvent(Player_Ladrao, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffVocê Cancelou o Assalto") triggerClientEvent(Player_Roubado, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffO Assaltante acabou de te liberar") end end addEvent("DNL:Cancelar_Roubo", true ) addEventHandler("DNL:Cancelar_Roubo", root, Cancelar_Roubo) --===================================-- ----------- MORTE NO ASSALTO ---------- --===================================-- function Morte_Assalto () if getElementData(Player_Ladrao, "DNL:Roubando") == true then local Dinheiro = tonumber(getElementData(Player_Ladrao, "Dinheiro")) or 0 killTimer(Tempo_Roubo[Player_Ladrao]) setElementData ( Player_Ladrao, "Dinheiro_Ladrao", 0) setElementData ( Player_Ladrao, "Dinheiro_Dx", 0) setElementData ( Player_Ladrao, "Dinheiro", 0) setElementData ( Player_Ladrao, "DNL:Roubando", false) setElementData ( Player_Roubado, "DNL:Sendo_Roubado", false) setPedAnimation(Player_Ladrao) setPedAnimation(Player_Roubado) triggerClientEvent (Player_Ladrao, "DNL:Fechar_Roubo_Ladrao", Player_Ladrao) triggerClientEvent (Player_Roubado, "DNL:Fechar_Roubo_Player", Player_Roubado) triggerClientEvent(Player_Ladrao, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffVocê morreu e o assalto foi cancelado") end if getElementData(Player_Roubado, "DNL:Sendo_Roubado") == true then local Dinheiro = tonumber(getElementData(Player_Ladrao, "Dinheiro")) or 0 killTimer(Tempo_Roubo[Player_Ladrao]) setElementData ( Player_Ladrao, "Dinheiro_Ladrao", 0) setElementData ( Player_Ladrao, "Dinheiro_Dx", 0) setElementData ( Player_Ladrao, "Dinheiro", 0) setElementData ( Player_Ladrao, "DNL:Roubando", false) setElementData ( Player_Roubado, "DNL:Sendo_Roubado", false) setPedAnimation(Player_Ladrao) setPedAnimation(Player_Roubado) triggerClientEvent (Player_Ladrao, "DNL:Fechar_Roubo_Ladrao", Player_Ladrao) triggerClientEvent (Player_Roubado, "DNL:Fechar_Roubo_Player", Player_Roubado) triggerClientEvent(Player_Roubado, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffVocê morreu e o assalto foi cancelado") end end addEventHandler( "onPlayerWasted", root, Morte_Assalto) -------------------------------------------------------------------- function getPlayerID(id) v = false for i, player in ipairs (getElementsByType("player")) do if getElementData(player, "ID") == id then v = player break end end return v end --------------------------------------------------------------------
-
Não consegui to colocando algo errado, pode me dizer o que é?
local rendido = { } addCommandHandler("render", function (Player) rendido[player] = true end) addCommandHandler("abaixar", function (Player) rendido[player] = false end) function Roubar_Player_CMD ( source, _, Player_ ) if (Player_) then local playerID = tonumber(Player_) if(playerID) then local Player = getPlayerID(playerID) if isElement(Player) then local cx, cy, cz = getElementPosition ( Player ) local px, py, pz = getElementPosition ( source ) local distance = getDistanceBetweenPoints3D ( cx, cy, cz, px, py, pz ) if ( distance <= 5 ) then if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("painelroubo")) then if rendido[source] then outputChatBox("Jogador Rendido !", source, 255, 255, 255, true) else outputChatBox("Jogador Não Esta Rendido !", source, 255, 255, 255, true) end if not getPedOccupiedVehicle(source) then if not getPedOccupiedVehicle(Player) then if getPlayerMoney(Player) >= 500 then if getElementData(source, "DNL:Roubando") == false then if getElementData(Player, "DNL:Sendo_Roubado") == false then if getElementData(source, "DNL:Roubou_Recentemente") == false then if getElementData(Player, "DNL:Roubado_Recentemente") == false then if Player == source then return end Player_Roubado = Player Player_Ladrao = source setPedAnimation( source, "BOMBER", "BOM_Plant_Loop", -1, true, false, false, false) setPedAnimation( Player, "CRACK", "crckidle1", -1, true, false, false, false) setElementData ( Player, "DNL:Sendo_Roubado", true) setElementData ( source, "DNL:Roubando", true) setElementData ( source, "Dinheiro_Ladrao", tonumber(math.floor(getPlayerMoney(Player))/3)) setElementData ( source, "Dinheiro", tonumber(math.floor(getPlayerMoney(Player))/3)) triggerClientEvent (Player, "DNL:Abrir_Roubo_Player", Player, Player_Roubado, Player_Ladrao) triggerClientEvent (source, "DNL:Abrir_Roubo_Ladrao", source) triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffVocê está roubando o jogador "..getPlayerName(Player).."") triggerClientEvent(Player, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffVocê está sendo roubado pelo jogador "..getPlayerName(source).."") Tempo_Roubo[source] = setTimer(function(source) local Dinheiro_Ladrao = tonumber(getElementData(source, "Dinheiro_Ladrao")) or 0 local Dinheiro_Dx = tonumber(getElementData(source, "Dinheiro_Dx")) or 0 givePlayerMoney(source, 500) takePlayerMoney(Player, 500) playSoundFrontEnd (source, 12) playSoundFrontEnd (Player, 12) setElementData ( source, "Dinheiro_Ladrao", Dinheiro_Ladrao -500) setElementData ( source, "Dinheiro_Dx", Dinheiro_Dx +500) local Dinheiro_Ladrao_ = tonumber(getElementData(source, "Dinheiro_Ladrao")) or 0 if Dinheiro_Ladrao_ <= 0 then local Dinheiro = tonumber(getElementData(source, "Dinheiro")) or 0 killTimer(Tempo_Roubo[source]) setElementData ( source, "Dinheiro_Ladrao", 0) setElementData ( source, "Dinheiro_Dx", 0) setElementData ( source, "Dinheiro", 0) setElementData ( source, "DNL:Roubando", false) setElementData ( Player, "DNL:Sendo_Roubado", false) setPedAnimation(source) setPedAnimation(Player) setElementData ( Player, "DNL:Roubado_Recentemente", true) setElementData ( source, "DNL:Roubou_Recentemente", true) triggerClientEvent (source, "DNL:Fechar_Roubo_Ladrao", source) triggerClientEvent (Player, "DNL:Fechar_Roubo_Player", Player) Desativar_Roubo_Ladrao[source] = setTimer(function(source) setElementData ( source, "DNL:Roubou_Recentemente", false) triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffVocê já pode efetuar roubos") end, 30000, 1, source) Desativar_Roubo_Player[Player] = setTimer(function(Player) setElementData ( Player, "DNL:Roubado_Recentemente", false) triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffVocê já pode ser roubado novamente, Tome cuidado") end, 60000, 1, Player) triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffVocê Conseguiu Roubar #00FF00R$ #FFFFFF"..tonumber(math.floor(Dinheiro)).." do Jogador #00ff00"..getPlayerName(Player).."") triggerClientEvent(Player, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffFoi roubado de você #00FF00R$ #FFFFFF"..tonumber(math.floor(Dinheiro)).." pelo Jogador #00ff00"..getPlayerName(source).."") end end, 1000, 0, source) else triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffEsse jogador já foi roubado recentemente") end else triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffVocê efetuou um roubo recentemente") end else triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffEsse Jogador já está sendo roubado") end else triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffVocê já está efetuando algum roubo") end else triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffEsse jogador não tem dinheiro para que possa ser roubado") end else triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffO Jogador que você deseja roubar deve está fora do veículo") end else triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffVocê deve sair do veículo para efetuar o roubo") end else triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffVocê não tem permissão para roubar outros jogadores") end else triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffChegue mais perto do jogador") end else triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffJogador(a) não encontrado") end end end end addCommandHandler("roubar", Roubar_Player_CMD)
-
13 hours ago, Angelo Pereira said:
--~~> Modo de Fazer [1] - Por Tabela. (ATENÇÃO: Precisa está no mesmo script) local rendido = { } addCommandHandler("render", function (player) rendido[player] = true end) addCommandHandler("abaixar", function (player) rendido[player] = false end) -- na função que faz o roubo, crie uma verificação if rendido[source] then outputChatBox("Jogador Rendido !", source, 255, 255, 255, true) else outputChatBox("Jogador Não Esta Rendido !", source, 255, 255, 255, true) end --~~> Modo de Fazer [2] - Por ElementData. (Não é Necessário Esta no mesmo Resource). addCommandHandler("render", function (player) setElementData(player, "Rendido", true) end) addCommandHandler("abaixar", function (player) setElementData(player, "Rendido", false) end) -- na função que faz o roubo, crie uma verificação local rendido = getElementData(source, "Rendido") or false if rendido then outputChatBox("Jogador Rendido !", source, 255, 255, 255, true) else outputChatBox("Jogador Não Esta Rendido !", source, 255, 255, 255, true) end
cara, cê é god d+! explicou tudinho, vou tentar aqui e volto pra dizer se funcionou, tmj! obg
-
tenho ambos os scripts, de roubar (que vc apenas clica no player, ou digita o id dele)
e o de render, que vc digita no chat /render.
Agora como fazer para o script de roubo, funcionar apenas se o cara estiver com o /render ligado? :V -
16 hours ago, Lord Henry said:
No resource voice, que fica em server\mods\deathmatch\resources\[gameplay], no script cPlayerMuting.Lua, na linha 153, adicione isso:
setSoundVolume (player, 1)
E depois reinicie o resource voice no server.
agora deu certo, tinha um espaço a mais no meu script, arrumei e foi :v valeu cara!
-
34 minutes ago, Lord Henry said:Voltando ao seu tópico. Você pode criar uma table com todos os nomes de ACL Groups que vc quer verificar. No caso as ACL Groups das gangues.
Depois vc passa um loop for por todas elas, verificando se o jogador está em pelo menos uma delas. Se estiver, permite que ele abra o painel de gangues, caso contrário, proíbe o acesso dele ao painel.
Exemplo maroto: (server-side)
local acls = {"PCC", "CV", "MAFIA"} -- Lista de ACL Groups, pode adicionar quantas quiser, separando por vírgula e sempre dentro de aspas duplas. function abrirPainel (thePlayer, cmd) for i, name in ipairs (acls) do -- Para cada item da table acls, faça: if (isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(thePlayer), aclGetGroup (name)) do -- Se o jogador está em alguma ACL Group da lista, então: outputChatBox ("Acesso permitido.", thePlayer, 0, 255, 0) -- Aqui normalmente teria um triggerClientEvent para mostrar o painel no client. return end end outputChatBox ("Acesso negado. Você precisa ser criminoso para usar este painel.", thePlayer, 255, 0, 0) end addCommandHandler ("gang", abrirPainel) -- Comando para abrir o painel, só por exemplo.
Não consegui fazer dar certo, acho que coloquei na linha errada.
function Roubar_Player ( Player ) local acls = {"Gangue01", "Gangue02", "Gangue03"} local cx, cy, cz = getElementPosition ( Player ) local px, py, pz = getElementPosition ( source ) local distance = getDistanceBetweenPoints3D ( cx, cy, cz, px, py, pz ) if ( distance <= 5 ) then for i, name in ipairs (acls) do -- Para cada item da table acls, faça: if (isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(thePlayer), aclGetGroup (name)) do if not getPedOccupiedVehicle(source) then if not getPedOccupiedVehicle(Player) then if getPlayerMoney(Player) >= 100 then if getElementData(source, "DNL:Roubando") == false then if getElementData(Player, "DNL:Sendo_Roubado") == false then if getElementData(source, "DNL:Roubou_Recentemente") == false then if getElementData(Player, "DNL:Roubado_Recentemente") == false then if Player == source then return end Player_Roubado = Player Player_Ladrao = source setPedAnimation( source, "BOMBER", "BOM_Plant_Loop", -1, true, false, false, false) setPedAnimation( Player, "CRACK", "crckidle1", -1, true, false, false, false) setElementData ( Player, "DNL:Sendo_Roubado", true) setElementData ( source, "DNL:Roubando", true) setElementData ( source, "Dinheiro_Ladrao", tonumber(math.floor(getPlayerMoney(Player))/4)) setElementData ( source, "Dinheiro", tonumber(math.floor(getPlayerMoney(Player))/4)) triggerClientEvent (Player, "DNL:Abrir_Roubo_Player", Player, Player_Roubado, Player_Ladrao) triggerClientEvent (source, "DNL:Abrir_Roubo_Ladrao", source) triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffVocê está roubando o jogador "..getPlayerName(Player).."") triggerClientEvent(Player, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffVocê está sendo roubado pelo jogador "..getPlayerName(source).."") Tempo_Roubo[source] = setTimer(function(source) local Dinheiro_Ladrao = tonumber(getElementData(source, "Dinheiro_Ladrao")) or 0 local Dinheiro_Dx = tonumber(getElementData(source, "Dinheiro_Dx")) or 0 givePlayerMoney(source, 100) takePlayerMoney(Player, 100) playSoundFrontEnd (source, 12) playSoundFrontEnd (Player, 12) setElementData ( source, "Dinheiro_Ladrao", Dinheiro_Ladrao -500) setElementData ( source, "Dinheiro_Dx", Dinheiro_Dx +500) local Dinheiro_Ladrao_ = tonumber(getElementData(source, "Dinheiro_Ladrao")) or 0 if Dinheiro_Ladrao_ <= 0 then local Dinheiro = tonumber(getElementData(source, "Dinheiro")) or 0 killTimer(Tempo_Roubo[source]) setElementData ( source, "Dinheiro_Ladrao", 0) setElementData ( source, "Dinheiro_Dx", 0) setElementData ( source, "Dinheiro", 0) setElementData ( source, "DNL:Roubando", false) setElementData ( Player, "DNL:Sendo_Roubado", false) setPedAnimation(source) setPedAnimation(Player) setElementData ( Player, "DNL:Roubado_Recentemente", true) setElementData ( source, "DNL:Roubou_Recentemente", true) triggerClientEvent (source, "DNL:Fechar_Roubo_Ladrao", source) triggerClientEvent (Player, "DNL:Fechar_Roubo_Player", Player) Desativar_Roubo_Ladrao[source] = setTimer(function(source) setElementData ( source, "DNL:Roubou_Recentemente", false) triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffVocê já pode efetuar roubos") end, 30000, 1, source) Desativar_Roubo_Player[Player] = setTimer(function(Player) setElementData ( Player, "DNL:Roubado_Recentemente", false) triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffVocê já pode ser roubado novamente, Tome cuidado") end, 60000, 1, Player) triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffVocê Conseguiu Roubar #00FF00R$ #FFFFFF"..tonumber(math.floor(Dinheiro)).." do Jogador #00ff00"..getPlayerName(Player).."") triggerClientEvent(Player, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffFoi roubado de você #00FF00R$ #FFFFFF"..tonumber(math.floor(Dinheiro)).." pelo Jogador #00ff00"..getPlayerName(source).."") end end, 1000, 0, source) else triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffEsse jogador já foi roubado recentemente") end else triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffVocê efetuou um roubo recentemente") end else triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffEsse Jogador já está sendo roubado") end else triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffVocê já está efetuando algum roubo") end else triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffEsse jogador não tem dinheiro para que possa ser roubado") end else triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffO Jogador que você deseja roubar deve está fora do veículo") end else triggerClientEvent(source, "addNotification", root, "#00ff00✘#ffffffINFO#00ff00✘➺ #ffffffVocê deve sair do veículo para efetuar o roubo") end end end end addEvent ( "DNL:Roubar_Player", true ) addEventHandler ( "DNL:Roubar_Player", root, Roubar_Player)
-
20 minutes ago, Lord Henry said:
No resource voice, que fica em server\mods\deathmatch\resources\[gameplay], no script cPlayerMuting.Lua, na linha 153, adicione isso:
setSoundVolume (player, 1)
E depois reinicie o resource voice no server.
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 --
VOICE in game para players que logam depois de você baixo.
in Programação em Lua
Posted
Funcionou, eu pensei em fazer isso, mas por algum motivo (burrice) eu não consegui desenvolver, valeu