ok im making an extension that when activated will send a message every sec to all players telling them the server will be shutting down but it never runs the msg heres my extension.rb and yes i added it to the config
module RMXOS
#------------------------------------------------------------------
# Passes the extension's main module to RMX-OS on the top
# level so it can handle this extension.
# Returns: Module of this extension for update.
#------------------------------------------------------------------
def self.load_current_extension
return Server_Calls
end
end
#======================================================================
# module ExtensionSkeleton
#======================================================================
module Server_Calls
# extension version
VERSION = 1.0
# required RMX-OS version
RMXOS_VERSION = 1.11
# whether the server should update this extension in an idividual thread or not
SERVER_THREAD = true
#------------------------------------------------------------------
# Initializes the extension (i.e. instantiation of classes).
#------------------------------------------------------------------
def self.initialize
@countdown = false
@timer = 30
@frames = 0
end
#------------------------------------------------------------------
# Calls constant updating on the server.
#------------------------------------------------------------------
def self.main
# while server is running
while RMXOS.server.running
self.server_update
sleep(0.1)
end
end
#------------------------------------------------------------------
# Handles the server update.
#------------------------------------------------------------------
def self.server_update
if @countdown
@frames += 1
end
if @frames == 40
@frames = 0
message = 'The server will be shutting down in ' + @timer
puts message
@client.sender.send_to_all("CHT#{RMXOS::Data::ColorInfo}\t0\t#{message}")
@timer -= 1
if @timer == 0
@timer = 30
@countdown = false
RMXOS.server.shutdown
RMXOS.server.force_shutdown
end
end
end
#------------------------------------------------------------------
# Handles updating from a client.
# client - Client instance (from Client.rb)
# Returns: Whether to stop check the message or not.
#------------------------------------------------------------------
def self.client_update(client)
case client.message
when /\SDT(.+)/
if client.player.usergroup == RMXOS::GROUP_ADMIN
@countdown = true
@type = $1.to_i
@client = client
else
message = 'Sorry only Admins can shut down the server'
client.send("CHT#{RMXOS::Data::ColorInfo}\t0\t#{message}")
end
return true
end
return false
end
end
*scratches head* Why don't you just send a global message as moderator/admin?
i would but i want it to send it every second so that it can keep warning ppl be4 it shuts down
edit wow i was doing it the hard way looked at the auto restart timer and did it the same way also i think the problem was the send_to_all i didn't realize there was a send to me condition btw is there a way to have the server send a msg the way it is now if i log out before the timer finished it causes a error which is fine just wondering if i could do it through the server