• 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!

RevScripts Talk !task

alcapone

Member
Joined
Jan 13, 2021
Messages
246
Reaction score
19
Lua:
local config = {
 
     ['monster 1'] = {amount = 100, storage = x, startstorage = xx, startvalue = 1},
     ['monster 2'] = {amount = 100, storage = x, startstorage = xx, startvalue = 1}

 
}

I'm wanting to make a command that when the player uses it, it will say the task that it is active and its name
each task has 1 storage from number 1000 to 2000
 
better explaination pls so maybe i can help
local config = {

['rat] = {amount = 100, startstorage = 1002, startvalue = 1},
['demon'] = {amount = 100, startstorage = 2002, startvalue = 1}
}

when the player uses the command it will check which of the storages is 1
and it will say the name of the monster so the player will know which task is active

the problem is that the list has several storage =\
 
Lua:
local config = {

['rat'] = {amount = 100, startstorage = 1002, startvalue = 1},
['demon'] = {amount = 100, startstorage = 2002, startvalue = 1}
}


local function getActiveTasksName(player)
 
   if not player then
      return nil
   end
 
   local str = "List of Active Tasks: "
   local _anyTask = false
 
   for taskName, v in pairs(config) do
       local requiredStorage = v.startstorage
       local startValue = v.startvalue
       if player:getStorageValue(requiredStorage) >= startValue then
          if not _anyTask then
             _anyTask = true
          end
          str = str .. "[" .. taskName .. "]" .. " - " .. " Kills Required: " .. v.amount .. "\n"
       end
    end
   
    if _anyTask then
       return str
    else
       return "You dont have any active task."
    end
end
 
Last edited:
Lua:
local config = {

['rat'] = {amount = 100, startstorage = 1002, startvalue = 1},
['demon'] = {amount = 100, startstorage = 2002, startvalue = 1}
}


local function getActiveTasksName(player)
 
   if not player then
      return nil
   end
 
   local str = "List of Active Tasks: "
   local _anyTask = false
 
   for taskName, v in pairs(config) do
       local requiredStorage = v.startstorage
       local startValue = v.startvalue
       if player:getStorageValue(requiredStorage) >= startValue then
          if not _anyTask then
             _anyTask = true
          end
          str = str .. "[" .. taskName .. "]" .. " - " .. " Kills Required: " .. v.amount .. "\n"
       end
    end
  
    if _anyTask then
       return str
    else
       return "You dont have any active task."
    end
end
Lua:
local test = TalkAction("/test")
 
local config = {

 
['demon'] = {amount = 100, startstorage = 5046, startvalue = 1},
['demon12'] = {amount = 100, startstorage = 5047, startvalue = 1}


}
 

function test.onSay(player, words, param)

local function getActiveTasksName(player)
 
    if not player then
      return nil
   end
 
   local str = "List of Active Tasks: "
   local _anyTask = false
 
   for taskName, v in pairs(config) do
       local requiredStorage = v.startstorage
       local startValue = v.startvalue
       if player:getStorageValue(requiredStorage) >= startValue then
          if not _anyTask then
             _anyTask = true
          end
          str = str .. "[" .. taskName .. "]" .. " - " .. " Kills Required: " .. v.amount .. "\n"
       end
    end
  
    if _anyTask then
       return str
    else
       return "You dont have any active task."
    end
end

end
 

test:register()

I tested it this way but no error and it didn't activate
 
Lua:
local config = {

 
['demon'] = {amount = 100, startstorage = 5046, startvalue = 1},
['demon12'] = {amount = 100, startstorage = 5047, startvalue = 1}


}
 
local function getActiveTasksName(player)
 
    if not player then
      return nil
   end
 
   local str = "List of Active Tasks: "
   local _anyTask = false
 
   for taskName, v in pairs(config) do
       local requiredStorage = v.startstorage
       local startValue = v.startvalue
       if player:getStorageValue(requiredStorage) >= startValue then
          if not _anyTask then
             _anyTask = true
          end
          str = str .. "[" .. taskName .. "]" .. " - " .. " Kills Required: " .. v.amount .. "\n"
       end
    end
 
    if _anyTask then
       return str
    else
       return "You dont have any active task."
    end
end

local test = TalkAction("/test")
function test.onSay(player, words, param)
   print("Player: " .. player:getName() .. " " .. getActiveTasksName(player))
   return true
end
test:register()

check if console print anything after type /test

btw Lua - Functions (https://www.tutorialspoint.com/lua/lua_functions.htm) the way that u tried to use my function was absolutely wrong
 
Back
Top