Skip to content
Permalink
Browse files

Translation support for most chat messages

  • Loading branch information...
TotallyMehis committed Jul 5, 2019
1 parent 55a91a8 commit 50c337ff5280bf74c39ecd75c2f20131ecab6e80
@@ -457,6 +457,12 @@ public void OnPluginStart()
g_hForward_OnSearchTelePos = CreateGlobalForward( "Influx_OnSearchTelePos", ET_Hook, Param_Array, Param_CellByRef, Param_Cell, Param_Cell );



// PHRASES
LoadTranslations( INFLUX_PHRASES );



// CONVARS
CreateConVar( "influx_version", INF_VERSION, "Version of Influx. Do not change.", FCVAR_NOTIFY );

@@ -1024,7 +1030,7 @@ stock void CapWeaponSpeed( int client )
&& (GetEngineTime() - g_flLastValidWepSpd[client]) > 0.2 // We have the invalid weapon out for more than this.
&& g_flNextWepSpdPrintTime[client] < GetEngineTime() )
{
Influx_PrintToChat( _, client, "Invalid weapon speed! Can be {MAINCLR1}%.0f{CHATCLR} at most!", modemaxspd );
Influx_PrintToChat( _, client, "%T", "INF_INVALIDWEAPONSPD", client, RoundFloat( modemaxspd ) );

g_flNextWepSpdPrintTime[client] = GetEngineTime() + 10.0;
}
@@ -1783,7 +1789,7 @@ stock void PrintValidModes( int client, int modeflags )
strcopy( list, sizeof( list ), "{MAINCLR1}None{CHATCLR}!" );
}

Influx_PrintToChat( _, client, "Valid mode(s): %s", list );
Influx_PrintToChat( _, client, "%T", "INF_VALIDMODES", client, list );
}

stock bool SetClientRun( int client, int runid, bool bTele = true, bool bPrintToChat = true )
@@ -1836,7 +1842,7 @@ stock bool SetClientRun( int client, int runid, bool bTele = true, bool bPrintTo

if ( bPrintToChat )
{
Influx_PrintToChat( _, client, "Your run is now {MAINCLR1}%s{CHATCLR}!", sz );
Influx_PrintToChat( _, client, "%T", "INF_RUNISNOW", client, sz );
}
}

