My old method for Rust Legacy no longer works and I can't find any new method of doing it (but I know its possible). How would I go about having the server count the amount of players and returning it as a number value?
Before it use to just be like this;
local PlayerClientAll = util.GetStaticPropertyGetter( Rust.PlayerClient, "All" )
pclist = PlayerClientAll()
if pclist.Count == 0 then
However,
GetStaticPropertyGetter no longer works. Any help would be appreciated.
Solved Getting connected players count? (Lua)
Discussion in 'Rust Development' started by Spiritwind, Mar 28, 2016.
-
Wulf Community Admin
global.BasePlayer.activePlayerList.Count
It may be :Count for Lua, can't recall.
It's already an int, so just use it where you need to. -
Thanks Wulf, appreciate the help!
[DOUBLEPOST=1459206518,1459197198][/DOUBLEPOST]I must be missing something or doing something wrong.
attempt to compare boolean with number
pclist = global.BasePlayer.activePlayerList.Count
if pclist == 0 then
TimerRadAirdrop = timer.Once( 1800, function() self:AirdropPlayers() end )
print( ("found " .. pclist .. " players." ) )
return end
if pclist > 0 <= 5 then
TimerRadAirdrop = timer.Once( 1800, function() self:AirdropPlayers() end )
print( ("found " .. pclist .. " players." ) )
self:AirdropBase()
return end
Pretty much trying to tell it to run a function with a certain time depending on the player count.
[DOUBLEPOST=1459208120][/DOUBLEPOST]Would say I'm doing something wrong. Ran the print message without anything else and it worked right there.
[DOUBLEPOST=1459209107][/DOUBLEPOST]I'm an idiot. Figured it out.