nelsonjrr23 Posted July 23, 2014 Share Posted July 23, 2014 oi, eu estava a tentar criar este seguinte script. Mas ainda sou iniciante em script ... Ja tentei varias formas e atualmente estou com esta.. O objetivo era o Ped1 ficar a disparar para uma tal posição. (238.79436, 1863.61792, 20.07644) Se me poderem ajudar .. --Client side-- Ped1 = createPed(0, -56.77341, 2083.91870, 33.67812) setElementDimension(Ped1,10) setPedControlState(Ped1,"fire",true) setPedControlState(Ped1,"aim_weapon",true) triggerServerEvent ( "ondararma", resourceRoot, "" ) setPedAimTarget(Ped1, 238.79436, 1863.61792, 20.07644) function cancelPedDamage1() cancelEvent() end addEventHandler("onClientPedDamage", Ped1, cancelPedDamage1) --Server side-- function armaped() setTimer( giveWeapon, 100, 1, Ped1, 31, 900, true) end addEvent( "ondararma", true ) addEventHandler( "ondararma", resourceRoot, armaped) Link to comment
manawydan Posted July 23, 2014 Share Posted July 23, 2014 tente ai parsa --Client side-- Ped1 = createPed(0, -56.77341, 2083.91870, 33.67812) setElementDimension(Ped1,10) setPedControlState(Ped1,"fire",true) --setPedControlState(Ped1,"aim_weapon",true) triggerServerEvent ( "ondararma", resourceRoot, Ped1 ) setPedAimTarget(Ped1, 238.79436, 1863.61792, 20.07644) function cancelPedDamage1() cancelEvent() end addEventHandler("onClientPedDamage", Ped1, cancelPedDamage1) --server function armaped(ped) setTimer( giveWeapon, 100, 1, ped, 31, 900, true) end addEvent( "ondararma", true ) addEventHandler( "ondararma", resourceRoot, armaped) Link to comment
nelsonjrr23 Posted July 24, 2014 Author Share Posted July 24, 2014 Eu testei mas o ped não recebeu a arma .. Apenas deu 1 pequeno movimento Link to comment
manawydan Posted July 24, 2014 Share Posted July 24, 2014 ok tente denovo --Client side-- local Ped1 = createPed(0, -56.77341, 2083.91870, 33.67812) setElementDimension(Ped1,10) setPedControlState(Ped1,"fire",true) triggerServerEvent ("ondararma", resourceRoot, Ped1 ) setPedAimTarget(Ped1, 238.79436, 1863.61792, 20.07644) function cancelPedDamage1() cancelEvent() end addEventHandler("onClientPedDamage", Ped1, cancelPedDamage1) --server function armaped(ped) giveWeapon(ped, 31, 900, true) end addEvent( "ondararma", true ) addEventHandler( "ondararma", resourceRoot, armaped) Link to comment
nelsonjrr23 Posted July 24, 2014 Author Share Posted July 24, 2014 Quando inicio o script continua fazendo apenas 1 movimento ( de 1 soco) e nao recebe a arma . Link to comment
DNL291 Posted July 24, 2014 Share Posted July 24, 2014 Tenta criando o ped no lado server. Tente isto: Client addEventHandler( "onClientResourceStart", resourceRoot, function() triggerServerEvent("onClientCall", resourceRoot) end ) addEvent("doPedAttack", true) addEventHandler( "doPedAttack", root, function (thePed) setPedControlState(thePed,"fire",true) setPedAimTarget(thePed, 238.79436, 1863.61792, 20.07644) end ) addEventHandler( "onClientElementDataChange", root, function (dataName, oldValue) if (dataName == "cancelPedDamage") then local ped = getElementData(source, "cancelPedDamage") addEventHandler("onClientPedDamage", ped, cancelEvent) end end ) Server function createThePed() local Ped1 = createPed(0, -56.77341, 2083.91870, 33.67812) setElementDimension(Ped1,10) setElementData(Ped1, "cancelPedDamage", Ped1) giveWeapon(Ped1, 31, 900, true) triggerClientEvent(root, "doPedAttack", Ped1) end addEvent( "onClientCall", true ) addEventHandler( "onClientCall", root, createThePed) Link to comment
nelsonjrr23 Posted July 24, 2014 Author Share Posted July 24, 2014 Testei, e o Ped recebeu a arma mas não Dispara no debugscript deu bad argument no setPedControlState e no setPedAimTarget. Podia me ajudar a colocar o Ped a disparar sozinho ? Link to comment
DNL291 Posted July 25, 2014 Share Posted July 25, 2014 Porque eu passei o ped como fonte do evento e não como um argumento. Tente isto: addEventHandler( "onClientResourceStart", resourceRoot, function() triggerServerEvent("onClientCall", resourceRoot) end ) addEvent("doPedAttack", true) addEventHandler( "doPedAttack", root, function() setPedControlState(source,"fire",true) setPedAimTarget(source, 238.79436, 1863.61792, 20.07644) end ) addEventHandler( "onClientElementDataChange", root, function (dataName, oldValue) if (dataName == "cancelPedDamage") then local ped = getElementData(source, "cancelPedDamage") addEventHandler("onClientPedDamage", ped, cancelEvent) end end ) Link to comment
nelsonjrr23 Posted July 25, 2014 Author Share Posted July 25, 2014 Agora sim deu. Muito obrigado DNL.. pode me so exclarecer umas duvidas.. Ele agora epenas da 1 tiro e depois fica a fazer um movimento como se continuaçe.. Porque acontece isto ? Link to comment
nelsonjrr23 Posted July 26, 2014 Author Share Posted July 26, 2014 Bem o que eu estava a dizer é que o PED dispara normalmente na dimensao 0 so que na 10 ele apenas da 1 tiro e depois so faz a animação .. É possivel resolver isso ? Link to comment
DNL291 Posted July 27, 2014 Share Posted July 27, 2014 Tente usando o recurso slothbot: https://community.multitheftauto.com/?p=resources ... ils&id=672 Link to comment
DNL291 Posted July 29, 2014 Share Posted July 29, 2014 Vai ser mais fácil pra você usar esse recurso do que criar o script. Aqui você pode aprender a usar todas funções e eventos disponíveis: https://wiki.multitheftauto.com/wiki/Slothman/Slothbot Link to comment
SchmidtNeO Posted May 30, 2019 Share Posted May 30, 2019 desculpa reviver este topico, mas o meta desse script ficaria como Link to comment
Other Languages Moderators Lord Henry Posted May 30, 2019 Other Languages Moderators Share Posted May 30, 2019 (edited) @SchmidtNeO saiba mais sobre o meta.xml na Wiki. Já respondi seu outro tópico lá. Edited May 30, 2019 by Lord Henry Link to comment
SchmidtNeO Posted May 30, 2019 Share Posted May 30, 2019 Just now, Lord Henry said: @SchmidtNeO saiba mais sobre o meta.xml na Wiki. voce pode responder o topico que acabei de criar lord ? Link to comment
DNL291 Posted May 30, 2019 Share Posted May 30, 2019 On 24/07/2014 at 02:12, DNL291 said: Server function createThePed() local Ped1 = createPed(0, -56.77341, 2083.91870, 33.67812) setElementDimension(Ped1,10) setElementData(Ped1, "cancelPedDamage", Ped1) giveWeapon(Ped1, 31, 900, true) triggerClientEvent(root, "doPedAttack", Ped1) end addEvent( "onClientCall", true ) addEventHandler( "onClientCall", root, createThePed) Client: On 25/07/2014 at 04:08, DNL291 said: addEventHandler( "onClientResourceStart", resourceRoot, function() triggerServerEvent("onClientCall", resourceRoot) end ) addEvent("doPedAttack", true) addEventHandler( "doPedAttack", root, function() setPedControlState(source,"fire",true) setPedAimTarget(source, 238.79436, 1863.61792, 20.07644) end ) addEventHandler( "onClientElementDataChange", root, function (dataName, oldValue) if (dataName == "cancelPedDamage") then local ped = getElementData(source, "cancelPedDamage") addEventHandler("onClientPedDamage", ped, cancelEvent) end end ) No meta vai esses dois, o server e o client. 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