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

Show Players with storage

merfus

Member
Joined
Dec 27, 2011
Messages
214
Reaction score
5
Location
Poland
is there any line what show's all players with storage example:
Lua:
getPlayerStorageValue(cid,2010) == 13 then
 
Lua:
players = {}
for _, pid in pairs(getPlayersOnline()) do
	if (getCreatureStorage(pid, XXXX) > 0) then
		table.insert(players, pid)
	end
end
And now in table players you have all players with storage XXXX > 0.
 
Lua:
players = {}
for _, pid in pairs(getPlayersOnline()) do
	if (getCreatureStorage(pid, 2010) == 10) then
		table.insert(players, pid)
	end
end
And now in table players you have all players with storage XXXX > 0.

How i can add it into this script after Player with this Mission:

Lua:
elseif getPlayerStorageValue(cid,2010) == 10 then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"Informations: Kill Super Orshabal")
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"Player with this Mission: (YOU'RE SCRIPT)")

I Try many times, but everytime it don't work.
 
Lua:
	local message = "Informations: Kill Super Orshabal.\nPlayer with this Mission: "
	for _, pid in pairs(getPlayersOnline()) do
		if (getCreatureStorage(pid, 2010) == 10) then
			message = message .. getCreatureName(pid) .. ", "
		end
	end
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, string.sub(message, 0, -3))
 
Lua:
	local message = "Informations: Kill Super Orshabal.\nPlayer with this Mission: "
	for _, pid in pairs(getPlayersOnline()) do
		if (getCreatureStorage(pid, 2010) == 10) then
			message = message .. getCreatureName(pid) .. ", "
		end
	end
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, string.sub(message, 0, -3))

it can't be with local message, because i got many else if.
If any one could for easy configure add something like local storage (storage for see players with that storage) and i just add for every else if one line for see all players with storage x == x?
 
it can't be with local message, because i got many else if.
If any one could for easy configure add something like local storage (storage for see players with that storage) and i just add for every else if one line for see all players with storage x == x?
Show there whole script.
 
Anyone can do something like this:
!mission 10
Check what player online have storage = 10 and show it into list ?
 
Try this
Lua:
function onSay(cid, words, param)
	for _, pid in pairs (getPlayersOnline()) do
		if  getPlayerStorageValue(pid, 10) then
			doShowTextDialog(cid..., 2390, "These are the players with storage id 10\n"..getPlayersOnline(players))
			end
		return true
	end
Not tested, if it doesn't work show me the errors
 
Last edited:
Didn't notice that I put cid >.<, I'm to used to that I guess. and thanks for telling me about the periods behind cid , didn't know it would do that :p
 
Oh well, didn't look to deep into it, but I guess that won't work xD
try it more like that:
Lua:
function onSay(cid, words, param)
local player = {}
local str = ''
	for _, pid in pairs (getPlayersOnline()) do
		if  getPlayerStorageValue(pid, 10) then
			table.insert(player, pid)
		end
	end
	for i = 1, #player do
		str = str..", "..getPlayerName(player[i]).." "
	end
	doShowTextDialog(cid, 2390, "These are the players with storage id 10\n"..str)
return true
end
 
Last edited:
I means:
If we write !mission 10, shows all players with storage = 10,
If we write !mission X , for x = 11 or 12 or etc... it will show players with that mission what we wrote.

Its possible to do ?
 
Lua:
function onSay(cid, words, param)
local player = {}
local str = ''

	if(param == '') then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
		return true
	end
	
	local t = string.explode(param, ",")
	local value = tonumber(t[1])
	if(not value or value == 0) then
		value = 1
	end
	
	for _, pid in pairs (getPlayersOnline()) do
		if getPlayerStorageValue(pid, t[1]) > 0 then
			table.insert(player, pid)
		end
	end
	
	for i = 1, #player do
		str = str..", "..getPlayerName(player[i])..""
	end
	
	doShowTextDialog(cid, 2390, "These are the players with storage id ".. t[1] ..":\n"..str)
