Jump to content

Problema obteniendo el 'killer' - onClientPlayerWasted


Tomas

Recommended Posts

Posted

Hola, tengo un problema obteniendo el killer.

Hice un sistema de medallas con exports y todo, pero ahora solo falta detectar por ejemplo cuando hace un "headshot".

Lo estoy testeando con outputChatBox, pero no logro encontrar como detectar el "killer", si lo uso así con killer lo ven los dos :S

function asd(killer,weapon,bodypart) 
if bodypart == 9 then 
outputChatBox("Has hecho un headshot",killer, 255, 0, 0 ) 
end 
end 
  
addEventHandler ("onClientPlayerWasted", getLocalPlayer(),asd) 
  

  • MTA Team
Posted

Eso es porque 'outputChatBox' Client-Side no tiene argumento de jugador.

outputChatBox ( string text [, int r=231, int g=217, int b=176, bool colorCoded=false ] ) 

Debes usar un trigger Server-Side.

Un ejemplo:

Client:

function asd(killer,weapon,bodypart) 
if bodypart == 9 then 
triggerServerEvent("mostrar",killer) 
end 
end 
addEventHandler ("onClientPlayerWasted", getLocalPlayer(),asd) 

Server:

function me() 
outputChatBox("Has hecho un headshot",source, 255, 0, 0 ) 
end 
addEvent("mostrar",true) 
addEventHandler("mostrar",root,me) 

Saludos!

Posted

Gracias CiBeR, que dudas tan tontas tengo xD

Siempre me confundo con el outputChatBox de que lado es que no tiene argumentos >.<

Gracias! e.e

  • MTA Team
Posted

No pasa nada, todos los días nos cruzamos con este tipo de inconvenientes.

Me alegro haberte ayudado y espero sigas progresando!

  • Recently Browsing   0 members

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