StanMarsh Posted June 7, 2013 Posted June 7, 2013 Hola, Tengo una duda ase poco no tenia internet y comense a aser un script y ise un laser que lo cambia por la katana y con los sonidos todo eso iva bien pero me llego una duda de como aser que solo la katana al darte en un lugar del cuerpo ej:Torso que te quite toda la vida que tengas. se podria haser eso?
NodZen Posted June 7, 2013 Posted June 7, 2013 Podrias usar algo así function healthP ( attacker, weapon, bodypart, loss ) if getElementType ( attacker ) == "player" and weapon == 8 then killPed ( source ) outputChatBox("Estás muerto...", source, 255, 0, 0, 0, false) end end addEventHandler("onPlayerDamage", getRootElement(), healthP)
StanMarsh Posted June 7, 2013 Author Posted June 7, 2013 Podrias usar algo así function healthP ( attacker, weapon, bodypart, loss ) if getElementType ( attacker ) == "player" and weapon == 8 then killPed ( source ) outputChatBox("Estás muerto...", source, 255, 0, 0, 0, false) end end addEventHandler("onPlayerDamage", getRootElement(), healthP) Serviria Tambien que al atacar a un zombie el zombie muera?
NodZen Posted June 7, 2013 Posted June 7, 2013 Podrias usar algo así function healthP ( attacker, weapon, bodypart, loss ) if getElementType ( attacker ) == "player" and weapon == 8 then killPed ( source ) outputChatBox("Estás muerto...", source, 255, 0, 0, 0, false) end end addEventHandler("onPlayerDamage", getRootElement(), healthP) Serviria Tambien que al atacar a un zombie el zombie muera? No, tendrias que hacér otro. Talvéz con un loop para los peds.
Castillo Posted June 8, 2013 Posted June 8, 2013 Podrias usar algo así function healthP ( attacker, weapon, bodypart, loss ) if getElementType ( attacker ) == "player" and weapon == 8 then killPed ( source ) outputChatBox("Estás muerto...", source, 255, 0, 0, 0, false) end end addEventHandler("onPlayerDamage", getRootElement(), healthP) Serviria Tambien que al atacar a un zombie el zombie muera? No, tendrias que hacér otro. Talvéz con un loop para los peds. Un loop? para que? puede usar "onClientPedDamage".
FraN-724 Posted June 8, 2013 Posted June 8, 2013 No estoy muy seguro de esto, no lo tengo testeado function healthP ( attacker, weapon, bodypart, loss ) if (getElementType( attacker ) == "ped") and weapon == 8 then killPed ( source ) outputChatBox("Estás muerto...", source, 255, 0, 0, false) end end addEventHandler("onClientPedDamage", getRootElement(), healthP)
Castillo Posted June 8, 2013 Posted June 8, 2013 killPed es server side, onClientPedDamage client side.
StanMarsh Posted June 8, 2013 Author Posted June 8, 2013 killPed es server side, onClientPedDamage client side. Entonces que hago?
StanMarsh Posted June 8, 2013 Author Posted June 8, 2013 Usa triggerServerEvent. Pero Como se usa jamas he usado el triggerServerEvent y en la wiki no entendi
Castillo Posted June 8, 2013 Posted June 8, 2013 -- client side: function healthP ( attacker, weapon, bodypart, loss ) if ( attacker and getElementType ( attacker ) == "ped" and weapon == 8 ) then triggerServerEvent ( "killZombie", localPlayer, source ) end end addEventHandler ( "onClientPedDamage", getRootElement(), healthP ) -- server side: addEvent ( "killZombie", true ) addEventHandler ( "killZombie", root, function ( zombie ) killPed ( zombie ) end )
FraN-724 Posted June 8, 2013 Posted June 8, 2013 Oh verdad, no me habia dado cuenta, quizás esto le podria servir ahora enves de mandar trigger function healthP ( attacker, weapon, bodypart, loss ) if (getElementType( attacker ) == "ped") and weapon == 8 then setElementHealth(source, 0) outputChatBox("Estás muerto...", source, 255, 0, 0, false) end end addEventHandler("onClientPedDamage", getRootElement(), healthP)
StanMarsh Posted June 8, 2013 Author Posted June 8, 2013 Oh verdad, no me habia dado cuenta, quizás esto le podria servir ahora enves de mandar trigger function healthP ( attacker, weapon, bodypart, loss ) if (getElementType( attacker ) == "ped") and weapon == 8 then setElementHealth(source, 0) outputChatBox("Estás muerto...", source, 255, 0, 0, false) end end addEventHandler("onClientPedDamage", getRootElement(), healthP) En que lugar esta para ubicar a donde hay que darle al zombi?
StanMarsh Posted June 8, 2013 Author Posted June 8, 2013 Solo tendrías que matarlo con la arma 8 y ya le doy con el arma 8 y no le pasa nada al zombie
StanMarsh Posted June 8, 2013 Author Posted June 8, 2013 Entonces prueba con el script que te dio Solid. Probe y nada :I
FraN-724 Posted June 8, 2013 Posted June 8, 2013 Intenta esto -- Client function healthP ( attacker, weapon, bodypart, loss ) if (getElementType ( attacker ) == "ped" and weapon == 8 ) then triggerServerEvent ( "killZombie", localPlayer, source ) end end addEventHandler ( "onClientPedDamage", getRootElement(), healthP ) -- Server addEvent ( "killZombie", true ) addEventHandler ( "killZombie", root, function ( zombie ) killPed ( zombie ) outputChatBox("Estás muerto...", source, 255, 0, 0, false) end )
Castillo Posted June 8, 2013 Posted June 8, 2013 Entonces prueba con el script que te dio Solid. Probe y nada :I Postea el meta.xml.
Recommended Posts