Narutimmy Posted January 11, 2013 Posted January 11, 2013 Hola, me preguntaba.... como puedo hacer que un slothbot tenga cosas como superfuerza para que mate de 1 golpe? y que ademas sea muy rapido? mtasa://66.85.14.178:22003 Ts3: thezombiworld.com:7777
NodZen Posted January 11, 2013 Posted January 11, 2013 bueno para eso tienes que usar getElementType o getElementData para saber quién te atacó. y luego usar setElementHealth . ------------------------------------------------------------------------------------------ My scripts http://community.multitheftauto.com/index.php?p=resources&s=details&id=6977 http://community.multitheftauto.com/index.php?p=resources&s=details&id=7740
Narutimmy Posted January 11, 2013 Author Posted January 11, 2013 bueno para eso tienes que usar getElementType o getElementData para saber quién te atacó. y luego usar setElementHealth . SV: --KILL FROM Tyrant ATTACK addEvent( "playereaten2", true ) function Playerinfected2 ( player, attacker, weapon, bodypart) killPed ( player, attacker, weapon, bodypart ) end addEventHandler( "playereaten2", getRootElement(), Playerinfected2 ) Cl: --Matar Tyrant function tirantattack ( attacker, weapon, bodypart ) if (attacker) then if getElementType ( attacker ) == "ped" then if (getElementData (attacker, "tyrant") == true) then local playerHealth = getElementHealth ( getLocalPlayer() ) if playerHealth > 15 then setElementHealth ( source, playerHealth - 500 ) else triggerServerEvent ("playereaten2", source, source, attacker, weapon, bodypart ) end end end end end addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), tirantattack ) mtasa://66.85.14.178:22003 Ts3: thezombiworld.com:7777
NodZen Posted January 11, 2013 Posted January 11, 2013 Y que pasa con eso? Te funciono?. ------------------------------------------------------------------------------------------ My scripts http://community.multitheftauto.com/index.php?p=resources&s=details&id=6977 http://community.multitheftauto.com/index.php?p=resources&s=details&id=7740
Narutimmy Posted January 11, 2013 Author Posted January 11, 2013 Y que pasa con eso? Te funciono?. lo intnte pero no funciono, que ise mal? mtasa://66.85.14.178:22003 Ts3: thezombiworld.com:7777
NodZen Posted January 11, 2013 Posted January 11, 2013 Que quieres hacer exactamente? Que cuando un slothBot te toque , te quite mas vida de lo normal? ------------------------------------------------------------------------------------------ My scripts http://community.multitheftauto.com/index.php?p=resources&s=details&id=6977 http://community.multitheftauto.com/index.php?p=resources&s=details&id=7740
Narutimmy Posted January 11, 2013 Author Posted January 11, 2013 Que quieres hacer exactamente? Que cuando un slothBot te toque , te quite mas vida de lo normal? si que con 1 golpe te deje en 0 y mueras. mtasa://66.85.14.178:22003 Ts3: thezombiworld.com:7777
NodZen Posted January 11, 2013 Posted January 11, 2013 Probalo asi , no se si funcionara porque lo hice asi nomas local gMe = getLocalPlayer() function bot ( attacker ) if ( getElementType ( attacker ) == "ped" ) then local vida = getElementHealth(gMe) if ( vida >= 0 ) then killPed ( source ) end end end addEventHandler("onPlayerDamage", getRootElement(), bot) Ponelo como server. ------------------------------------------------------------------------------------------ My scripts http://community.multitheftauto.com/index.php?p=resources&s=details&id=6977 http://community.multitheftauto.com/index.php?p=resources&s=details&id=7740
Narutimmy Posted January 11, 2013 Author Posted January 11, 2013 Probalo asi , no se si funcionara porque lo hice asi nomas local gMe = getLocalPlayer() function bot ( attacker ) if ( getElementType ( attacker ) == "ped" ) then local vida = getElementHealth(gMe) if ( vida >= 0 ) then killPed ( source ) end end end addEventHandler("onPlayerDamage", getRootElement(), bot) Ponelo como server. 2 cosas, borro lo anterior y es para el slothbot nadamas verdad? mtasa://66.85.14.178:22003 Ts3: thezombiworld.com:7777
NodZen Posted January 11, 2013 Posted January 11, 2013 Que borras? El slothBot es solo un ped. ------------------------------------------------------------------------------------------ My scripts http://community.multitheftauto.com/index.php?p=resources&s=details&id=6977 http://community.multitheftauto.com/index.php?p=resources&s=details&id=7740
Narutimmy Posted January 11, 2013 Author Posted January 11, 2013 Que borras? El slothBot es solo un ped. que si borro el scrip que habia echo y dejo solo el tuyo? mtasa://66.85.14.178:22003 Ts3: thezombiworld.com:7777
NodZen Posted January 11, 2013 Posted January 11, 2013 Pues Si. ------------------------------------------------------------------------------------------ My scripts http://community.multitheftauto.com/index.php?p=resources&s=details&id=6977 http://community.multitheftauto.com/index.php?p=resources&s=details&id=7740
Narutimmy Posted January 12, 2013 Author Posted January 12, 2013 Pues Si. No Funciono, este es el scrip que uso para el BOSS --Tyrant local colshape = createColRectangle ( 88.4608, 1779.9825, 400, 400 ) zombiesMatados = 0 function zona2 ( ) if ( isElementWithinColShape ( source, colshape ) ) then zombiesMatados = ( zombiesMatados + 1 ) if ( zombiesMatados == 1 ) then -- ACA DONDE DICE =1 pone la cantidad de zombies que tienen que matar para que aparesca if ( not isElement ( tyrant ) ) then tyrant = exports [ "slothbot" ]:spawnBot ( 249.1348, 1820.0046, 9, 90, 146, 0, 0, ex, 0, "hunting", true ) exports.extra_health:setElementExtraHealth ( tyrant, 20000 ) setGameSpeed ( tyrant, 5) outputChatBox ( "#ff0000Tyrant a Spawneado, Corre!", getRootElement(), 255, 255, 255, true ) onZomieWasted = 75 myBlip = createBlipAttachedTo ( tyrant, 23 ) end end end end addEvent ( "onZombieWasted", true ) addEventHandler ( "onZombieWasted", getRootElement(), zona2 ) local gMe = getLocalPlayer() ---mata function bot ( attacker ) if ( getElementType ( attacker ) == "ped" ) then local vida = getElementHealth(gMe) if ( vida >= 0 ) then killPed ( source ) end end end addEventHandler("onPlayerDamage", getRootElement(), bot) mtasa://66.85.14.178:22003 Ts3: thezombiworld.com:7777
NodZen Posted January 12, 2013 Posted January 12, 2013 Poro te dice algo el debug script?. Probalo asi. function bot ( attacker ) if ( getElementType ( attacker ) == "ped" ) and ( getElementModel ( attacker ) == "el ID" ) then -- si no sirve ped probale tyrant. killPed(source) end end addEventHandler("onPlayerDamage", getRootElement(), bot) ------------------------------------------------------------------------------------------ My scripts http://community.multitheftauto.com/index.php?p=resources&s=details&id=6977 http://community.multitheftauto.com/index.php?p=resources&s=details&id=7740
Alexs Posted January 12, 2013 Posted January 12, 2013 @NOD getElementModel devuelve un int, no un string. local gMe = getLocalPlayer() function bot ( attacker ) if ( getElementType ( attacker ) == "ped" ) then local vida = getElementHealth(gMe) if ( vida >= 0 ) then killPed ( source ) end end end addEventHandler("onPlayerDamage", getRootElement(), bot) onPlayerDamage es server, killPed es server pero getLocalPlayer es client. y para no parecer criticon: function bot ( attacker ) if attacker == tyrant then --Creo que 'tyrant' es la variable de tu 'BOSS' killPed ( source, attacker ) end end addEventHandler("onPlayerDamage", getRootElement(), bot) PD: Si te da errores cuando un jugador se daña sin atacante, ponle una linea extra comprobando que si haya uno. Developer @ MYVAL
Narutimmy Posted January 12, 2013 Author Posted January 12, 2013 @NOD getElementModel devuelve un int, no un string. local gMe = getLocalPlayer() function bot ( attacker ) if ( getElementType ( attacker ) == "ped" ) then local vida = getElementHealth(gMe) if ( vida >= 0 ) then killPed ( source ) end end end addEventHandler("onPlayerDamage", getRootElement(), bot) onPlayerDamage es server, killPed es server pero getLocalPlayer es client. y para no parecer criticon: function bot ( attacker ) if attacker == tyrant then --Creo que 'tyrant' es la variable de tu 'BOSS' killPed ( source, attacker ) end end addEventHandler("onPlayerDamage", getRootElement(), bot) PD: Si te da errores cuando un jugador se daña sin atacante, ponle una linea extra comprobando que si haya uno. error call local player algo asi sale en el debug mtasa://66.85.14.178:22003 Ts3: thezombiworld.com:7777
Alexs Posted January 12, 2013 Posted January 12, 2013 Deberás ser mas especifico para saber cual es el error. Aunque quizá diga algo como: 'ERROR: cal global 'getLocalPlayer' a nil value' o algo así, eso es por usar una función en el lado incorrecto. Si es así entonces pusiste mal mi código, el caso era que borraras lo de @NOD y dejaras solo mi código y el tuyo: --Tyrant local colshape = createColRectangle ( 88.4608, 1779.9825, 400, 400 ) zombiesMatados = 0 function zona2 ( ) if ( isElementWithinColShape ( source, colshape ) ) then zombiesMatados = ( zombiesMatados + 1 ) if ( zombiesMatados == 1 ) then -- ACA DONDE DICE =1 pone la cantidad de zombies que tienen que matar para que aparesca if ( not isElement ( tyrant ) ) then tyrant = exports [ "slothbot" ]:spawnBot ( 249.1348, 1820.0046, 9, 90, 146, 0, 0, ex, 0, "hunting", true ) exports.extra_health:setElementExtraHealth ( tyrant, 20000 ) setGameSpeed ( tyrant, 5) outputChatBox ( "#ff0000Tyrant a Spawneado, Corre!", getRootElement(), 255, 255, 255, true ) onZomieWasted = 75 myBlip = createBlipAttachedTo ( tyrant, 23 ) end end end end addEvent ( "onZombieWasted", true ) addEventHandler ( "onZombieWasted", getRootElement(), zona2 ) function bot ( attacker ) if attacker == tyrant then --Creo que 'tyrant' es la variable de tu 'BOSS' killPed ( source, attacker ) end end addEventHandler("onPlayerDamage", getRootElement(), bot) Developer @ MYVAL
NodZen Posted January 12, 2013 Posted January 12, 2013 @Alexs Lo que Yo puse no era un string "el id" , era para que ponga el ID del skin del SlothBot, porque no me acordaba los argumentos de dicho resource. ------------------------------------------------------------------------------------------ My scripts http://community.multitheftauto.com/index.php?p=resources&s=details&id=6977 http://community.multitheftauto.com/index.php?p=resources&s=details&id=7740
Alexs Posted January 12, 2013 Posted January 12, 2013 @NOD Ok, lo entiendo, es que como pusiste 'el ID' pensé que podías hacer confundido con getElementID. Developer @ MYVAL
Narutimmy Posted January 12, 2013 Author Posted January 12, 2013 Deberás ser mas especifico para saber cual es el error.Aunque quizá diga algo como: 'ERROR: cal global 'getLocalPlayer' a nil value' o algo así, eso es por usar una función en el lado incorrecto. Si es así entonces pusiste mal mi código, el caso era que borraras lo de @NOD y dejaras solo mi código y el tuyo: --Tyrant local colshape = createColRectangle ( 88.4608, 1779.9825, 400, 400 ) zombiesMatados = 0 function zona2 ( ) if ( isElementWithinColShape ( source, colshape ) ) then zombiesMatados = ( zombiesMatados + 1 ) if ( zombiesMatados == 1 ) then -- ACA DONDE DICE =1 pone la cantidad de zombies que tienen que matar para que aparesca if ( not isElement ( tyrant ) ) then tyrant = exports [ "slothbot" ]:spawnBot ( 249.1348, 1820.0046, 9, 90, 146, 0, 0, ex, 0, "hunting", true ) exports.extra_health:setElementExtraHealth ( tyrant, 20000 ) setGameSpeed ( tyrant, 5) outputChatBox ( "#ff0000Tyrant a Spawneado, Corre!", getRootElement(), 255, 255, 255, true ) onZomieWasted = 75 myBlip = createBlipAttachedTo ( tyrant, 23 ) end end end end addEvent ( "onZombieWasted", true ) addEventHandler ( "onZombieWasted", getRootElement(), zona2 ) function bot ( attacker ) if attacker == tyrant then --Creo que 'tyrant' es la variable de tu 'BOSS' killPed ( source, attacker ) end end addEventHandler("onPlayerDamage", getRootElement(), bot) Si es justo ese error. mtasa://66.85.14.178:22003 Ts3: thezombiworld.com:7777
Alexs Posted January 12, 2013 Posted January 12, 2013 Si, justo lo que pensaba, intenta con el código como te lo deje. Developer @ MYVAL
Narutimmy Posted January 12, 2013 Author Posted January 12, 2013 Si, justo lo que pensaba, intenta con el código como te lo deje. Ya mata de 1 solo Golpe, el problema es que en ocaciones los usuarios mueren sin razon, salde junto a el y mori. mtasa://66.85.14.178:22003 Ts3: thezombiworld.com:7777
NodZen Posted January 12, 2013 Posted January 12, 2013 Que raro, porque la unica manera de que el player muera ( en este script ) es que el SlothBot te toque. ------------------------------------------------------------------------------------------ My scripts http://community.multitheftauto.com/index.php?p=resources&s=details&id=6977 http://community.multitheftauto.com/index.php?p=resources&s=details&id=7740
Narutimmy Posted January 12, 2013 Author Posted January 12, 2013 Que raro, porque la unica manera de que el player muera ( en este script ) es que el SlothBot te toque. Si en ocaciones si saltas cercas del el mueres. mtasa://66.85.14.178:22003 Ts3: thezombiworld.com:7777
Recommended Posts