He wants to replace Hook Message text in the screen language (English to Spanish)
The original text in the game
Half-Life
Adrenaline Gamer
The image at the top is an attempt to do so but he finds it difficult to determine the message
Here are some attempts
PHP Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>
#pragma ctrlchar '\'
#define AUTHOR "Lev"
#define PLUGIN "test"
#define VERSION "0.0"
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_srvcmd("test", "cmd_test");
}
public cmd_test(id)
{
server_print("------------");
new text[256];
copy(text, charsmax(text), "Match Player1 vs Player2 in 9 seconds!");
new len = strlen(text);
server_print("len: %i", len);
// Test if string do match what we expect
if (contain(text, "Match ") != 0 || len < 15)
return;
// Search for last space char
new posSecondsText = len - 1;
while (posSecondsText > 0 && text[posSecondsText] != ' ') posSecondsText--;
if (posSecondsText == 0)
return;
server_print("posSecondsText 1: %i", posSecondsText);
if (!equal(text[posSecondsText], " seconds!"))
return;
// Cut " seconds!" text
text[posSecondsText] = 0;
// Search for last space char
while (posSecondsText > 0 && text[posSecondsText] != ' ') posSecondsText--;
if (posSecondsText == 0)
return;
server_print("posSecondsText 2: %i", posSecondsText);
// Get seconds number
new seconds = str_to_num(text[posSecondsText]);
server_print("seconds: %i", seconds);
// Cut seconds number
text[posSecondsText] = 0;
if (posSecondsText < 3 || !equal(text[posSecondsText - 3], " in"))
return;
// Cut " in" text
text[posSecondsText - 3] = 0;
// Get player names
new names[256];
copy (names, charsmax(names), text[6]);
// Format result string
new outText[256];
format(outText, charsmax(outText), "Duelo entre %s en %i segundos!!!", names, seconds);
server_print("result: %s", outText);
}
Quote:
test
------------
len: 38
posSecondsText 1: 29
posSecondsText 2: 27
seconds: 9
result: Duelo entre Player1 vs Player2 en 9 segundos!!!
|
Note :
The source of the message in
client.dll not plugin .
__________________