Jump to content

setElementData


Plate

Recommended Posts

Hola necesito una ayuda con este script es que me da error en el setElementData

el codigo

local colshape = createColRectangle ( 103.88594818115, 1302.0729980469, 220, 200 )  
zombiesMatados = 0 
function zona ( ) 
    if ( isElementWithinColShape ( source, colshape ) ) then 
               zombiesMatados = ( zombiesMatados + 1 ) 
             if ( zombiesMatados == 3 ) then 
            if ( not isElement ( slothbot1 ) ) then 
           slothbot1 = exports [ "slothbot" ]:spawnBot ( 111.79273223877, 1336.3046875, 10.5859375, 90, math.random(300, 302), 0, 0, ex, 38, "hunting", true ) 
          exports.extra_health:setElementExtraHealth(slothbot1, 3000) 
          myBlip = createBlipAttachedTo ( slothbot1, 23 ) 
          triggerClientEvent("spawneo", getRootElement(), slothbot1) 
       end 
    end 
 end 
end 
addEventHandler ( "onZombieWasted", getRootElement(), zona ) 
addEventHandler("onBotSpawn",getRootElement(),zona) 
function restartear ( ) 
    if ( isElementWithinColShape ( source, colshape ) ) then 
        zombiesMatados = 0 
   end 
end 
addEvent ( "onBotWasted", true ) 
addEventHandler ( "onBotWasted",getRootElement(), restartear ) 
function start() 
setElementData(colshape, "High", true) 
outputChatBox("La zona del boss esta en High", getRootElement(), 255, 0, 0) 
end 
addEventHandler("onResourceStart", getRootElement(), start) 
function grabe() 
if getElementData(colshape, "High") then 
setElementData(colshape, "Medium", true) 
if getElementData(colshape, "Medium") then 
setElementData(colshape, "Slow", true) 
end 
end 
end 
addEventHandler("onBotWasted", getRootElement(), grabe) 
  
function destro() 
destroyElement(myBlip) 
end 
addEventHandler("onBotWasted", getRootElement(), destro) 
function inf() 
if getElementData(colshape, "High") then 
outputChatBox("[bOSS]: Boss High Spawned", getRootElement(), 255, 0, 0) 
if getElementData(colshape, "Medium") then 
outputChatBox("[bOSS]: Boss Medium Spawned", getRootElement(), 0, 255, 0) 
if getElementData(colshape, "Slow") then 
outputChatBox("[bOSS]: Boss Slow Spawned", getRootElement(), 100, 255, 100) 
end 
end 
end 
end 
addEventHandler("onBotSpawn", getRootElement(), inf) 

o asi? ( en el setElementData)

setElementData(colshape, "zona", "High", true) 

Link to comment
local colshape = createColRectangle ( 103.88594818115, 1302.0729980469, 220, 200 ) 
zombiesMatados = 0 
function zona ( ) 
    if ( isElementWithinColShape ( source, colshape ) ) then 
               zombiesMatados = ( zombiesMatados + 1 ) 
             if ( zombiesMatados == 3 ) then 
            if ( not isElement ( slothbot1 ) ) then 
           slothbot1 = exports [ "slothbot" ]:spawnBot ( 111.79273223877, 1336.3046875, 10.5859375, 90, math.random(300, 302), 0, 0, ex, 38, "hunting", true ) 
          exports.extra_health:setElementExtraHealth(slothbot1, 3000) 
          myBlip = createBlipAttachedTo ( slothbot1, 23 ) 
          triggerClientEvent("spawneo", getRootElement(), slothbot1) 
       end 
    end 
 end 
end 
  
addEventHandler ( "onZombieWasted", getRootElement(), zona ) 
addEventHandler("onBotSpawn",getRootElement(),zona) 
function restartear ( ) 
    if ( isElementWithinColShape ( source, colshape ) ) then 
        zombiesMatados = 0 
    end 
end 
  
addEvent ( "onBotWasted", true ) 
addEventHandler ( "onBotWasted",getRootElement(), restartear ) 
function start() 
    setElementData(colshape, "High", true) 
    outputChatBox("La zona del boss esta en High", getRootElement(), 255, 0, 0) 
end 
addEventHandler("onResourceStart", getRootElement(), start) 
  
function grabe() 
    if getElementData(colshape, "High") then 
        setElementData(colshape, "Medium", true) 
    elseif getElementData(colshape, "Medium") then 
        setElementData(colshape, "Slow", true) 
    end 
end 
addEventHandler("onBotWasted", getRootElement(), grabe) 
  
function destro() 
destroyElement(myBlip) 
end 
addEventHandler("onBotWasted", getRootElement(), destro) 
  
function inf() 
    if getElementData(colshape, "High") then 
        outputChatBox("[bOSS]: Boss High Spawned", getRootElement(), 255, 0, 0) 
    elseif getElementData(colshape, "Medium") then 
        outputChatBox("[bOSS]: Boss Medium Spawned", getRootElement(), 0, 255, 0) 
    elseif getElementData(colshape, "Slow") then 
        outputChatBox("[bOSS]: Boss Slow Spawned", getRootElement(), 100, 255, 100) 
    end 
end 
addEventHandler("onBotSpawn", getRootElement(), inf) 

PD: Te sugiero aprender un poco el uso de

if, elseif, else 

Ademas de eso veo muchos errores mas en tus eventos y la verdad no entiendo que intenta hacer.. por que esto no tiene sentido

Link to comment
  • Recently Browsing   0 members

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