[email protected] Posted May 11, 2020 Share Posted May 11, 2020 Tô tentando pra colocar pro player que morrer ver quem matou ele, peguei a função e coloquei no DxDrawText"Assasino:" só que não funcionou, alguém pode me ajudar? por favor, sou cru com programação. function playerDamage_text ( attacker, loss ) if not (getElementData(source, "attackerD")) then setElementData(source, "attackerD", "N/A") return end if attacker then if (getElementData(source, "attackerD") == getElementData(attacker, "char:name")) then else setElementData(source, "attackerD", getElementData(attacker, "char:name")) end end end addEventHandler ( "onPlayerDamage", getRootElement (), playerDamage_text ) 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("IMPOSE 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) dxDrawText("Assasino:" "#ffffff:#ff0000"..attackerD, screenW * 0.5400, 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) end Link to comment
Blaack Posted May 11, 2020 Share Posted May 11, 2020 Minha recomendação: server-side; function morreu ( attacker ) if ( attacker ) then triggerClientEvent ( source, "Morreu", source, attacker ) end end addEventHandler ( "onPlayerWasted", getRootElement(), morreu ) client-side; function contador(attacker) 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("IMPOSE 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) dxDrawText("Assasino:" "#ffffff:#ff0000"..attacker, screenW * 0.5400, 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) end addEvent("Morreu",true) addEventHandler("Morreu", getRootElement(), contador) Bom, não testei; Mas tente assim meu querido! 1 Link to comment
[email protected] Posted May 14, 2020 Author Share Posted May 14, 2020 On 11/05/2020 at 10:43, ~#BlackSCR said: Minha recomendação: server-side; function morreu ( attacker ) if ( attacker ) then triggerClientEvent ( source, "Morreu", source, attacker ) end end addEventHandler ( "onPlayerWasted", getRootElement(), morreu ) client-side; function contador(attacker) 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("IMPOSE 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) dxDrawText("Assasino:" "#ffffff:#ff0000"..attacker, screenW * 0.5400, 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) end addEvent("Morreu",true) addEventHandler("Morreu", getRootElement(), contador) Bom, não testei; Mas tente assim meu querido! Irie testar, muito obrigado. Link to comment
[email protected] Posted May 14, 2020 Author Share Posted May 14, 2020 (edited) Olá, boa noite. Eu estou tentando colocar pra quando o player for caido, por outro player, aparecer o id de quem matou. Imagem do erro pelo "debugscript 3" : http://prntscr.com/sge9m3 Client: function playerDamage_text ( attacker, loss ) if not (getElementData(source, "attackerD")) then setElementData(source, "attackerD", "N/A") return end if attacker then if (getElementData(source, "attackerD") == getElementData(attacker, "char:name")) then else setElementData(source, "attackerD", getElementData(attacker, "char:name")) end end end addEventHandler ( "onPlayerDamage", getRootElement (), playerDamage_text ) 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("SISTEMA EMERGÊNCIA IMPOSE", 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) dxDrawText("Assasino:"..attackerD, screenW * 0.5400, 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) end Edited May 14, 2020 by [email protected] Link to comment
neves768 Posted May 14, 2020 Share Posted May 14, 2020 function playerDamage_text ( attacker, loss ) if not (getElementData(source, "attackerD")) then setElementData(source, "attackerD", "N/A") return end if attacker then if (getElementData(source, "attackerD") == getElementData(attacker, "char:name")) then else setElementData(source, "attackerD", getElementData(attacker, "char:name")) end end end addEventHandler ( "onPlayerDamage", getRootElement (), playerDamage_text ) function contador() local timer = interpolateBetween(deadTime, 0, 0, 0, 0, 0, (getTickCount()-tick)/deadTime, "Linear") local minutes, seconds = convertTime(timer) local attackerD = "Desconhecido" if getElementData(localPlayer, "attackerD") then attackerD = getElementData(localPlayer, "attackerD") end 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("SISTEMA EMERGÊNCIA IMPOSE", 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) dxDrawText("Assasino:"..attackerD, screenW * 0.5400, 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) end 1 Link to comment
[email protected] Posted May 14, 2020 Author Share Posted May 14, 2020 Muito obrigado Neves, BlackSCR ! 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