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

players online with same storagevalue?

Cotizado

Member
Joined
May 12, 2008
Messages
320
Reaction score
7
hello what is the function to know how many players online with same storagevalue like if there are more than 5 players online with same storage you can perform an action.. ty
 
Lua:
local storage = 19012
for _, pid in ipairs(getPlayersOnline()) do
 if getPlayerStorageValue(pid, storage) ~= -1 then
  doPlayerSendTextMessage(pid, MESSAGE_INFO_DESCR, "Hey you got the storage.")
 end
end
 
ty for the replay but i mean if there is only that player with the storage he can say or do something. but if there are more than 1 he cant
 
Lua:
local storage, count = 19012, 0
for _, pid in ipairs(getPlayersOnline()) do
 if getPlayerStorageValue(pid, storage) ~= -1 and pid ~= cid then
  count = count+1
 end
end

if count == 0 then
 doPlayerSendTextMessage(pid, MESSAGE_INFO_DESCR, "Only you have the storage, executing script.")
else
 doPlayerSendTextMessage(pid, MESSAGE_INFO_DESCR, "There are another player with the storage, sorry.")
end

Remenber to rep+ ^^
 
Lua:
local storage, count = 19012, 0
for _, pid in ipairs(getPlayersOnline()) do
 if getPlayerStorageValue(pid, storage) ~= -1 and pid ~= cid then
  count = count+1
 end
end

if count == 0 then
 doPlayerSendTextMessage(pid, MESSAGE_INFO_DESCR, "Only you have the storage, executing script.")
else
 doPlayerSendTextMessage(pid, MESSAGE_INFO_DESCR, "There are another player with the storage, sorry.")
end

Remenber to rep+ ^^

You declared "pid" in the loop only so won't work outside of it and don't be a repwhore.
 
Back
Top Bottom