Online Awareness for RMX-OS
Authors: Blizzard
Version: 1.0
Type: RMX-OS Plugin
Key Term: RMX-OS Plugin
IntroductionThis script allows you to view the list of the players currently online, on the same map and optionally notify the player each time a player connects and/or disconnects.
This script is to be distributed under the same terms and conditions like the script it was created for: RMX-OS.
Features
- view players currently online
- view players currently on the same map
- optional feature to notify players upon login and logout of other players
ScreenshotsN/A for this sort of script.
DemoN/A
ScriptJust make a new script above main and paste this code into it.
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Online Awareness for RMX-OS by Blizzard
# Version: 1.0
# Type: RMX-OS Plugin
# Date: 12.6.2013
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# This script is to be distributed under the same terms and conditions like
# the script it was created for: RMX-OS.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Information:
#
# This script must be placed below RMX-OS and requires RMX-OS to work
# properly. This script allows you to view the list of the players currently
# online, on the same map and optionally notify the player each time a player
# connects and/or disconnects.
#
#
# If you find any bugs, please report them here:
# http://forum.chaos-project.com
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
if !defined?(RMXOS) || RMXOS::VERSION < 2.0
raise 'ERROR: The "Online Awareness" requires RMX-OS 2.0 or higher.'
end
#==============================================================================
# module BlizzCFG
#==============================================================================
module BlizzCFG
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# set to false if you want to disable login/logout messages
ONLINE_AWARENESS_SHOW_LOGIN_LOGOUT = true
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
end
#==============================================================================
# module RMXOS
#==============================================================================
module RMXOS
#============================================================================
# module Documentation
#============================================================================
module Documentation
PARAMETERS['online'] = 'none'
PARAMETERS['onmap'] = 'none'
DESCRIPTIONS['online'] = 'Displays the players currently online.'
DESCRIPTIONS['onmap'] = 'Displays the players currently on the same map.'
end
#============================================================================
# module Data
#============================================================================
module Data
OnlineAwarenessLoggedIn = 'PLAYER has logged in.'
OnlineAwarenessLoggedOut = 'PLAYER has logged out.'
OnlineAwarenessPlayers = 'Currently online: PLAYERS'
OnlineAwarenessNoPlayers = 'No one else is currently online.'
OnlineAwarenessMapPlayers = 'Currently on the same map: PLAYERS'
OnlineAwarenessNoMapPlayers = 'No one else is currently on the same map.'
end
#============================================================================
# Network
#============================================================================
class Network
def add_info2(message)
self.add_message(nil, message, RMXOS::Data::ColorInfo)
end
alias check_game_online_awareness_alias check_game
def check_game(message)
if BlizzCFG::ONLINE_AWARENESS_SHOW_LOGIN_LOGOUT
case message
when /\ADCT\t(.+)/ # disconnection message
id = $1.to_i
if self.players.has_key?(id)
self.add_info2(RMXOS::Data::OnlineAwarenessLoggedOut.sub('PLAYER',
self.players[id].username))
end
# does not return as original processing still needs to be done
when /\AENT\t(.+)\t(.+)\t(.+)\t(.+)/ # server entry message
name = $2
self.add_info2(RMXOS::Data::OnlineAwarenessLoggedIn.sub('PLAYER', name))
# does not return as original processing still needs to be done
end
end
return check_game_online_awareness_alias(message)
end
alias check_normal_commands_online_awareness_alias check_normal_commands
def check_normal_commands(message)
case message
when /\A\/online\Z/
names = self.players.values.map {|player| player = player.username}
if names.size > 0
self.add_info2(RMXOS::Data::OnlineAwarenessPlayers.sub('PLAYERS',
names.join(', ')))
else
self.add_info2(RMXOS::Data::OnlineAwarenessNoPlayers)
end
return true
when /\A\/onmap\Z/
names = self.map_players.values.map {|player| player = player.username}
if names.size > 0
self.add_info2(RMXOS::Data::OnlineAwarenessMapPlayers.sub('PLAYERS',
names.join(', ')))
else
self.add_info2(RMXOS::Data::OnlineAwarenessNoMapPlayers)
end
return true
end
return check_normal_commands_online_awareness_alias(message)
end
end
end
InstructionsIn the script in the first comment.
CompatibilityRequires RMX-OS to work.
Credits and Thanks
Author's NotesIf you find any bugs, please report them here:
http://forum.chaos-project.comThat's it! N-Joy! =D