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
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)")
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))
Show there whole script.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?
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
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
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
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.
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
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
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
00:09 1 player(s) online with that mission:
00:09 Ownage [48].