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

Add translation


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nocky
Member
Join Date: Oct 2013
Location: Czech Republic
Old 04-08-2019 , 19:30   Add translation
Reply With Quote #1

Hello, i need help with add translation to Joinmenu. I dont know how to add translation to menu, thanks for support.

PHP Code:
#include <sourcemod>
 
public onPluginStart()
{
    
LoadTranslations("joinmenu.phrases")   
}
public 
OnClientPutInServer(client)
{
        new 
Handle:menu CreatePanel();
        
SetPanelTitle(menu"MenuTitle");
        
DrawPanelText(menu"Info1");
        
DrawPanelText(menu"Info2");
        
DrawPanelItem(menu"Close");
         
        
SendPanelToClient(menuclientjoinmenu10);
        
CloneHandle(menu);
}
 
public 
joinmenu(Handle:menuMenuAction:actionclientitemNum)
{
    if( 
action == MenuAction_Select )
    {
        switch (
itemNum)
        {
            case 
ClientCommand(client"");
           
        }
    }

PHP Code:
"Phrases"
{
    
"MenuTitle"
    
{
        
"de"           "Useful commands"
        "en"            "Useful commands"  
    
}
 
    
"Info1"
    
{
        
"de"           "TEST DE"
        "en"            "TEST EN"
    
}
    
"Info2"
    
{
        
"de"           "TEST DE"
        "en"            "TEST EN"
    
}
    
"Close"
    
{
        
"de"           "EXIT"
        "en"            "Exit" 
    
}

Nocky is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 04-09-2019 , 04:31   Re: Add translation
Reply With Quote #2

Quote:
Originally Posted by Nocky View Post
Hello, i need help with add translation to Joinmenu. I dont know how to add translation to menu, thanks for support.

PHP Code:
#include <sourcemod>
 
public onPluginStart()
{
    
LoadTranslations("joinmenu.phrases")   
}
public 
OnClientPutInServer(client)
{
        new 
Handle:menu CreatePanel();
        
SetPanelTitle(menu"MenuTitle");
        
DrawPanelText(menu"Info1");
        
DrawPanelText(menu"Info2");
        
DrawPanelItem(menu"Close");
         
        
SendPanelToClient(menuclientjoinmenu10);
        
CloneHandle(menu);
}
 
public 
joinmenu(Handle:menuMenuAction:actionclientitemNum)
{
    if( 
action == MenuAction_Select )
    {
        switch (
itemNum)
        {
            case 
ClientCommand(client"");
           
        }
    }

PHP Code:
"Phrases"
{
    
"MenuTitle"
    
{
        
"de"           "Useful commands"
        "en"            "Useful commands"  
    
}
 
    
"Info1"
    
{
        
"de"           "TEST DE"
        "en"            "TEST EN"
    
}
    
"Info2"
    
{
        
"de"           "TEST DE"
        "en"            "TEST EN"
    
}
    
"Close"
    
{
        
"de"           "EXIT"
        "en"            "Exit" 
    
}

https://wiki.alliedmods.net/Translat...ge_in_a_Plugin

so an example in old syntax

PHP Code:
new String:buffer[128];
Format(buffersizeof(buffer), "%T""MenuTitle"client);
SetPanelTitle(menubuffer); 
__________________
8guawong is offline
Nocky
Member
Join Date: Oct 2013
Location: Czech Republic
Old 04-09-2019 , 06:44   Re: Add translation
Reply With Quote #3

This not working, where is problem ?

PHP Code:
#include <sourcemod>
#pragma tabsize 0

public onPluginStart()
{
    
LoadTranslations("joinmenu.phrases")    
}
public 
OnClientPutInServer(client)
{
        new 
Handle:menu CreatePanel(); 
        
        new 
String:buffer[128]; 
        
Format(buffersizeof(buffer), "%T""MenuTitle"client); 
        
SetPanelTitle(menubuffer);  
        
        
Format(buffersizeof(buffer), "%T""Info1"client);
        
DrawPanelText(menubuffer); 
        
        
Format(buffersizeof(buffer), "%T""Info2"client);
        
DrawPanelText(menubuffer); 
        
        
Format(buffersizeof(buffer), "%T""Close"client);
        
DrawPanelText(menubuffer); 


        
SendPanelToClient(menuclientjoinmenu10); 
        
CloneHandle(menu); 
}

public 
joinmenu(Handle:menuMenuAction:actionclientitemNum)
{
    if( 
action == MenuAction_Select )
    {
        switch (
itemNum)
        {
            case 
ClientCommand(client""); 
            
        }
    }

Nocky is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 04-09-2019 , 08:55   Re: Add translation
Reply With Quote #4

Quote:
Originally Posted by Nocky View Post
This not working, where is problem ?

PHP Code:
#include <sourcemod>
#pragma tabsize 0

public onPluginStart()
{
    
LoadTranslations("joinmenu.phrases")    
}
public 
OnClientPutInServer(client)
{
        new 
Handle:menu CreatePanel(); 
        
        new 
String:buffer[128]; 
        
Format(buffersizeof(buffer), "%T""MenuTitle"client); 
        
SetPanelTitle(menubuffer);  
        
        
Format(buffersizeof(buffer), "%T""Info1"client);
        
DrawPanelText(menubuffer); 
        
        
Format(buffersizeof(buffer), "%T""Info2"client);
        
DrawPanelText(menubuffer); 
        
        
Format(buffersizeof(buffer), "%T""Close"client);
        
DrawPanelText(menubuffer); 


        
SendPanelToClient(menuclientjoinmenu10); 
        
CloneHandle(menu); 
}

public 
joinmenu(Handle:menuMenuAction:actionclientitemNum)
{
    if( 
action == MenuAction_Select )
    {
        switch (
itemNum)
        {
            case 
ClientCommand(client""); 
            
        }
    }

what do you mean not working?
its not compiling? its not showing the panel? its not showing translation?
you have to be more specific if you want people to help you
__________________
8guawong is offline
Nocky
Member
Join Date: Oct 2013
Location: Czech Republic
Old 04-09-2019 , 10:58   Re: Add translation
Reply With Quote #5

Sorry
Compiling works, but menu dont show when i join to server.
Nocky is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 04-09-2019 , 14:12   Re: Add translation
Reply With Quote #6

Quote:
Originally Posted by Nocky View Post
Sorry
Compiling works, but menu dont show when i join to server.
OnClientPutInServer is too early i think try player_spawn event
__________________
8guawong is offline
Nocky
Member
Join Date: Oct 2013
Location: Czech Republic
Old 04-09-2019 , 14:35   Re: Add translation
Reply With Quote #7

I'd rather need this menu to show up when the player joins. Not when he spawns :/

This is menu without translation and works.

PHP Code:
#include <sourcemod>

public OnClientPutInServer(client)
{
        new 
Handle:menu CreatePanel(); 
        
SetPanelTitle(menu"TEST MENU"); 
         
        
DrawPanelText(menu"TEST 1"); 
        
DrawPanelText(menu"TEST 2");
        
        
DrawPanelItem(menu"Close"); 
         
        
SendPanelToClient(menuclientjoinmenu10); 
        
CloneHandle(menu); 
}

public 
joinmenu(Handle:menuMenuAction:actionclientitemNum)
{
    if( 
action == MenuAction_Select )
    {
        switch (
itemNum)
        {
            case 
ClientCommand(client""); 
            
        }
    }

Nocky is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 04-09-2019 , 16:29   Re: Add translation
Reply With Quote #8

You could try OnClientPostAdminCheck which fires after OnClientPutInServer (and OnClientAuthorized).

There's just one catch: it doesn't fire if Steam is down.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 04-14-2019 , 10:05   Re: Add translation
Reply With Quote #9

Code:
CloneHandle(menu);
What is it? Double-memory leak?
Where CloseHandle?
Go to wiki, see how to do it properly.
__________________
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 04-14-2019 , 10:26   Re: Add translation
Reply With Quote #10

Quote:
Originally Posted by Powerlord View Post
You could try OnClientPostAdminCheck which fires after OnClientPutInServer (and OnClientAuthorized).

There's just one catch: it doesn't fire if Steam is down.
hmm, all of them (client.inc) forwards become useless? Any walkaround?
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas 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 03:48.


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