@@ -1898,7 +1904,7 @@ stock bool SetClientMode( int client, int mode, bool bTele = true, bool bPrintTo
{
if ( bPrintToChat )
{
Influx_PrintToChat( _, client, "You do not have access to this mode!" );
Influx_PrintToChat( _, client, "%T", "INF_NOACCESSTO", client, "INF_WORD_MODE" );
}

return false;
@@ -1921,7 +1927,7 @@ stock bool SetClientMode( int client, int mode, bool bTele = true, bool bPrintTo
{
if ( bPrintToChat )
{
Influx_PrintToChat( _, client, "Something went wrong when changing your mode!" );
Influx_PrintToChat( _, client, "%T", "INF_WENTWRONGCHANGING", client, "INF_WORD_MODE" );
}

// Fallback to last mode.
@@ -1935,7 +1941,7 @@ stock bool SetClientMode( int client, int mode, bool bTele = true, bool bPrintTo
char sz[MAX_MODE_NAME];
GetModeNameByIndex( imode, sz, sizeof( sz ) );

Influx_PrintToChat( _, client, "Your mode is now {MAINCLR1}%s{CHATCLR}!", sz );
Influx_PrintToChat( _, client, "%T", "INF_MODEORSTYLEISNOW", client, "INF_WORD_MODE", sz );
}


@@ -1986,7 +1992,7 @@ stock bool SetClientStyle( int client, int style, bool bTele = true, bool bPrint
{
if ( bPrintToChat )
{
Influx_PrintToChat( _, client, "You do not have access to this style!" );
Influx_PrintToChat( _, client, "%T", "INF_NOACCESSTO", client, "INF_WORD_STYLE" );
}

return false;
@@ -2007,7 +2013,7 @@ stock bool SetClientStyle( int client, int style, bool bTele = true, bool bPrint

if ( res != Plugin_Continue )
{
Influx_PrintToChat( _, client, "Something went wrong when changing your style!" );
Influx_PrintToChat( _, client, "%T", "INF_WENTWRONGCHANGING", client, "INF_WORD_STYLE" );

// Fallback to last style.
style = laststyle;
@@ -2020,7 +2026,7 @@ stock bool SetClientStyle( int client, int style, bool bTele = true, bool bPrint
char sz[MAX_STYLE_NAME];
GetStyleNameByIndex( istyle, sz, sizeof( sz ) );

Influx_PrintToChat( _, client, "Your style is now {MAINCLR1}%s{CHATCLR}!", sz );
Influx_PrintToChat( _, client, "%T", "INF_MODEORSTYLEISNOW", client, "INF_WORD_STYLE", sz );
}

g_iStyleId[client] = style;
@@ -2064,7 +2070,7 @@ stock bool IsClientModeValidForRun( int client, int imode, int irun, bool bPrint
GetModeNameByIndex( imode, mode, sizeof( mode ) );
GetRunNameByIndex( irun, run, sizeof( run ) );

Influx_PrintToChat( _, client, "Sorry, mode {MAINCLR1}%s{CHATCLR} is not allowed in {MAINCLR1}%s{CHATCLR}!", mode, run );
Influx_PrintToChat( _, client, "%T", "INF_MODEORSTYLENOTALLOWEDINRUN", client, "INF_WORD_MODE", mode, run );
}

return false;
@@ -2092,7 +2098,7 @@ stock bool ChangeTele( int client )
}


Influx_PrintToChat( _, client, "You must enter a start zone/wait till next spawn." );
Influx_PrintToChat( _, client, "%T", "INF_WAITTILLSPAWN", client );
return false;
}

@@ -2236,7 +2242,7 @@ stock void InvalidateClientRun( int client )
{
if ( g_iRunState[client] == STATE_RUNNING )
{
Influx_PrintToChat( _, client, "Your timer has been disabled!" );
Influx_PrintToChat( _, client, "%T", "INF_TIMERDISABLED", client );
}

g_iRunState[client] = STATE_NONE;
@@ -2607,7 +2613,7 @@ stock bool RemoveClientTimes( int client, int irun, int mode, int style, bool bP
Inf_FormatSeconds( time, szTime, sizeof( szTime ) );


Influx_PrintToChat( _, client, "Your {MAINCLR1}%s %s{CHATCLR} run has been deleted!", szRun, szTime );
Influx_PrintToChat( _, client, "%T", "INF_RUNS_DELETED", client, szRun, szTime );
}
}

@@ -2616,7 +2622,7 @@ stock bool RemoveClientTimes( int client, int irun, int mode, int style, bool bP

if ( found )
{
Influx_PrintToChat( _, client, "Your {MAINCLR1}%s{CHATCLR} runs has been deleted!", szRun );
Influx_PrintToChat( _, client, "%T", "INF_RUN_RUNS_DELETED", client, szRun );
}


@@ -2873,7 +2879,7 @@ stock int AddRun( int runid,
}

if ( bPrint )
Influx_PrintToChatAll( _, 0, "{MAINCLR1}%s{CHATCLR} has been created!", szRun );
Influx_PrintToChatAll( _, 0, "%T", "INF_RUN_CREATED", LANG_SERVER, szRun );


return runid;
@@ -2885,7 +2891,7 @@ stock void RemoveRunById( int runid, int client = 0 )

if ( irun == -1 )
{
Inf_ReplyToClient( client, "Run with an ID of {MAINCLR1}%i{CHATCLR} does not exist!", runid );
Inf_ReplyToClient( client, "%T", "INF_RUNIDNOTEXIST", client, runid );
return;
}

@@ -2907,7 +2913,7 @@ stock void RemoveRunById( int runid, int client = 0 )
DB_RemoveRun( runid );


Inf_ReplyToClient( client, "Run {MAINCLR1}%s{CHATCLR} has been deleted! Remember to {MAINCLR1}!saveruns{CHATCLR}.", szRun );
Inf_ReplyToClient( client, "%T", "INF_RUN_DELETED", client, szRun );
}

stock void TeleportClientsOutOfRun( int runid )
@@ -83,7 +83,7 @@ public Action Cmd_Admin_SetTelePos( int client, int args )
}
else
{
Influx_PrintToChat( _, client, "Run with an ID of {MAINCLR1}%i{CHATCLR} does not exist!", runid );
Influx_PrintToChat( _, client, "%T", "INF_RUNIDNOTEXIST", client, runid );
}

return Plugin_Handled;
@@ -127,7 +127,7 @@ public Action Cmd_Admin_SetRunName( int client, int args )
SetRunNameByIndex( index, szNew );


Influx_PrintToChatAll( _, client, "Run {MAINCLR1}%s{CHATCLR} has been renamed to {MAINCLR1}%s{CHATCLR}!", szOld, szNew );
Influx_PrintToChatAll( _, client, "%T", "INF_RUN_RENAMED", LANG_SERVER, szOld, szNew );


if ( !client )
@@ -139,7 +139,7 @@ public Action Cmd_Admin_SetRunName( int client, int args )
{
if ( client )
{
Influx_PrintToChat( _, client, "Run with an ID of {MAINCLR1}%i{CHATCLR} does not exist!", runid );
Influx_PrintToChat( _, client, "%T", "INF_RUNIDNOTEXIST", client, runid );
}
else
{
@@ -146,7 +146,7 @@ public Action Cmd_Practise_Continue( int client, int args )
}
else
{
Influx_PrintToChat( _, client, "%T", "NOTPAUSED", client );
Influx_PrintToChat( _, client, "%T", "INF_NOTPAUSED", client );
}

return Plugin_Handled;
@@ -158,7 +158,7 @@ public Action Cmd_Practise_Pause( int client, int args )

if ( Influx_GetClientState( client ) != STATE_RUNNING )
{
Influx_PrintToChat( _, client, "%T", "MUSTBERUNNING", client );
Influx_PrintToChat( _, client, "%T", "INF_MUSTBERUNNING", client );
return Plugin_Handled;
}

@@ -173,7 +173,7 @@ public Action Cmd_Practise_Pause( int client, int args )
}
else
{
Influx_PrintToChat( _, client, "%T", "CANTPAUSE_PRAC", client );
Influx_PrintToChat( _, client, "%T", "INF_CANTPAUSE_PRAC", client );
}

return Plugin_Handled;
@@ -185,21 +185,24 @@ stock bool PauseRun( int client )

if ( Influx_GetClientState( client ) != STATE_RUNNING )
{
Influx_PrintToChat( _, client, "%T", "MUSTBERUNNING", client );
Influx_PrintToChat( _, client, "%T", "INF_MUSTBERUNNING", client );
return false;
}


if ( !IsPlayerAlive( client ) )
{
Influx_PrintToChat( _, client, "You must be alive to pause!" );
Influx_PrintToChat( _, client, "%T", "INF_MUSTBEALIVE", client );
return false;
}


if ( g_flPauseLimit[client] > GetEngineTime() )
{
Influx_PrintToChat( _, client, "You cannot pause so soon! Please wait {MAINCLR1}%.1f{CHATCLR} seconds!", g_flPauseLimit[client] - GetEngineTime() );
Influx_PrintToChat( _, client, "%T",
"INF_PAUSENOTSOFAST",
client,
RoundFloat( g_flPauseLimit[client] - GetEngineTime() ) );
return false;
}

@@ -208,13 +211,13 @@ stock bool PauseRun( int client )

if ( !maxpauses )
{
Influx_PrintToChat( _, client, "Pauses aren't allowed!" );
Influx_PrintToChat( _, client, "%T", "INF_PAUSENOTALLOWED", client );
return false;
}

if ( maxpauses > 0 && g_nPauses[client] >= maxpauses )
{
Influx_PrintToChat( _, client, "You cannot pause more than %i time(s) every run!", maxpauses );
Influx_PrintToChat( _, client, "%T", "INF_PAUSELIMIT", client, maxpauses );
return false;
}

@@ -252,7 +255,7 @@ stock bool PauseRun( int client )

GetEntPropString( client, Prop_Data, "m_iName", g_szPausedTargetName[client], sizeof( g_szPausedTargetName[] ) );

Influx_PrintToChat( _, client, "Your run is now paused. Type {MAINCLR1}!continue{CHATCLR} to resume." );
Influx_PrintToChat( _, client, "%T", "INF_NOWPAUSED", client );

return true;
}
@@ -312,7 +315,7 @@ stock bool ContinueRun( int client )

SetEntPropString( client, Prop_Data, "m_iName", g_szPausedTargetName[client] );

Influx_PrintToChat( _, client, "Your run is no longer paused." );
Influx_PrintToChat( _, client, "%T", "INF_NOLONGERPAUSED", client );

return true;
}
@@ -94,6 +94,7 @@ public APLRes AskPluginLoad2( Handle hPlugin, bool late, char[] szError, int err

public void OnPluginStart()
{
// PHRASES
LoadTranslations( INFLUX_PHRASES );


@@ -196,7 +197,7 @@ public Action Cmd_AddCP( int client, int args )

if ( !g_bPractising[client] )
{
Influx_PrintToChat( _, client, "%T", "MUSTBEPRACTISING", client );
Influx_PrintToChat( _, client, "%T", "INF_MUSTBEPRACTISING", client );
return Plugin_Handled;
}

@@ -212,7 +213,7 @@ public Action Cmd_LastUsedCP( int client, int args )

if ( !g_bPractising[client] )
{
Influx_PrintToChat( _, client, "%T", "MUSTBEPRACTISING", client );
Influx_PrintToChat( _, client, "%T", "INF_MUSTBEPRACTISING", client );
return Plugin_Handled;
}

@@ -228,7 +229,7 @@ public Action Cmd_LastCreatedCP( int client, int args )

if ( !g_bPractising[client] )
{
Influx_PrintToChat( _, client, "%T", "MUSTBEPRACTISING", client );
Influx_PrintToChat( _, client, "%T", "INF_MUSTBEPRACTISING", client );
return Plugin_Handled;
}

@@ -244,7 +245,7 @@ public Action Cmd_CPMenu( int client, int args )

if ( !g_bPractising[client] )
{
Influx_PrintToChat( _, client, "%T", "MUSTBEPRACTISING", client );
Influx_PrintToChat( _, client, "%T", "INF_MUSTBEPRACTISING", client );
return Plugin_Handled;
}

@@ -350,7 +351,7 @@ public int Hndlr_CP( Menu menu, MenuAction action, int client, int menuindex )
if ( !g_bPractising[client] )
{
Influx_PrintToChat( _, client, "%T", "MUSTBEPRACTISING", client );
Influx_PrintToChat( _, client, "%T", "INF_MUSTBEPRACTISING", client );
return Plugin_Handled;
}
@@ -594,7 +595,7 @@ stock bool StartPractising( int client )
}


Influx_PrintToChat( _, client, "Practice mode: {MAINCLR1}ON" );
Influx_PrintToChat( _, client, "%T", "INF_PRACTICEMODECHANGE", client, "ON" );

return true;
}
@@ -617,7 +618,7 @@ stock void EndPractising( int client )
Influx_TeleportToStart( client, true );
}

Influx_PrintToChat( _, client, "Practice mode: {MAINCLR1}OFF" );
Influx_PrintToChat( _, client, "%T", "INF_PRACTICEMODECHANGE", client, "OFF" );
}

public int Native_IsClientPractising( Handle hPlugin, int nParams )
@@ -93,6 +93,10 @@ public void OnPluginStart()
g_hPre = new ArrayList( PRESPEED_SIZE );


// PHRASES
LoadTranslations( INFLUX_PHRASES );


// FORWARDS
g_hForward_OnLimitClientPrespeed = CreateGlobalForward( "Influx_OnLimitClientPrespeed", ET_Hook, Param_Cell, Param_Cell );

@@ -270,7 +274,7 @@ public Action Influx_OnTimerStart( int client, int runid, char[] errormsg, int e

if ( g_ConVar_Noclip.BoolValue && g_bUsedNoclip[client] )
{
FormatEx( errormsg, error_len, "You cannot prespeed with noclip!" );
FormatEx( errormsg, error_len, "%T", "INF_PRESPEEDNONOCLIP", client );
return Plugin_Handled;
}

@@ -288,11 +292,11 @@ public Action Influx_OnTimerStart( int client, int runid, char[] errormsg, int e
{
if ( maxjumps )
{
FormatEx( errormsg, error_len, "You cannot jump more than {MAINCLR1}%i{CHATCLR} time(s) at the start!", maxjumps );
FormatEx( errormsg, error_len, "%T", "INF_PRESPEEDJUMPLIMIT", client, maxjumps );
}
else
{
FormatEx( errormsg, error_len, "You cannot jump at all at the start!" );
FormatEx( errormsg, error_len, "%T", "INF_PRESPEEDNOJUMP", client );
}


@@ -354,6 +358,7 @@ public Action Influx_OnTimerStart( int client, int runid, char[] errormsg, int e
}
else
{
FormatEx( errormsg, error_len, "%T", "INF_PRESPEEDEXCEED", client, RoundFloat( maxprespd ) );
FormatEx( errormsg, error_len, "Your prespeed cannot exceed {MAINCLR1}%.0f{CHATCLR}!", maxprespd );
return Plugin_Handled;
}

0 comments on commit 50c337f

Please sign in to comment.
You can’t perform that action at this time.