Skip to content

AMX Mod X plugin that issues an alert on player join

License

Notifications You must be signed in to change notification settings

pavelkim/amxx_join_alert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

98 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AMX Mod X Join Alert plugin

Sends out notifications over a TCP Socket on the following events:

  • Player connected to the server
  • Player joined the game
  • Player left the game

Requirements

To successfully use the plugin you need the following components:

  1. HLDS Server
  2. cstrike game
  3. AMX Mod X 1.8.2
  4. TCP Socket listener

Setup

  1. Compile the plugin
  2. Copy compiled plugin into your cstrike/cstrike/addons/amxmodx/plugins directory
  3. Start TCP Socket server on tcp4:127.0.0.1:28000
  4. Restart HLDS Server

Protocol

Package scheme: EVENT\tDATASET\n Dataset scheme: FIELD1\tFIELD2\tFIELD4\tFIELDn\t

Event Fields 1 2 3 4
CONNECT 3 PlayerID SteamID PlayerName N/A
ENTER 4 PlayerID SteamID PlayerTeam PlayerName
LEAVE 4 PlayerID SteamID PlayerTeam PlayerName

Workflow

Overall process:

  1. HLDS Server is running
  2. AMX Mod X is enabled
  3. AMX Mod X has Join Alert plugin enabled
  4. Cstrike game goes on
  5. A player connects to the server
  6. Plugin triggers CONNECT event
  7. A player picks a team to join and joins it
  8. Plugin triggers ENTER event
  9. A player gets tired and leaves the game
  10. Plugin triggers LEAVE event

Event triggering process:

  1. Something happens
  2. HLDS/cstrike triggers an event
  3. AMX Mod X receives that event
  4. AMX Mod X triggers corresponging event for plugins
  5. Plugin handles event with a function

Package sending process:

  1. Nothing is happening, no sockets are open
  2. An event happens
  3. Plugin handler function being executed
  4. Hahdler function triggers say_to_socket2() function
  5. say_to_socket2() function makes an attempt to open a TCP socket
  6. say_to_socket2() function verifies if the socket was successfully opened
  7. If fails opening a socket, error is written to HLDS console and bool:false returned
  8. If no errors appeared, a message is being sent over the opened socket and then the socket is being closed

Examples

Package examples

Here goes a number of explained event and package contents examples.

  1. Player MrBean connected to the server: CONNECT 9 STEAM_0:2:90009000 MrBean
  2. Player MrBean chose to play as a CT: ENTER 9 STEAM_0:2:90009000 C MrBean
  3. Player MrBean finally left the game: LEAVE 9 STEAM_0:2:90009000 C MrBean

Using netcat to receive data from the plugin

[hlds@cs16server ~]$ nc -tl4 127.0.0.1 28000
CONNECT	9	STEAM_0:2:90009000	MrBean
ENTER	9	STEAM_0:2:90009000	C	MrBean
LEAVE	9	STEAM_0:2:90009000	C	MrBean