2009-05-06 02:28:09 +02:00
|
|
|
/*
|
|
|
|
* ============================================================================
|
|
|
|
*
|
2008-10-04 22:59:11 +02:00
|
|
|
* Zombie:Reloaded
|
2009-05-06 02:28:09 +02:00
|
|
|
*
|
|
|
|
* File: translation.inc
|
|
|
|
* Type: Core
|
|
|
|
* Description: Translation parsing functions.
|
|
|
|
*
|
|
|
|
* ============================================================================
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
FormatTextString(String:text[], maxlen)
|
|
|
|
{
|
|
|
|
Format(text, maxlen, "@green[%t] @default%s", "ZR", text);
|
|
|
|
|
|
|
|
ReplaceString(text, maxlen, "@default","\x01");
|
|
|
|
ReplaceString(text, maxlen, "@lgreen","\x03");
|
|
|
|
ReplaceString(text, maxlen, "@green","\x04");
|
|
|
|
}
|
|
|
|
|
|
|
|
stock ZR_PrintToChat(client, any:...)
|
|
|
|
{
|
|
|
|
decl String:phrase[192];
|
|
|
|
|
2009-04-24 05:02:19 +02:00
|
|
|
if (ZRIsClientValid(client))
|
2008-10-04 22:59:11 +02:00
|
|
|
{
|
|
|
|
SetGlobalTransTarget(client);
|
|
|
|
|
|
|
|
VFormat(phrase, sizeof(phrase), "%t", 2);
|
|
|
|
FormatTextString(phrase, sizeof(phrase));
|
|
|
|
|
|
|
|
PrintToChat(client, phrase);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SetGlobalTransTarget(client);
|
|
|
|
|
|
|
|
VFormat(phrase, sizeof(phrase), "%t", 2);
|
|
|
|
FormatTextString(phrase, sizeof(phrase));
|
|
|
|
|
|
|
|
PrintToServer(phrase);
|
|
|
|
|
2009-04-16 05:30:26 +02:00
|
|
|
for (new x = 1; x <= MaxClients; x++)
|
2008-10-04 22:59:11 +02:00
|
|
|
{
|
|
|
|
if (IsClientInGame(x))
|
|
|
|
{
|
|
|
|
SetGlobalTransTarget(x);
|
|
|
|
|
|
|
|
VFormat(phrase, sizeof(phrase), "%t", 2);
|
|
|
|
FormatTextString(phrase, sizeof(phrase));
|
|
|
|
|
|
|
|
PrintToChat(x, phrase);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stock ZR_PrintCenterText(client, any:...)
|
|
|
|
{
|
|
|
|
SetGlobalTransTarget(client);
|
|
|
|
|
|
|
|
decl String:phrase[192];
|
|
|
|
|
|
|
|
VFormat(phrase, sizeof(phrase), "%t", 2);
|
|
|
|
|
|
|
|
PrintCenterText(client, phrase);
|
|
|
|
}
|
|
|
|
|
|
|
|
stock ZR_HudHint(client, any:...)
|
|
|
|
{
|
|
|
|
SetGlobalTransTarget(client);
|
|
|
|
|
|
|
|
decl String:phrase[192];
|
|
|
|
|
|
|
|
VFormat(phrase, sizeof(phrase), "%t", 2);
|
|
|
|
|
|
|
|
new Handle:hHintText = StartMessageOne("HintText", client);
|
|
|
|
if (hHintText != INVALID_HANDLE)
|
|
|
|
{
|
|
|
|
BfWriteByte(hHintText, -1);
|
|
|
|
BfWriteString(hHintText, phrase);
|
|
|
|
EndMessage();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stock ZR_PrintToServer(any:...)
|
|
|
|
{
|
|
|
|
SetGlobalTransTarget(LANG_SERVER);
|
|
|
|
|
|
|
|
decl String:phrase[192];
|
|
|
|
decl String:buffer[192];
|
|
|
|
|
|
|
|
VFormat(phrase, sizeof(phrase), "%t", 1);
|
|
|
|
Format(buffer, sizeof(buffer), "[%t] %s", "ZR", phrase);
|
|
|
|
|
|
|
|
PrintToServer(buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
stock ZR_LogMessage(any:...)
|
|
|
|
{
|
|
|
|
SetGlobalTransTarget(LANG_SERVER);
|
|
|
|
|
|
|
|
decl String:phrase[192];
|
|
|
|
|
|
|
|
VFormat(phrase, sizeof(phrase), "%t", 1);
|
|
|
|
|
|
|
|
LogMessage(phrase);
|
|
|
|
}
|
|
|
|
|
2009-02-15 22:25:17 +01:00
|
|
|
stock ZR_TranslateMessage(String:buffer[], maxlen, any:...)
|
|
|
|
{
|
|
|
|
SetGlobalTransTarget(LANG_SERVER);
|
|
|
|
VFormat(buffer, maxlen, "%t", 3);
|
|
|
|
}
|
|
|
|
|
2008-10-04 22:59:11 +02:00
|
|
|
stock ZR_ReplyToCommand(client, any:...)
|
|
|
|
{
|
|
|
|
decl String:phrase[192];
|
|
|
|
|
|
|
|
SetGlobalTransTarget(client);
|
|
|
|
|
|
|
|
VFormat(phrase, sizeof(phrase), "%t", 2);
|
|
|
|
FormatTextString(phrase, sizeof(phrase));
|
|
|
|
|
|
|
|
ReplyToCommand(client, phrase);
|
2008-11-18 01:02:23 +01:00
|
|
|
}
|
|
|
|
|
2009-04-15 23:40:45 +02:00
|
|
|
/**
|
|
|
|
* Adds support for printing long strings.
|
2009-04-20 05:43:20 +02:00
|
|
|
*
|
|
|
|
* @param client The client index.
|
|
|
|
* @param text The text to print.
|
2009-04-15 23:40:45 +02:00
|
|
|
*/
|
|
|
|
stock ZR_ReplyToCommandLong(client, const String:text[])
|
|
|
|
{
|
2009-04-20 05:43:20 +02:00
|
|
|
decl String:partbuffer[1024];
|
2009-04-15 23:40:45 +02:00
|
|
|
new pos;
|
|
|
|
new cellswritten = 1; // Initialize for the loop.
|
|
|
|
|
|
|
|
while (cellswritten)
|
|
|
|
{
|
|
|
|
cellswritten = strcopy(partbuffer, sizeof(partbuffer), text[pos]);
|
|
|
|
ReplyToCommand(client, partbuffer);
|
|
|
|
pos += cellswritten;
|
|
|
|
}
|
2009-05-01 11:22:45 +02:00
|
|
|
}
|