I think I've figured what did he mean , and hope i'm right..
he got 3 conditions true
for example of tibia
level , vocation , storage
so if you put them true depend on how you script them
for example
if lvl = 10 true and you end your function
then the script will use this as first and only condition if player lvl= 10
but if you want to make it check all conditions at one time so you need to make something like this
if lvl10 then if voc =1234 then if storage =12345 do
and write your script .. then you type what if each condition isn't done
I will give simple example
If getPlayerLevel(cid) > 10 then
If getPlayerVocation(cid) = 4 then
If getPlayerStorageValue(12345) = 0 then
doPlayerAddItem(1234) - i don't remember functions and using phone xd
else doPlayerSendTextMessage ( you already got this item ) end
else xx ( you are not knight) end
else xx (you are low lvl ) end
Note this is example .. Not real script xd
But if you make it
If lvl 10 do xx end it will take the first function without checking other conditions
Hope i did good explain or even understood you xd
Using phone tooJust want to explain how it work .. If i type and he may will ask how they work xd
So i showed him the simple way . and i use phone atm .
Using phone too
But yeah, if you do not show a dog how to handshake, he will never learn it, just saying![]()
If player:getStorageValue(xxx1) == 1 and origin == ORIGIN_MELEE then
dosomething1
return something1
end
If player:getStorageValue(xxx2) == 1 and origin == ORIGIN_MELEE then
dosomething2
return something2
end
If player:getStorageValue(xxx3) == 1 and origin == ORIGIN_MELEE then
dosomething3
return something3
end
if player:getStorageValue(xxx1) == 1 and player:getStorageValue(xxx2) == 1 and player:getStorageValue(xxx3) == 1 and origin == ORIGIN_MELEE then
dosomething1
dosomething2
dosomething3
return something4
end
if player:getStorageValue(xxx1) == 1 and player:getStorageValue(xxx2) == 1 and origin == ORIGIN_MELEE then
dosomething1
dosomething2
return something5
end
if player:getStorageValue(xxx1) == 1 and player:getStorageValue(xxx3) == 1 and origin == ORIGIN_MELEE then
dosomething1
dosomething3
return something6
end
if player:getStorageValue(xxx1) == 1 and origin == ORIGIN_MELEE then
dosomething1
return something1
end
if player:getStorageValue(xxx2) == 1 and origin == ORIGIN_MELEE then
dosomething2
return something2
end
if player:getStorageValue(xxx3) == 1 and origin == ORIGIN_MELEE then
dosomething3
return something3
end
configTable = {
{
sv = 1000,
requiredValue = 3,
origin = ORIGIN_MELEE,
function = doSomething,
}
}
for _, configTable in pairs(configTable) do
if getSV(player, configTable.sv) == configTable.requiredValue and configTable.origin == origin then
configTable.function()
end
end
local t = {
[ORIGIN_MELEE] = {
[storage1] = function(...) dosomething1(...) end,
[storage2] = function(...) dosomething2(...) end,
[storage3] = function(...) dosomething3(...) end
}
}
function ...(...)
for k,v in pairs(t[origin]) do
if player:getStorageValue(k) >= 1 then
v(player) -- will call the dosomething1/2/3 depending in which table index we are atm
end
end
return true
end
if you do it my way then you don't need to do it beforehand, I keep pushing the parameters forward so we don't need to load it firstCode:configTable = { { sv = 1000, requiredValue = 3, origin = ORIGIN_MELEE, function = doSomething, } } for _, configTable in pairs(configTable) do if getSV(player, configTable.sv) == configTable.requiredValue and configTable.origin == origin then configTable.function() end end
obivously you need function loaded before global configTable or use a string and load it trough _G[configTable.functionString]()