The online racing simulator
Language Selection
(13 posts, closed, started )
Language Selection
Good, I would like to request a script that when you connect to the server lets you select the system language... that the language buttons appear and let you select the language for each country.

If it's not too much trouble, thanks a lot!
-
(kristofferandersen) DELETED by kristofferandersen : *realizes what section this is*
Did you see in the section that is published the topic?
Few examples with explanation:

Create a button:
openPrivButton( "lang_en",30,30,4,4,5,-1,32, "^3EN" ,SetLanguage);

When the player click on the button it calls a sub named 'SetLanguage'.


<?php 
Sub SetLanguage
$KeyFlags,$ButtonID  )
   
#Cut the first 5 chars of the buttonID , result = 'en'
   
$language trimsubStr$ButtonID,) );

   
#When the value/string of $language is equal to 'en'
   
IF($language == "en")THEN
      SetCurrentPlayerVar
("IdLang","en"); #Set player language to English
   
ENDIF
EndSub
?>


Create a button for the LFSLapperlanguage_engine
openPrivButton( "example",75,111,50,10,5,-1,ISB_DARK, langEngine("%{example}%"));

To define "example" in english.

Lang "EN"
example = "This text is an exampletext";
EndLang

THANK YOU Bass-DriverThumbs up
Quote from Bass-Driver :Few examples with explanation:

Create a button:
openPrivButton( "lang_en",30,30,4,4,5,-1,32, "^3EN" ,SetLanguage);

When the player click on the button it calls a sub named 'SetLanguage'.


<?php 
Sub SetLanguage
$KeyFlags,$ButtonID  )
   
#Cut the first 5 chars of the buttonID , result = 'en'
   
$language trimsubStr$ButtonID,) );

   
#When the value/string of $language is equal to 'en'
   
IF($language == "en")THEN
      SetCurrentPlayerVar
("IdLang","en"); #Set player language to English
   
ENDIF
EndSub
?>


Create a button for the LFSLapperlanguage_engine
openPrivButton( "example",75,111,50,10,5,-1,ISB_DARK, langEngine("%{example}%"));

To define "example" in english.

Lang "EN"
example = "This text is an exampletext";
EndLang


It has not worked for me: /

Could you make me a script that changes the language? Please use it as base ....
The script Bass-Driver gave is very basic Lapper code, so why doesn't that work for you?
Do you get an error and if so, what's shown?
I made a Menu system years ago that has section for choosing languages HERE, although you could easily just use !myconfig by making a button that calls that sub.
Quote from Bass-Driver :Few examples with explanation:

Create a button:
openPrivButton( "lang_en",30,30,4,4,5,-1,32, "^3EN" ,SetLanguage);

When the player click on the button it calls a sub named 'SetLanguage'.


<?php 
Sub SetLanguage
$KeyFlags,$ButtonID  )
   
#Cut the first 5 chars of the buttonID , result = 'en'
   
$language trimsubStr$ButtonID,) );

   
#When the value/string of $language is equal to 'en'
   
IF($language == "en")THEN
      SetCurrentPlayerVar
("IdLang","en"); #Set player language to English
   
ENDIF
EndSub
?>


Create a button for the LFSLapperlanguage_engine
openPrivButton( "example",75,111,50,10,5,-1,ISB_DARK, langEngine("%{example}%"));

To define "example" in english.

Lang "EN"
example = "This text is an exampletext";
EndLang


7/25/2017 4:31:58 AM -> Syntax error in cfg file ".\default\SISTEMAS.lpr" at line #193
';' needed
Function 'setlanguage' script aborted
Post your code!!! , we cant help you with this.
Tested the code and everything works perfectly.

Testcode:

CatchEvent OnNewPlayerJoin( $userName ) # Player event
openPrivButton( "lang_en",30,30,4,4,5,-1,32, "^3EN" ,SetLanguage);
EndCatchEvent


<?php 
Sub SetLanguage
$KeyFlags,$ButtonID  )
   
#Cut the first 5 chars of the buttonID , result = 'en'
   
$language trimsubStr$ButtonID,) );

   
#When the value/string of $language is equal to 'en'
   
IF ($language == "en"THEN

     
#Set player language to English
      
SetCurrentPlayerVar("IdLang","en");

     
#DEBUG MESSAGE
      
privmsg("Language selected");
       
      
#Display Text
      
openPrivButton"example",75,111,50,10,5,-1,ISB_DARKlangEngine("%{example}%"));
   ENDIF
EndSub


Lang 
"EN"
    
example "This text is an exampletext";
EndLang
?>


Now up to you to LEARN HOW TO debug your own code.
Attached images
wsswedwddas.jpg
When a compiler complains that a semicolon is expected on line 193, the first thing to check is that you haven't forgotten to add one to the end of line 192.
No, I always check when I put it on ;

Thanks for your answers, I'll try the Bass-Driver code again!
This thread is closed

Language Selection
(13 posts, closed, started )
FGED GREDG RDFGDR GSFDG