Pawn from Scratch? Invite to join a STEAM group
About this content

Pawn from Scratch? Invite to join a STEAM group
CS 1.6 servers can become not only a place to play, but also a community that brings players together beyond the game. One effective way to create such a community is to invite players to a Steam group. In this article, we’ll look at how to write a plugin for your CS 1.6 server that automatically invites players to your Steam group.
Step 1: Installing AMX Mod X
AMX Mod X is a popular modification for CS 1.6 servers that lets you create and use various plugins. To get started, you need to install AMX Mod X on your server:
- Download AMX Mod X from the official website AMX Mod X.
- Unpack the downloaded archive and copy the files to your server’s directory.
- Configure the files
liblist.gamиmetamod.inito load AMX Mod X when the server starts.
Step 2: Getting a Steam API Key
To interact with the Steam API, you’ll need an API key. Here’s how to get one:
- Visit Steam API.
- Sign in to your Steam account.
- Get your personal API key, which will be used for requests to the Steam API.
Step 3: Installing the amx_http plugin
To send HTTP requests from the server, we’ll need the plugin amx_http. Follow these steps:
- Download and install amx_http from the GitHub repository.
- Copy the plugin files to the
addons/amxmodx/pluginsdirectory of your server. - Add the line
amx_http.amxxto the fileplugins.iniin the directoryaddons/amxmodx/configs.
Step 4: Writing a plugin to invite players
Let’s create a plugin that will send players a message with a link to join your Steam group.
- Create a new file in the
addons/amxmodx/scripting, for examplesteam_group_inviter.sma. - Add the following code:
#include <amxmodx>
#include <hamsandwich>
#include <amx_http>
#define PLUGIN "Steam Group Inviter"
#define VERSION "1.0"
#define AUTHOR "Author"
// Your Steam API key
#define STEAM_API_KEY "YOUR_STEAM_API_KEY"
// Your Steam group ID
#define STEAM_GROUP_ID "YOUR_STEAM_GROUP_ID"
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR);
register_event("ClientConnect", "OnClientConnect", "a");
}
public OnClientConnect(id) {
new authid[32];
get_user_authid(id, authid, charsmax(authid));
// Формирование сообщения со ссылкой на группу
new group_invite_message[128];
format(group_invite_message, charsmax(group_invite_message), "Присоединяйтесь к нашей Steam-группе: https://steamcommunity.com/groups/%s", STEAM_GROUP_ID);
client_print(id, print_chat, group_invite_message);
// Выполнение HTTP-запроса для добавления пользователя в группу
new query_url[256];
format(query_url, charsmax(query_url), "https://api.steampowered.com/ISteamWebAPIUtil/ResolveVanityURL/v1/?key=%s&vanityurl=%s", STEAM_API_KEY, authid);
http_get(query_url, "OnHttpRequestComplete");
}
// Function to handle HTTP request completion
public OnHttpRequestComplete(const data[], const response_code, const response_data[]) {
if (response_code == 200) {
// Обработка ответа от Steam API (если необходимо)
} else {
// Обработка ошибки HTTP-запроса
}
}
Step 5: Restarting the server
After completing all the previous steps, restart the CS 1.6 server so the new plugin can start working. Now every player who joins your server will receive a message with a link to your Steam group.
Conclusion
Creating a plugin to automatically invite players to a Steam group is a great way to expand your server community. Using AMX Mod X and the Steam API, you can easily configure such a plugin, which will not only improve interactions with players but also help your group grow.
Comments (0)