Chat Translator (Public Server Ai Translator)

Started by paslalalarecord holderlj record holder
01/04/2026 13:04
Page 1 of 1
paslalalarecord holderlj record holder01/04/2026 13:04(edited 01/04/2026 13:30)

Chat Translator (AI Chat Translation Plugin)


This is an AI-powered chat translation plugin for CS servers, designed to help players communicate across different languages in real time.

By default, the plugin’s interface and messages are written in Chinese, so you may want to translate or localize the strings into your own language (or English) for a better user experience. The structure is straightforward, so modifying the text is easy.

The plugin currently uses DeepSeek AI for translation, but it’s not limited to that. You can easily switch to other models like ChatGPT or Google Gemini if you prefer — the integration is simple, just change the API URL and API key.

If your server has enough resources, you can also run a local model, which gives you faster response times and removes token costs entirely.


In terms of functionality:

  • It automatically detects the language of chat messages and translates them in real time

  • You can translate your own message and send it directly using a command

  • You can view and translate other players’ chat history

  • You can enable automatic translation for specific players (for example, only translate foreign players)

Everything is done in-game with a simple menu, so no complicated setup for players.


caching system:

Since most AI services charge based on token usage, repeated translations can quickly become expensive on active servers. To solve this, the plugin includes a built-in cache:

  • If the same message is translated before, it will reuse the result

  • No extra API request is sent

  • This significantly reduces token usage

  • It also makes translations faster

This is especially useful in real servers where players often repeat common phrases.


Commands:

  • /trans or /translate - Opens the main menu (player list, chat history, auto-translation settings)

  • /st <message> - ranslates your message and sends it in the target language

  • /t - Shortcut for opening the translation menu


You can also extend it beyond Chinese and English without much effort.

Right now the plugin focuses on CN ⇄ EN translation, mainly to improve communication in the global KZ Server, where language barriers are very common.

If you want to support more languages, it’s actually very straightforward — the translation logic is centralized, so you only need to adjust the prompt or language handling part.

Overall, the goal of this plugin is simple:

to make communication in international KZ servers more accessible, reduce language barriers, and allow players from different regions to interact more naturally — whether you’re using a cloud AI service or your own local model.


Download Link: Here


Here are some key parts of the implementation for reference:

API Configuration

#define API_URL "https://api.deepseek.com/chat/completions"

#define API_KEY "API-KEY"


Language Detection

stock detect_lang_simple(const text[])

{

for (new i = 0; text != 0; i++) {

if (text & 0x80) return LANG_ZH;

}

return LANG_EN;

}


Request Body

stock build_request_body(const text[], lang, output[], outlen)

{

new JSON:root = json_init_object();

json_object_set_string(root, "model", "deepseek-chat");

new JSON:messages = json_init_array();

new JSON:msg = json_init_object();

json_object_set_string(msg, "role", "user");

new prompt[320];

if (lang == LANG_ZH) {

formatex(prompt, charsmax(prompt),

"请自动检测语言把下面文本翻译成简体中文,只输出翻译结果,不要解释,不要添加多余内容:
%s",

text);

} else {

formatex(prompt, charsmax(prompt),

"请自动检测语言把下面文本翻译成英文,只输出翻译结果,不要解释,不要添加多余内容:
%s",

text);

}

json_object_set_string(msg, "content", prompt);

json_array_append_value(messages, msg);

json_object_set_value(root, "messages", messages);

json_object_set_real(root, "temperature", 0.1);

json_object_set_number(root, "max_tokens", 120);

json_serial_to_string(root, output, outlen, false);

json_free(root);

}


Requirements:

  • AMX Mod X compiler >=1.8.2

  • JSON module version 1.9.0

Reatzh01/04/2026 22:06

Very Nice! 👍

g-Lprecord holder Tournament #103/04/2026 08:32

Pretty cool indeed

sajkee. mapperrecord holder03/04/2026 16:26

Sometimes we would need something like this on website chatbox :P

paslalalarecord holderlj record holder04/04/2026 11:13

Originally posted by sajkee.

Sometimes we would need something like this on website chatbox :P


This is a plugin for public server, but I think the website translation function should have this extension on browsers as it is simpler

D2B08/04/2026 14:26

nice

CyniuThunder08/04/2026 16:26

really cool stuff!

7yPh00Nlj record holder13/04/2026 09:49

sounds great

Page 1 of 1

Please log in to post replies.