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

send broadcast text to players with storage

i got globalevent but i need to make if return true bloadcastmsg to players with storage getPlayerVipDays(cid) > 0 can be doPlayerSendTextMessage if cannot broadcast just need know how and i add it to my script
 
Code:
local k = getOnlinePlayers()
for i = 1,#k do
local p = getPlayerByName(k[i]) 
 if getPlayerVipDays(p) > 0 then
    doPlayerSendTextMessage(p, 20, "YOUR MESSAGE")
 end
end
should do it
 
Last edited:
Code:
local k = getOnlinePlayers()
for i = 1,#k do
local p = getPlayerByName(k[i])
if getPlayerVipDays(p) > 0 then
   doPlayerSendTextMessage(p, 20, "YOUR MESSAGE")
end
should do it

I like the simplicity of your script!
Absolutely no extra code.
:)
 
The main issue here is that OP is not able to start a valid support thread and therefore did not mention the server version.

Depending on the server version I would consider
Code:
local p = getPlayerByName(k[i])
as extra code, also there is an end missing.
 
The main issue here is that OP is not able to start a valid support thread and therefore did not mention the server version.

+1, lol. I don't think they understand there is a different in functions between server versions.
 
+1, lol. I don't think they understand there is a different in functions between server versions.

if the thread creator is unable to define his server version then he'll get a script for the latest server version (TFS1.0)

I am well aware that nearly every svn has its own syntax, i've been with OTs long enough, but well thank you for pointing that out.

@Summ thanks, i wrote that without looking at it again
 
if the thread creator is unable to define his server version then he'll get a script for the latest server version (TFS1.0)

I am well aware that nearly every svn has its own syntax, i've been with OTs long enough, but well thank you for pointing that out.

@Summ thanks, i wrote that without looking at it again

It was meant for the thread creator.
 
Because if you look at what your function does it makes no sense:
- get all player userdatas
- get the name of the player from userdata
- return table of names

then you take the names and get the players again.

Instead:
Code:
for _, player in ipairs(Game.getPlayers()) do
    if player:getStorageValue(YOUR_STORAGE) > YOUR_VALUE then
         player:sendTextMessage(MESSAGE_INFO_DESCR, "Your text")
    end
end

But I doubt that he is using TFS 1.0 because those shitty systems are not updated to 1.0
 
No arguing there, Game.getPlayers() would fit better and save some ressources.
I'll may get used to the new metamethods and befriend them... sometime... maybe ... :D

Code:
for i,k in ipairs(getOnlinePlayers()) do
 if getSOMETHING(k) > THIS then
  doSomethingWith(k)
 end
end
That's better :)
 
Last edited:
Back
Top