The online racing simulator
[Solved]How to open a textbutton
I have done a server and I want to save my rights in the button but I do not know how to do this but I found some of the codes but I do not know how to work on LFSlapper
I hope you help

cods
openPrivButton( "logo",50,1,100,5,1,-1,36," your Text ")
I always like to help people, but have no clue what you want help with.
Please explain in details what you want and show the script(s) you already have, so things will make sense.
-
(kristofferandersen) DELETED by Yisc[NL]
-
(cargame.nl) DELETED by Yisc[NL]
Best thing to do is to place these buttons in the OnConnect section.
Use this as example and put that in a new lpr file and save that in the 'includes' folder of your Lapper directory:


CatchSub OnConnectClose( $KeyFlags,$id )
OnConnectClose_Info();
EndCatchSub

Sub OnConnectClose_Info()
openPrivButton( "hud_bg",32,0,138,7,5,-1,16,"" );
openPrivButton( "info_1",33,1,30,5,5,2,96,"^7My Server" );
EndSub

Also make sure to adjust file 'addonsused.lpr' and add a line saying:

include( "./servergui.lpr");

Where 'servergui.lpr' should be the same filename as you just used to store the code above into.
I'm sorry to bother you
I have applied all that you wrote to me and I am sure
did not work
Add the file that is inside the .rar that is attached to the includes folder and addonused.lpr adds the following line:

include ("./interface.lpr");

Start LFSLapper and go!
Attached files
interface.rar - 237 B - 187 views
But how to add a button contains laws, for example, on the button and wrote the laws and I want to click on him show him the laws and be at the end button Cancel

and Thank you for your help and cooperation
I wish you good luck
If you take the code you already posted:

openPrivButton( "hud_bg",32,0,138,7,5,-1,16,"" );

hug_bg = name of the button
32 = Left coordinate of the button (value between 0 and 200,0 is extreme left, 200 is extreme right)
0 = Top coordinate of the button (value between 0 and 200,0 is extreme top of screen, 200 is extreme bottom of screen)
138 = Width of the button (or how long is your button)
7 = Height of the button (or how deep is your button)
5 = Space between multiple lines of text displayed in the button
-1 = Duration the button is shown (-1 means that it stays on screen, until it is clicked)
16 = Colour of the button (* see below for more explanation)
"" = The Text displayed on the button

And then you can add one more value to a button, which is the name of the sub-routine you want to call, when someone clicks the button (this is optional)

So if you make something like this:

openPrivButton( "law_button",32,0,138,7,5,-1,16,"Read Law",Laws );

Sub Laws ( $KeyFlags, $id )
#Do something here to show the laws, starting by closing the button that just has been clicked
closePrivButton("law_button");
openPrivButton( "law_1",32,0,138,7,5,-1,16,"RTFM = Read the f*cking manual ;-)" );
EndSub

* Codes that can be used on button format:

0 - transparent button
16 - light button
32 - dark button
64 - align text to left
128 - align text to right

If you want to make a light colored button with text aligned to the left, combine the codes to one new code, for example 16+64 = 80
Thank you. I understood everything about the buttons but what are the operating codes. I put the buttons on the buttons but the code that starts them is missing. Can you send them to me?
This piece of code:

openPrivButton( "law_button",32,0,138,7,5,-1,16,"Read Law",Laws );

Should go in the Onconnect or OnConnectClose (in case you have a welcome screen that people have to click to close it) event.
Since it's best not to put your own code in the standard Lapper script, it should all go in seperate modules, like this:

#The code above tells Lapper that when the OnConnect event is triggered (by someone connecting to the server), it should also execute an extra piece of code
CatchEvent OnConnect( $userName )
OnConnect_law_button();
EndCatchEvent

#Sub routine that is executed when someone connects to the server
Sub Onconnect_law_button()
openPrivButton( "law_button",32,0,138,7,5,-1,16,"Read Law",Laws );
EndSub

#Sub routine that is executed when someone has clicked the button displayed in sub routine 'Onconnect_law_button'
Sub Laws ( $KeyFlags, $id )
Do something here to show the laws, starting by closing the button that just has been clicked
closePrivButton("law_button");
openPrivButton( "law_1",32,0,138,7,5,-1,16,"RTFM = Read the f*cking manual ;-)" );
EndSub

Save this code into a module and store it in the 'includes' folder.
Let's say we name the module: law_buttons.lpr

Then open the file called 'addonsused.lpr' (can also be found in the 'includes' folder) and add the following line, before saving it:

include( "./law_buttons.lpr");
Try it but Did not work
Sorry to bother you
Working perfectly here.
Button is shown when you connect to the server:


When you click the button, you get to see the 'law':


I have uploaded the script, download the file, rename it to "law_buttons.lpr" and place it in the includes folder of Lapper.

Then open the file "addonsused.lpr" from that same folder.
Add a line saying: include( "./law_buttons.lpr");
Save the file and (re)start Lapper.
Attached images
Capture1.PNG
Capture2.PNG
Attached files
law_buttons.txt - 791 B - 171 views
This thread is closed

[Solved]How to open a textbutton
(12 posts, closed, started )
FGED GREDG RDFGDR GSFDG