• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Loop | TFS 0.4

Hernest

New Member
Joined
Jul 26, 2010
Messages
152
Reaction score
3
Location
poland
Code:
function onSay(cid, words, param)
    monsterarena = param
    local aret = monsterarena
    doSendMagicEffect(getPlayerPosition(cid), CONST_ME_YELLOW_RINGS)
    if monsterarena == "pandora" then
        local aret = "husky"
        doCreatureSay(cid, "Pandora is not allowed!", TALKTYPE_ORANGE_1)
        doCreatureSay(cid, "Changed to husky!", TALKTYPE_ORANGE_1)
        print(monsterarena)
    elseif monsterarena == "ice demon" then
        local aret = "husky"
        doCreatureSay(cid, "Ice Demon is not allowed!", TALKTYPE_ORANGE_1)
        doCreatureSay(cid, "Changed to husky!", TALKTYPE_ORANGE_1)
        print(monsterarena)
    elseif monsterarena == "ice guard" then
      local aret = "husky"
        doCreatureSay(cid, "Ice Guard is not allowed!", TALKTYPE_ORANGE_1)
        doCreatureSay(cid, "Changed to husky!", TALKTYPE_ORANGE_1)
        print(monsterarena)
    elseif monsterarena == "black hero" then
        local aret = "husky"
        doCreatureSay(cid, "Black Hero is not allowed!", TALKTYPE_ORANGE_1)
        doCreatureSay(cid, "Changed to husky!", TALKTYPE_ORANGE_1)
        print(monsterarena)
    elseif monsterarena == "gorlic" then
        local aret = "husky"
        doCreatureSay(cid, "Gorlic is not allowed!", TALKTYPE_ORANGE_1)
        doCreatureSay(cid, "Changed to husky!", TALKTYPE_ORANGE_1)
        print(monsterarena)
    elseif monsterarena == "grim" then
        monsterarena = "husky"
        doCreatureSay(cid, "Grim is not allowed!", TALKTYPE_ORANGE_1)
        doCreatureSay(cid, "Changed to husky!", TALKTYPE_ORANGE_1)
        print(monsterarena)
    else
        doCreatureSay(cid, "You choose: " .. aret .. ".", TALKTYPE_ORANGE_1)
    end
       
end

I am not sure how to create good loop for not allowed monsters, tryied 2 times but always did not work, without any error in logs.
 
Code:
local m = {"pandora", "ice demon", "ice guard", "black hero", "gorlic", "grim"}

if isInArray(m, monsterarena) then
  local aret = "husky"
  doCreatureSay(cid, monsterarena.." is not allowed!", TALKTYPE_ORANGE_1)
  doCreatureSay(cid, "Changed to husky!", TALKTYPE_ORANGE_1)
 
Back
Top