• 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 math.random

milbradt

New Member
Joined
Dec 25, 2011
Messages
177
Solutions
1
Reaction score
4
Hello..
How do I add a command within this math.random?

Code:
        local health = potion.health
        if(health and not doCreatureAddHealth(itemEx.uid, math.ceil(math.random(health[1], health[2]) * config.healthMultiplier))) then
                return false
        end

Example:
Code:
local POTIONS = {
  [7443] = {empty = 7478, splash = 2, health = {8550, 11000}}, -- heal potion
  [2150] = {empty = 7478, splash = 2, health = {23000, 25500}}, -- heal medium potion
  [7477] = {empty = 7478, splash = 2, health = {60000, 75000}}, -- heal great potion
  [7591] = {empty = 7635, splash = 2, health = {500, 700}}, -- great health potion
  [8473] = {empty = 7635, splash = 2, health = {900, 1200}}, -- ultimate health potion
  [7440] = {empty = 7478, splash = 7, mana = {5000, 5500}}, -- mana potion
  [2149] = {empty = 7478, splash = 7, mana = {10000, 10500}}, -- strong mana potion
  [2144] = {empty = 7478, splash = 7, mana = {50000, 55000}}, -- great mana potion
  [8472] = {empty = 7635, splash = 3, health = {400, 500}}, -- great spirit potion
}

    local health = potion.health
    if(health and not doCreatureAddHealth(itemEx.uid, math.ceil(math.random(health[1]+(getPlayerLevel(cid)*40), health[2]+(getPlayerLevel(cid)*45) * config.healthMultiplier))) then
        return false
    end
 
Back
Top