Arsilex Posted September 2, 2012 Share Posted September 2, 2012 Por que me ataca 1 vez function peds() poli1 = createPed ( 71, 2042.18, 1621.4, 1023.01 ) poli2 = createPed ( 71, 2046.12, 1622.28, 1023.01 ) setElementInterior( poli1, 1 ) setElementDimension( poli1, 15 ) setElementInterior( poli2, 1 ) setElementDimension( poli2, 15 ) setElementRotation(poli1,0, 0, 190) setElementRotation(poli2,0, 0, 180) setPedWeaponSlot ( poli1, ( 2 ) ) setPedWeaponSlot ( poli2, ( 2 ) ) setPedControlState ( poli1, "fire", true ) setPedControlState ( poli2, "fire", true ) end addEventHandler( "onClientResourceStart", getRootElement(), peds ) y tambien como le aga para darle un arma ? Link to comment
Castillo Posted September 2, 2012 Share Posted September 2, 2012 giveWeapon -- Para darle un arma Y para que continue atacando, tenes que hacer un timer para que deje de "disparar" y otro para que "dispare". Link to comment
Arsilex Posted September 2, 2012 Author Share Posted September 2, 2012 si se como darle el arma pero como lo paso de server a client ? Link to comment
Araa Posted September 2, 2012 Share Posted September 2, 2012 si se como darle el arma pero como lo paso de server a client ? addEvent triggerServerEvent Link to comment
Arsilex Posted September 2, 2012 Author Share Posted September 2, 2012 function peds() poli1 = createPed ( 71, 2042.18, 1621.4, 1023.01 ) poli2 = createPed ( 71, 2046.12, 1622.28, 1023.01 ) setElementInterior( poli1, 1 ) setElementDimension( poli1, 15 ) setElementInterior( poli2, 1 ) setElementDimension( poli2, 15 ) setElementRotation(poli1,0, 0, 190) setElementRotation(poli2,0, 0, 180) setPedControlState ( poli1, "fire", true ) setPedControlState ( poli2, "fire", true ) triggerServerEvent ( "Start.Arma", root ) end addEvent( "Start.Ped", true ) addEventHandler( "Start.Ped", root, peds ) function armas() giveWeapon ( poli1, 22, 200 ) giveWeapon ( poli2, 22, 200 ) end addEvent( "Start.Arma", true ) addEventHandler( "Start.Arma", root, armas ) lo hize todo bien creo y no le da el arma Link to comment
NodZen Posted September 2, 2012 Share Posted September 2, 2012 Talvez sea por las 2 funciones iguales... Link to comment
Arsilex Posted September 2, 2012 Author Share Posted September 2, 2012 como que iguales? Link to comment
NodZen Posted September 2, 2012 Share Posted September 2, 2012 addEvent( "Start.Arma", true ) addEventHandler( "Start.Arma", root, armas ) como que iguales? Link to comment
Arsilex Posted September 2, 2012 Author Share Posted September 2, 2012 tu no sabes mucho de scripts eh Eso es un evento creado por mi que se trigea desde el sv para activar los peds despues va otro evento de client a server para dar arma repasarte https://wiki.multitheftauto.com/wiki/TriggerServerEvent https://wiki.multitheftauto.com/wiki/TriggerClientEvent Link to comment
NodZen Posted September 2, 2012 Share Posted September 2, 2012 tu no sabes mucho de scripts eh Eso es un evento creado por mi que se trigea desde el sv para activar los peds despues va otro evento de client a server para dar arma repasarte https://wiki.multitheftauto.com/wiki/TriggerServerEvent https://wiki.multitheftauto.com/wiki/TriggerClientEvent Dije "Talvez" , no que ese era el problema. Link to comment
Araa Posted September 2, 2012 Share Posted September 2, 2012 function peds() poli1 = createPed ( 71, 2042.18, 1621.4, 1023.01 ) poli2 = createPed ( 71, 2046.12, 1622.28, 1023.01 ) setElementInterior( poli1, 1 ) setElementDimension( poli1, 15 ) setElementInterior( poli2, 1 ) setElementDimension( poli2, 15 ) setElementRotation(poli1,0, 0, 190) setElementRotation(poli2,0, 0, 180) setPedControlState ( poli1, "fire", true ) setPedControlState ( poli2, "fire", true ) triggerServerEvent ( "Start.Arma", root, poli1, poli2 ) end addEvent( "Start.Ped", true ) addEventHandler( "Start.Ped", root, peds ) function armas(poli1, poli2) giveWeapon ( poli1, 22, 200 ) giveWeapon ( poli2, 22, 200 ) end addEvent( "Start.Arma", true ) addEventHandler( "Start.Arma", root, armas ) Proba ahora. Link to comment
Arsilex Posted September 2, 2012 Author Share Posted September 2, 2012 eso es lo que me puse alegrab en scripting general y no me funciona ._. Link to comment
Araa Posted September 2, 2012 Share Posted September 2, 2012 eso es lo que me puse alegrab en scripting general y no me funciona ._. Te aparece algo en el debug? Link to comment
Castillo Posted September 2, 2012 Share Posted September 2, 2012 -- server side: function peds ( ) poli1 = createPed ( 71, 2042.18, 1621.4, 1023.01 ) poli2 = createPed ( 71, 2046.12, 1622.28, 1023.01 ) setElementInterior ( poli1, 1 ) setElementDimension ( poli1, 15 ) setElementInterior ( poli2, 1 ) setElementDimension ( poli2, 15 ) setElementRotation ( poli1, 0, 0, 190 ) setElementRotation ( poli2, 0, 0, 180 ) giveWeapon ( poli1, 22, 200 ) giveWeapon ( poli2, 22, 200 ) setElementID ( poli1, "poli1" ) setElementID ( poli2, "poli2" ) triggerClientEvent ( "Start.Arma", root ) end addEvent ( "Start.Ped", true ) addEventHandler ( "Start.Ped", root, peds ) -- client side: addEvent ( "Start.Arma", true ) addEventHandler ( "Start.Arma", root, function ( ) poli1 = getElementByID ( "poli1" ) poli2 = getElementByID ( "poli2" ) setPedControlState ( poli1, "fire", true ) setPedControlState ( poli2, "fire", true ) end ) Link to comment
Arsilex Posted September 2, 2012 Author Share Posted September 2, 2012 me dice que el evento Start.Arma no esta activado osea que no esta en el client Link to comment
Castillo Posted September 2, 2012 Share Posted September 2, 2012 Mostrame como ejecutas: "Start.Ped". Link to comment
Arsilex Posted September 2, 2012 Author Share Posted September 2, 2012 function asdasdasdzxzdxc( thePlayer ) if exports.factions:isPlayerInFactionType ( thePlayer, 5) then setElementFrozen ( thePlayer, true ) setPedAnimation( thePlayer, "bomber", "bom_plant") setTimer ( function () exports.players:giveMoney( thePlayer, 1500 ) outputChatBox ( "Ya tienes el dinero ahora corree!! ", thePlayer, 255, 0, 0 ) destroyElement ( Dinero ) setElementFrozen ( thePlayer, false ) triggerClientEvent ( thePlayer, "Start.Ped", getRootElement() ) setTimer ( restartResource, 3600000, 1, getResourceFromName ( "Move" ) ) end ,6000,1 ) else outputChatBox ( "No eres de la mafia dejale a los profesionales el sitio! ", thePlayer, 255, 0, 0 ) end end addEventHandler( "onMarkerHit", Dinero, asdasdasdzxzdxc ) Link to comment
Castillo Posted September 2, 2012 Share Posted September 2, 2012 function asdasdasdzxzdxc ( thePlayer ) if exports.factions:isPlayerInFactionType ( thePlayer, 5 ) then setElementFrozen ( thePlayer, true ) setPedAnimation ( thePlayer, "bomber", "bom_plant" ) setTimer ( function ( ) exports.players:giveMoney ( thePlayer, 1500 ) outputChatBox ( "Ya tienes el dinero ahora corree!! ", thePlayer, 255, 0, 0 ) destroyElement ( Dinero ) setElementFrozen ( thePlayer, false ) triggerEvent ( "Start.Ped", thePlayer ) setTimer ( restartResource, 3600000, 1, getResourceFromName ( "Move" ) ) end ,6000, 1 ) else outputChatBox ( "No eres de la mafia dejale a los profesionales el sitio! ", thePlayer, 255, 0, 0 ) end end addEventHandler ( "onMarkerHit", Dinero, asdasdasdzxzdxc ) Link to comment
Arsilex Posted September 2, 2012 Author Share Posted September 2, 2012 ok thx voy a ver PD: Como hcer para que un control se repirta varias veces??? Link to comment
Arsilex Posted September 2, 2012 Author Share Posted September 2, 2012 asi addEvent ( "Start.Arma", true ) addEventHandler ( "Start.Arma", getRootElement(), function ( ) poli1 = getElementByID ( "poli1" ) poli2 = getElementByID ( "poli2" ) setPedControlState ( poli1, "aim_weapon", true ) setPedControlState ( poli1, "aim_weapon", true ) setTimer( function () setPedControlState ( poli1, "fire", true ) setPedControlState ( poli2, "fire", true ) end ,600, 0 ) end ) y como les ago para apuntar a un player' Link to comment
Castillo Posted September 2, 2012 Share Posted September 2, 2012 En lugar de preguntar, probalo. Link to comment
Arsilex Posted September 2, 2012 Author Share Posted September 2, 2012 ya lo eh probado pero mira addEvent ( "Start.Arma", true ) addEventHandler ( "Start.Arma", getRootElement(), function ( ) poli1 = getElementByID ( "poli1" ) poli2 = getElementByID ( "poli2" ) setTimer ( function() setPedControlState ( poli1, "fire", true ) setPedControlState ( poli2, "fire", true ) end, 600, 0 ) setTimer ( function() setPedControlState ( poli1, "fire", false ) setPedControlState ( poli2, "fire", false ) end, 1000, 0 ) end ) Y lo que haces es dispara 1 vez y las siguentes veces para de disparar y no dispara mas osea hace la animacion pero no dispara Link to comment
Recommended Posts