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

help

Doggynub

LUA / C++
Joined
Sep 28, 2008
Messages
2,541
Reaction score
186
if i have somthng like that

LUA:
local m = { ["rat"] = {storage = 29000},["spider"] = {storage=29010},["wolf"] = {storage = 29020}}
how say :
if one player have one of these storage > 0 then
get this storage and set it as i wish.
 
local m = { ["rat"] = {storage = 29000},["spider"] = {storage=29010},["wolf"] = {storage = 29020}}
local monster = m[string.lower(getCreatureName(target))]
monster.storage ? D:
 
and does that differ
it is a talkaction when i say !kill rat rat is killed and the storage is set to 1
when i say !disable
this checks if one of storages is > -1 then
set this one or all to 0
Only want to know how to make this storage thing how to get it from table
 
Use this to set every storage which is bigger than -1 to 0:
PHP:
for k, v in pairs(m) do
	if getPlayerStorageValue(cid,v.storage) > -1 then
		setPlayerStorageValue(cid,v.storage,0)
	end
end

And this to set all to 0 if 1 of the storages is bigger than -1:
PHP:
local x = false
for k, v in pairs(m) do
	if getPlayerStorageValue(cid,v.storage) > -1 then
		x = true
		break
	end
end
if x then
	for k, v in pairs(m) do
		setPlayerStorageValue(cid,v.storage,0)
	end
end
 
Back
Top