Raised This Month: $51 Target: $400
 12% 

translation file create


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
alphaearth
Senior Member
Join Date: Feb 2018
Location: Turkey
Old 03-07-2019 , 16:10   translation file create
Reply With Quote #1

PHP Code:
#pragma tabsize 0
#pragma semicolon 1

#define PLUGIN_AUTHOR "LazHoroni"
#define PLUGIN_VERSION "1.00"

#include <steamworks>
#include <sdktools>
#include <swgm>

int g_iRound;
Handle g_hCvRestart;

public 
Plugin myinfo 
{
    
name "",
    
author PLUGIN_AUTHOR,
    
description "",
    
version PLUGIN_VERSION,
    
url ""
};

public 
void OnPluginStart()
{
    
HookEvent("round_start"lazRoundStart);
    
g_hCvRestart FindConVar("mp_restartgame");
    
HookConVarChange(g_hCvRestartlazCvarChange);
}

public 
void OnMapStart()
{
    
g_iRound 0;
}

public 
void OnMapEnd()
{
    
g_iRound 0;
}

public 
void lazCvarChangeHandle hCvar, const char[] sOldValue, const char[] sNewValue )
{
    if( 
StringToInt(sNewValue) > g_iRound 0;
}

public 
Action lazRoundStart(Handle hEvent, const char[] Namebool dontbroadcast)
{
    if (
GameRules_GetProp("m_bWarmupPeriod") == 0)
    {
        
g_iRound++;
        if(
g_iRound != && g_iRound != && g_iRound != && g_iRound != 16 && g_iRound != 17 && g_iRound != 18)
        {
            for (
int iClient 1iClient <= MaxClientsiClient++)
            {
                if (
IsClientInGame(iClient))
                {
                        if(
SWGM_IsPlayerValidated(iClient) && !SWGM_InGroup(iClient))
                        {
                            
PrintToChat(iClient" \x04Gruba katılarak \x07+$1000 \x04kazanabilirsiniz.");
                            
PrintToChat(iClient" \x04Skor tablosundaki \x07SUNUCU İNTERNET SİTESİ\x04'ne tıklayarak gruba katılabilirsin.");
                            
SetEntProp(iClientProp_Send"m_bHasHelmet"100);
                            
SetEntProp(iClientProp_Send"m_ArmorValue"100);
                        }
                        else
                        {
                            
PrintToChat(iClient" \x04Gruba katıldığınız için \x07+$1000 \x04kazandınız.");
                            
int Parasi GetEntProp(iClientProp_Send"m_iAccount");
                            
SetEntProp(iClientProp_Send"m_iAccount"Parasi 1000);
                            
SetEntProp(iClientProp_Send"m_bHasHelmet"100);
                            
SetEntProp(iClientProp_Send"m_ArmorValue"100);
                        }
                }
            }
        }
        else
        {
            for (
int iClient 1iClient <= MaxClientsiClient++)
            {
                if (
IsClientInGame(iClient))
                {
                        if(
SWGM_IsPlayerValidated(iClient) && !SWGM_InGroup(iClient))
                        {
                            
PrintToChat(iClient" \x04Gruba katılarak \x07+$1000 \x04kazanabilirsiniz.");
                            
PrintToChat(iClient" \x04Skor tablosundaki \x07SUNUCU İNTERNET SİTESİ\x04'ne tıklayarak gruba katılabilirsin.");
                        }
                        else
                        {
                            
PrintToChat(iClient" \x04İlk 3 round \x07+$1000, zırh ve kask \x04devre dışıdır.");
                        }
                }
            }
        }
    }

resource: https://github.com/lazhoroni/SWGM/bl...g/swgm_para.sp

I've created a translation file using multicolors, and I've hooked it up. but I got the bugs in the plugin. how can I do it?
I want to use printtochat instead of cprinttochat.
__________________

Last edited by alphaearth; 03-07-2019 at 16:11.
alphaearth is offline
impossible_cc
Senior Member
Join Date: Sep 2018
Location: Ukraine
Old 03-07-2019 , 17:22   Re: translation file create
Reply With Quote #2

https://forums.alliedmods.net/showthread.php?t=187746

https://forums.alliedmods.net/showthread.php?t=313193
impossible_cc is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 03-07-2019 , 18:13   Re: translation file create
Reply With Quote #3

I thinks is not possible to set the color in the translation file without the multicolors (or any of the kind...maybe replacing the output string?)

Here is an example with parameters (doesn't looks like to fill what you want, but can give you some tip):

#define CHAT_TAG "\x04[\x05CHAT TAG\x04]\x01"
#define T_ANY "Any"

char sColoredParameter[32];
Format(sColoredParameter, sizeof(sColoredParameter), "\x04%s\x01", "A string");

PrintToChat(client, "%s %T", CHAT_TAG, T_ANY, client, sColoredParameter);

Code:
"Phrases"
{
	"Any"
	{
		"#format"	"{1:s}"
		"en"		"Example with a colored parameter, from here {1} until here."
	}
}
Not tested.

Last edited by Marttt; 03-07-2019 at 18:16.
Marttt is offline
impossible_cc
Senior Member
Join Date: Sep 2018
Location: Ukraine
Old 03-08-2019 , 12:41   Re: translation file create
Reply With Quote #4

Quote:
Originally Posted by Marttt View Post
I thinks is not possible to set the color in the translation file without the multicolors (or any of the kind...maybe replacing the output string?)

Here is an example with parameters (doesn't looks like to fill what you want, but can give you some tip):

#define CHAT_TAG "\x04[\x05CHAT TAG\x04]\x01"
#define T_ANY "Any"

char sColoredParameter[32];
Format(sColoredParameter, sizeof(sColoredParameter), "\x04%s\x01", "A string");

PrintToChat(client, "%s %T", CHAT_TAG, T_ANY, client, sColoredParameter);

Code:
"Phrases"
{
	"Any"
	{
		"#format"	"{1:s}"
		"en"		"Example with a colored parameter, from here {1} until here."
	}
}
Not tested.
Check first link in my answer. Obviously, it is possible without multicolors etc.
It is simple if you use notepad++.

Last edited by impossible_cc; 03-08-2019 at 12:43.
impossible_cc is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 03-08-2019 , 13:39   Re: translation file create
Reply With Quote #5

Check how I do it in Useful Commands without any includes
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 03-08-2019 , 13:40   Re: translation file create
Reply With Quote #6

I'm sorry, I did a quick reading and did not see that at the end of the first link there was an option with notepad++

thanks, is nice to learn something new.

So alphaearth, check the links above
Marttt is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 03-09-2019 , 13:43   Re: translation file create
Reply With Quote #7

alphaearth, use the stock: https://forums.alliedmods.net/showthread.php?p=2642602
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 03-09-2019 , 13:47   Re: translation file create
Reply With Quote #8

Quote:
I want to use printtochat instead of cprinttochat.
any problems with Find => Replace menu in N++?

Quote:
Code:
PrintToChat(iClient, " \x04Gruba katılarak \x07+$1000 \x04kazanabilirsiniz.");
Remove leading space character.
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline
SpirT
Senior Member
Join Date: Sep 2018
Location: Portugal
Old 03-09-2019 , 14:08   Re: translation file create
Reply With Quote #9

Quote:
I want to use printtochat instead of cprinttochat.
Hey! First do not forgot to add on public void OnPluginStart():
PHP Code:
LoadTranslation("nameoffile.txt"); 
And for using PrintToChat with colors you should use this:
Code:
default (white): \x01
teamcolour (will be purple if message from server): \x03
red: \x07
lightred: \x0F
darkred: \x02
bluegrey: \x0A
blue: \x0B
darkblue: \x0C
purple: \x03
orchid: \x0E
yellow: \x09
gold: \x10
lightgreen: \x05
green: \x04
lime: \x06
grey: \x08
grey2: \x0D
Hope I could help you and have a nice day
__________________
SpirT is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:22.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode