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

[Request.] Online Command.

Alucar

New Member
Joined
Nov 18, 2011
Messages
13
Reaction score
2
Good afternoon. I would like an online system per storage, it works like this, the player uses !online and are listed only players online with same storage value of user the command.
 
Would this be to show like, players on the same quest-line as you or what's the storage for? (I'm not a scripter I'm just genuinely curious)

Reset system per storage! :p

post your current !online script and il modify

function onSay(cid, words, param, channel)
local strings, i, position, added, showGamemasters = {""}, 1, 1, false, getBooleanFromString(getConfigValue('displayGamemastersWithOnlineCommand'))
for _, pid in ipairs(getPlayersOnline()) do
if(added) then
if(i > (position * 7)) then
strings[position] = strings[position] .. ","
position = position + 1
strings[position] = ""
else
strings[position] = i == 1 and "" or strings[position] .. ", "
end
end

added = false
if((showGamemasters or getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES) or not getPlayerCustomFlagValue(pid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES)) and (not isPlayerGhost(pid) or getPlayerGhostAccess(cid) >= getPlayerGhostAccess(pid))) then
strings[position] = strings[position] .. getCreatureName(pid) .. " [" .. getPlayerLevel(pid) .. "]"
i = i + 1
added = true
end
end

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, (i - 1) .. " player" .. (i > 1 and "s" or "") .. " online:")
for i, str in ipairs(strings) do
if(str:sub(str:len()) ~= ",") then
str = str .. "."
end

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, str)
end

return true
end

This other it is altered for storage value, but list all players with more or less value of storage and not only same value.

local config = {
showGamemasters = getBooleanFromString(getConfigValue('displayGamemastersWithOnlineCommand'))
}

function getResets(cid)
local stg = 157
local resets = getPlayerStorageValue(cid, stg)
return resets < 0 and 0 or resets
end

function onSay(cid, words, param, channel)
local strings = {""}
local players = getPlayersOnline()

local i, position = 1, 1
local added = false
for _, pid in ipairs(players) do
if(added) then
if(i > (position * 7)) then
strings[position] = strings[position] .. ","
position = position + 1
strings[position] = ""
else
strings[position] = i == 1 and "" or strings[position] .. ", "
end
end

if((config.showGamemasters or getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES) or not getPlayerCustomFlagValue(pid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES)) and (not isPlayerGhost(pid) or getPlayerGhostAccess(cid) >= getPlayerGhostAccess(pid))) then
strings[position] = strings[position] .. getCreatureName(pid) .. " (" .. getPlayerLevel(pid) .. ") [".. getResets(pid) .."]"
i = i + 1
added = true
else
added = false
end
end

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, (i - 1) .. " player(s) online:")
for i, str in ipairs(strings) do
if(str:sub(str:len()) ~= ",") then
str = str .. "."
end

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, str)
end

return true
end
 
Add
and (getPlayerStorageValue(cid, xxxx)==1)
to
Code:
if((showGamemasters or getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES) or not getPlayerCustomFlagValue(pid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES)) and (not isPlayerGhost(pid) or getPlayerGhostAccess(cid) >= getPlayerGhostAccess(pid))) then

It will only show players whos storage xxxx value == 1.
 
Add
and (getPlayerStorageValue(cid, xxxx)==1)
to
Code:
if((showGamemasters or getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES) or not getPlayerCustomFlagValue(pid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES)) and (not isPlayerGhost(pid) or getPlayerGhostAccess(cid) >= getPlayerGhostAccess(pid))) then

It will only show players whos storage xxxx value == 1.

The command must list the same amount of storage that the player has. Ex: Storage 157, value 1. After the player reset, the command will list value storage 157, value 2. But evermore list only players with same value of storage of user.
 
try this. (untested)
make new command in talkactions..

/onlinestorage
usage..
/onlinestorage storagevalue, number

/onlinestorage 45001, 1

