Jump to content

Anti-fuegoamigo


Dokitoh

Recommended Posts

Pega esto dentro de la funcion playerGetDamageDayZ

local migp = getElementData( getLocalPlayer(  ), ( "Group" or "gang" )) 
    local atgp = getElementData( attacker, ( "Group" or "gang" )) 
    if atgp and migp ~= "N/A" then  
        if atgp == migp then return end 
    end 

Link to comment
  Tomas said:
  Dokitoh said:
Me he tomado la libertad de tomarme un ligero descanso, he seguido intentando hacer este script pero sigue sin haber resultado alguno, he conseguido que no me salga ningún error, pero aun así no funciona. Yo creo que tiene bastante que ver el elemento attacker.

Postea el meta

Meta del modo dayz.

  Reveal hidden contents

Meta del script

  Reveal hidden contents
Link to comment
  Gaberiel said:
  El_Zorro said:
Prueba éste
function stopDamageSameTeam ( attacker, weapon, bodypart ) 
    if source and attacker then 
        if source ~= attacker then 
            if isElement(source) and isElement(attacker) then 
                if getElementData (source, "gang") and getElementData (attacker, "gang") then 
                    if getElementData (source, "gang") == getElementData (attacker, "gang") then 
                        cancelEvent() 
                    end 
                end 
            end 
        end 
    end 
end 
addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), stopDamageSameTeam ) 

Es lo mismo.

@Dokitoh sabes si algún elemento tiene un dato?

El elemento gang, tiene los datos del grupo que creas y el elemento attacker no se que datos tiene...

Link to comment
  El_Zorro said:
Prueba éste
function stopDamageSameTeam ( attacker, weapon, bodypart ) 
    if source and attacker then 
        if source ~= attacker then 
            if isElement(source) and isElement(attacker) then 
                if getElementData (source, "gang") and getElementData (attacker, "gang") then 
                    if getElementData (source, "gang") == getElementData (attacker, "gang") then 
                        cancelEvent() 
                    end 
                end 
            end 
        end 
    end 
end 
addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), stopDamageSameTeam ) 

Más de lo mismo no funciona, pero no sale ningún error ni nada.

Link to comment
  starksZ said:
Pega esto dentro de la funcion playerGetDamageDayZ
local migp = getElementData( getLocalPlayer(  ), ( "Group" or "gang" )) 
    local atgp = getElementData( attacker, ( "Group" or "gang" )) 
    if atgp and migp ~= "N/A" then  
        if atgp == migp then return end 
    end 

Probado tambien, sin resultado alguno.

Si cambio el cancelEvent() por return, se me medio buguea y no me termina de cargar completamente el modo dayz.

Link to comment

Os pongo aquí el survivorSystem_client.lua:

  Reveal hidden contents
Link to comment

Vale amigos, he probado con otro tipo de script que no es si no otro que uno de la wiki.

  
function playerDamage_text ( attacker, weapon, bodypart, loss ) --when a player is damaged 
    if ( bodypart == 9 ) then -- if the body part is 9, i.e. the head 
            outputChatBox ( "Headshot!", getRootElement (), 255, 170, 0 ) --output "Headshot" into the chatbox 
        killPed ( source, attacker, weapon, bodypart ) -- and kill the player 
    end 
end 
addEventHandler ( "onPlayerDamage", getRootElement (), playerDamage_text ) 
  

Supuestamente me tiene que salir en el chat, cuando doy un headshot, pero no sale nada, ni error ni nada, cada vez estoy mas convencido de que debe de ser algo con el elemento attacker.

Seguiré investigando a ver si doy con alguna solución.

Link to comment
  El_Zorro said:
Sube la información de tu archivo meta.xml

ya la he subido en algún post anterior, no obstante, te la subo aqui de nuevo.

Esta es la meta del modo:

  Reveal hidden contents

Y esta es la meta del script:

  Reveal hidden contents
Link to comment
  Gaberiel said:
Dentro de esa misma funcion pon esto y fijate si te tira error o si son textos diferentes
outputChatBox(getElementData(source,"gang").. " / "..getElementData(source,"gang")) 

No me tira error, ya se que supuestamente me tendría que salir el gang en el chat, pero no pasa absolutamente nada.

Quizás sea problema del propio evento? aunque esto si que me parece lo menos probable.

Link to comment
  El_Zorro said:
Con quién pruebas el script?, quién te hace daño o te dispara? para comprobarlo?

Un jugador, con el que estoy testeando.

Solemos probar ambas partes, por si tiene algo que ver tener permisos de administrador.

También probamos a matarnos estando sin "gang" y creando posteriormente una "gang".

El resultado es el mismo.

Link to comment

Hola buenas noches compañeros, al fín lo conseguí.

¿Cómo lo hice?

Pues he puesto la función dentro de survivorSystem_client.lua, sustituyendo cancelEvent() por return.

Supongo que me ha funcionado porque he cambiado por completo todo el archivo survirvorSystem_client.lua, asique quiero creer que en ese survivorSystem_client.lua había algo que no cuadraba.

Gracias por vuestra paciencia, un saludo.

Link to comment
  • 3 months later...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...