Jump to content

[Ayuda] Cancelar Kill por Knife


Narutimmy

Recommended Posts

Posted

Bueno esa es la duda jeje, lo que pasa es que tengo un slothboth como BOSS, el cual da una recompensa al matarlo pero aonque trae minigun, si llegas con un cuchillo podes matarla facil y rapidamente lo cual pues no tiene chiste, como lo cancelo?

Leyendo en el foro lei que con esto:

PlayerStealthKill

y Alex me dijo que asi pero no me anda :/

addEventHandler("onClientPlayerStealthKill", root, 
  function ( slothbot ) 
   if slothbot == slothbot then 
   cancelEvent() 
  end 
 end 
) 

y Asi lo tengo:

local randomSpawnTable = 
    { 
        { 214.2403717041, 1822.9152, 6.42}, 
        { 245.74766540527, 1867.3031005859, 9 }, 
        { 277.18078613281, 1816.6468505859, 2 }, 
        { 298.40167236328, 1815.8453369141, 4.81 }, 
        { 277.25845336914, 1840.3623046875, 7.83 }, 
         
    } 
     
  
  
function Bot ( ) 
    local random = math.random ( #randomSpawnTable ) 
    local x, y, z = unpack ( randomSpawnTable [ random ] ) 
    slothbot = exports [ "slothbot" ]:spawnBot ( x, y, z, 90, 33, 0, 0, BOSS, 38, hunting, true ) 
    exports.extra_health:setElementExtraHealth ( slothbot, 200000 ) 
    outputChatBox("#ff0000Nemesis: #eeff00S.T.A.R.S!!!", r, g, b, true) 
end 
addEventHandler ( "onResourceStart", resourceRoot, Bot ) 
setTimer(Bot,8000000,0) 

PD: como ago funcionar lo de outputChatBox ya que no sale a color :/

Posted
if slothbot == slothbot then 

Eso no tiene sentido.

AlezSteel me dijo que asi, que pusiera el nombre del slotbot y le pase mi codigo y me dijo que ese era, lo que quiero es que no puedan matar el sloth con cuchillo

Posted
Queres que no puedan matar al bot con el cuchillo?

Exacto tambien aye esto pero nada

addEventHandler("onClientPlayerStealthKill", localPlayer, 
function () 
    if (getPedWeapon(source) == 4) then 
          cancelEvent() 
    end 
end) 

Posted

Espera, me acabo de dar cuenta de algo que me equivoque, si podes usar ese evento.

addEventHandler ( "onClientPlayerStealthKill", localPlayer, 
    function ( target ) 
        if ( getElementData ( target, "slothbot" ) ) then 
            cancelEvent ( ) 
        end 
    end 
) 

Deberia cancelar el stealth kill para los slothbots.

Posted
Espera, me acabo de dar cuenta de algo que me equivoque, si podes usar ese evento.
addEventHandler ( "onClientPlayerStealthKill", localPlayer, 
    function ( target ) 
        if ( getElementData ( target, "slothbot" ) ) then 
            cancelEvent ( ) 
        end 
    end 
) 

Deberia cancelar el stealth kill para los slothbots.

Nop nada, el scrip full es este:

local randomSpawnTable = 
    { 
        { 214.2403717041, 1822.9152, 6.42}, 
        { 245.74766540527, 1867.3031005859, 9 }, 
        { 277.18078613281, 1816.6468505859, 2 }, 
        { 298.40167236328, 1815.8453369141, 4.81 }, 
        { 277.25845336914, 1840.3623046875, 7.83 }, 
         
    } 
     
  
  
function Bot ( ) 
    local random = math.random ( #randomSpawnTable ) 
    local x, y, z = unpack ( randomSpawnTable [ random ] ) 
    slothbot = exports [ "slothbot" ]:spawnBot ( x, y, z, 90, 33, 0, 0, BOSS, 38, hunting, true ) 
    exports.extra_health:setElementExtraHealth ( slothbot, 200000 ) 
    outputChatBox("#ff0000Nemesis: #eeff00S.T.A.R.S!!!", r, g, b, true) 
end 
addEventHandler ( "onResourceStart", resourceRoot, Bot ) 
setTimer(Bot,8000000,0) 
  
  
  
---krauser 
  
local tablaspawn = 
    { 
        { 101.68438720703, 1932.552734375, 33.90}, 
        { 214.21130, 1861.41845, 13.15 }, 
        { 211.6443939209, 1811.0793457031, 21.87 }, 
        { 273.121398, 1855.6353759760, 8.7649 }, 
         
    }    
  
  
function krauser ( ) 
    local random = math.random ( #tablaspawn ) 
    local x, y, z = unpack ( tablaspawn [ random ] ) 
    slothbot = exports [ "slothbot" ]:spawnBot ( x, y, z, 90, 34, 0, 0, BOSS, 4, hunting, true ) 
    exports.extra_health:setElementExtraHealth ( slothbot, 50000 ) 
    outputChatBox("#ff0000Krauser: #eeff00Los Matare a Todos!!!", r, g, b, true) 
end 
addEventHandler ( "onResourceStart", resourceRoot, krauser ) 
setTimer(krauser,500000,0) 
  
setTimer ( destroyElement, 3600000, 0, slothbot) 
---Dinero 
addEvent ( "onBotWasted", true ) 
addEventHandler ( "onBotWasted", root, 
function( theKiller) 
    exports.exp_system:addPlayerEXP ( theKiller, 1000 ) 
    givePlayerMoney ( theKiller, 200000 ) 
    local r,g,b = getPlayerNametagColor ( theKiller ) --get the player's nametag colour 
    local chatterName = getPlayerName ( theKiller ) 
    outputChatBox (  chatterName.." #FF0000ha matado a un BOSS!!! *", getRootElement(), r, g, b, true ) 
end 
) 
  
aaddEventHandler ( "onClientPlayerStealthKill", localPlayer, 
    function ( target ) 
        if ( getElementData ( target, "slothbot" ) ) then 
            cancelEvent ( ) 
        end 
    end 
) 
  
Nemesis = createBlip(214.2403717041,1822.9152,6.42,23,0,0,0,0,0,0,0) 

Posted
1: Pusiste un script client side en un script server side.

2: Pusiste "aaddEventHandler" no "addEventHandler".

Pero que si lo pongo en Client no lo podran ver todos? o entendi mal?

Posted
1: Pusiste un script client side en un script server side.

2: Pusiste "aaddEventHandler" no "addEventHandler".

Gracia ya lo puse en Client y todo bien, lo malo es que no solo lo cancela con los Slothbot, sino contra los usuarios y zombis tambien pero nimodo jeje

Posted
if slothbot == slothbot then 

Creo haberte aclarado que para verificar, debías reemplazar eso por tu slothbot, también editaste bastante lo que te pase inicialmente.

  • Recently Browsing   0 members

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