return true
end

Example: !mission 100

It will output the online players that have the storage 100.
 
Lua:
function onSay(cid, words, param)
local player = {}
local str = ''

	if(param == '') then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
		return true
	end
	
	local t = string.explode(param, ",")
	local value = tonumber(t[1])
	if(not value or value == 0) then
		value = 1
	end
	
	for _, pid in pairs (getPlayersOnline()) do
		if getPlayerStorageValue(pid, t[1]) > 0 then
			table.insert(player, pid)
		end
	end
	
	for i = 1, #player do
		str = str..", "..getPlayerName(player[i])..""
	end
	
	doShowTextDialog(cid, 2390, "These are the players with storage id ".. t[1] ..":\n"..str)
return true
end

Example: !mission 100

It will output the online players that have the storage 100.

where i can change the main storage? Because i don't see it.
I Mean that i got storage 2010 == x
And i want that after write !mission x i see all online players with storage 2010 == x
 
try this:
Lua:
function onSay(cid, words, param)
local player = {}
local str = ''
 
	if(param == '') then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
		return true
	end
 
	local t = string.explode(param, ",")
	local value = tonumber(t[1])
	if(not value or value == 0) then
		value = 1
	end
 
	for _, pid in pairs (getPlayersOnline()) do
		if getPlayerStorageValue(pid, t[1]) == t[2] then
			table.insert(player, pid)
		end
	end
 
	for i = 1, #player do
		str = str..", "..getPlayerName(player[i])..""
	end
 
	doShowTextDialog(cid, 2390, "These are the players with storage id: ".. t[1] .." value: ".. t[2] ..":\n"..str)
return true
end
 
PHP:
function onSay(cid, words, param, channel)
local player = {}
local str = ''
        if(param == "") then return TRUE,doPlayerSendTextMessage(cid,18,"Command param required.")end
	local t = string.explode(param, ",")
	if(not tonumber(t[1]) or not tonumber(t[2])) then
		return TRUE,doPlayerSendTextMessage(cid,18,"choose a number storage,value.")end
	for _, pid in pairs (getPlayersOnline()) do
		if getPlayerStorageValue(pid, tonumber(t[1])) == tonumber(t[2]) then
			table.insert(player, pid)
		end
	end
	for i = 1, #player do
		str = str.."\n"..getPlayerName(player[i])
	end
	doShowTextDialog(cid, 2390, "These are the players with storage id: ".. t[1] .." value: ".. t[2] ..":\n"..str)
return TRUE
end
 
Is there any chance to edit it, for that i got storage 2010 == 6 and its mission 7, is there any chance to edit that script for something like -1? So if player send message !mission 7 it show all players with storage 2010 == 6.

Is there a chance to change some line to that all storage will check storage -1?
 
PHP:
function onSay(cid, words, param, channel)
local player = {}
local str = ''
        if(param == "") then return TRUE,doPlayerSendTextMessage(cid,18,"Command param required.")end
	local t = string.explode(param, ",")
	if(not tonumber(t[1]) or not tonumber(t[2])) then
		return TRUE,doPlayerSendTextMessage(cid,18,"choose a number storage,value.")end
	for _, pid in pairs (getPlayersOnline()) do
		if getPlayerStorageValue(pid, tonumber(t[1])) == tonumber(t[2]) then
			table.insert(player, pid)
		end
	end
	for i = 1, #player do
		str = str.."\n"..getPlayerName(player[i])
	end
	doShowTextDialog(cid, 2390, "These are the players with storage id: ".. t[1] .." value: ".. t[2] ..":\n"..str)
return TRUE
end

Can Any change that it NOT ask about storage, just ask about value, storage is always 2010, i dont see where i can change that, and it will be great if it will be show not in new window, just in default chat like !online:
Code:
00:09 1 player(s) online with that mission:
00:09 Ownage [48].
 
Back
Top