• 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 Local Config.

bananq

New Member
Joined
Feb 5, 2013
Messages
36
Reaction score
3
Hello. How does it connect?

local config {
123bogdan = 3
}

config.123 + getPlayerName(cid)

Some brackets?
Regards.
 
Well, I don't know exactly what you're saying but

Code:
local config {
bogdan = 3
}
local someVar = config['bogdan']


You have to name the full property. And I don't know what happens when you add an int and a string in LUA but I'm sure that's not what you want.
 
Look. bogdan and mariusz its a player name. All players have another values.

local config = {
club mariusz = 12
sword mariusz = 13
axe mariusz = 14
club bogdan = 4
sword bogdan = 5
axe bogdan = 6


Now i must call up config. First part config.axe and second getplayername(cid).
Something like that:
doPlayerAddSkill(cid,skill, (config.axe)+getplayername(cid))

Its posslible? Thanks.
 
You can do it like this:
Lua:
local config = {
  ["mariusz"] = {axe = 10, sword = 20, club = 30},
  ["bogdan"] = {axe = 100, sword = 200, club = 50}
}

function on~~~~~(..)
  local name = getPlayerName(cid)
  local conf = config[name:lower()]
  if conf then 
    local axeSkill = conf.axe
    local swordSkill = conf.sword
    local clubSkill = config.club 
    -- DO STUFF HERE
  end
end
 
Back
Top