Code:
function onSay(cid, words, param, channel)

   if(param == "") then
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
     return true
   end
   local t = string.explode(param, ",")
   local strings, i, position, added, showGamemasters = {""}, 1, 1, false, getBooleanFromString(getConfigValue('displayGamemastersWithOnlineCommand'))
   for _, pid in ipairs(getPlayersOnline()) do
     if(added) then
       if(i > (position * 7)) then
         strings[position] = strings[position] .. ","
         position = position + 1
         strings[position] = ""
       else
         strings[position] = i == 1 and "" or strings[position] .. ", "
       end
     end
  
     added = false
     if((showGamemasters or getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES) or not getPlayerCustomFlagValue(pid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES)) and (not isPlayerGhost(pid) or getPlayerGhostAccess(cid) >= getPlayerGhostAccess(pid))) then
       if getPlayerStorageValue(t[1]) == t[2] then
         strings[position] = strings[position] .. getCreatureName(pid) .. " [" .. getPlayerLevel(pid) .. "]"
         i = i + 1
         added = true
       else
     end
   end
  
   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, (i - 1) .. " player" .. (i > 1 and "s" or "") .. " online:")
   for i, str in ipairs(strings) do
     if(str:sub(str:len()) ~= ",") then
       str = str .. "."
     end
    
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, str)
   end
  
   return true
end
 
try this. (untested)
make new command in talkactions..

/onlinestorage
usage..
/onlinestorage storagevalue, number

/onlinestorage 45001, 1

Code:
function onSay(cid, words, param, channel)

   if(param == "") then
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
     return true
   end
   local t = string.explode(param, ",")
   local strings, i, position, added, showGamemasters = {""}, 1, 1, false, getBooleanFromString(getConfigValue('displayGamemastersWithOnlineCommand'))
   for _, pid in ipairs(getPlayersOnline()) do
     if(added) then
       if(i > (position * 7)) then
         strings[position] = strings[position] .. ","
         position = position + 1
         strings[position] = ""
       else
         strings[position] = i == 1 and "" or strings[position] .. ", "
       end
     end
 
     added = false
     if((showGamemasters or getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES) or not getPlayerCustomFlagValue(pid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES)) and (not isPlayerGhost(pid) or getPlayerGhostAccess(cid) >= getPlayerGhostAccess(pid))) then
       if getPlayerStorageValue(t[1]) == t[2] then
         strings[position] = strings[position] .. getCreatureName(pid) .. " [" .. getPlayerLevel(pid) .. "]"
         i = i + 1
         added = true
       else
     end
   end
 
   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, (i - 1) .. " player" .. (i > 1 and "s" or "") .. " online:")
   for i, str in ipairs(strings) do
     if(str:sub(str:len()) ~= ",") then
       str = str .. "."
     end
   
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, str)
   end
 
   return true
end

It would not be feasible use so because the command must be used per players. In their mode they would have to guess the value of storage. But thanks for you try help.
 
It would not be feasible use so because the command must be used per players. In their mode they would have to guess the value of storage. But thanks for you try help.
Sorry, I thought it was a gm command.
try this.

Code:
function onSay(cid, words, param, channel)

   local storage = 45001
   local value = getPlayerStorageValue(cid, storage)

   local strings, i, position, added, showGamemasters = {""}, 1, 1, false, getBooleanFromString(getConfigValue('displayGamemastersWithOnlineCommand'))
   for _, pid in ipairs(getPlayersOnline()) do
     if(added) then
       if(i > (position * 7)) then
         strings[position] = strings[position] .. ","
         position = position + 1
         strings[position] = ""
       else
         strings[position] = i == 1 and "" or strings[position] .. ", "
       end
     end
   
     added = false
     if((showGamemasters or getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES) or not getPlayerCustomFlagValue(pid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES)) and (not isPlayerGhost(pid) or getPlayerGhostAccess(cid) >= getPlayerGhostAccess(pid))) then
       if getPlayerStorageValue(pid, storage) == value then
         if pid ~= cid then
           strings[position] = strings[position] .. getCreatureName(pid) .. " [" .. getPlayerLevel(pid) .. "]"
           i = i + 1
           added = true
         end
       end
     end
   end
   
   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, (i - 1) .. " player" .. (i > 1 and "s" or "") .. " online with same storage as you:")
   for i, str in ipairs(strings) do
     if(str:sub(str:len()) ~= ",") then
       str = str .. "."
     end
     
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, str)
   end
   
   return true
end
 
Back
Top