The online racing simulator
LFS Lapper welcome message
Ok - so when somebody joins the LFSLapper server, the "Event OnConnect" displays the welcome message. Well somebody could easily drive around with the message open and hit people. Anyways we are using the 'accept' button to add the person into our online database. How can we make it so if the message is still visible (have not accepted yet) and they start driving (unitspeed?) then they will automatically get spectates??

Thanks!
#2 - kdo
i don't know much about lfs lapper. But check for pit exit event and check if the player accepted the rule / messages, if not spec him
Assuming you're using the standard Connect message (Accept / Deny), the simplest way would be to change the timer of the Deny part of the script from -1 (never off) to a set time - if the new person joining doesn't click either button in a certain time, then the Deny script becomes active and the player is kicked.

So, existing script has;
openPrivButton( "ref",103,120,20,10,10,-1,ISB_DARK,langEngine("%{main_deny}%"),OnConnectCloseKick );
Change to something like;
openPrivButton( "ref",103,120,20,10,10,20,ISB_DARK,langEngine("%{main_deny}%"),OnConnectCloseKick );
Above new line of script would give someone 20 seconds to click a button, or they get kicked.

You could change this time to more or less as you see fit. You could also add another bit of text in to bottom of your welcome message to say that if a button isn't clicked, driver will be kicked in X seconds.

eg, add following line after 'openPrivButton( "ref".....' but before 'EndEvent'
openPrivButton( "clickmessage",40,137,120,8,8,20,ISB_LIGHT,"^7You ^1MUST ^7click either 'Accept' or 'Deny' button within ^0> ^1%cpt% ^0< ^7seconds, else you will be kicked from server", OnConnectCloseKick );
You will also have to change some other bits of code to;
Sub OnConnectClose( $KeyFlags,$id )
closePrivButton("welc&pos&clos&ref&clickmessage");
EndSub
Sub OnConnectCloseKick( $KeyFlags,$id )
closePrivButton("welc&pos&clos&ref&clickmessage");
cmdLFS("/kick " . GetCurrentPlayerVar("UserName") );
EndSub


Edit: Tested on my server, and because I didn't click either button, was kicked off.
Thanks - problem now is that the welcome message is no longer appearing. Is this being stored hence not showing to users that have already accepted?

Feel free to connect to - LED Racing - and give a chat or something? see what our new problem is -.-
Quote from lgrhacking :Thanks - problem now is that the welcome message is no longer appearing. Is this being stored hence not showing to users that have already accepted?

Feel free to connect to - LED Racing - and give a chat or something? see what our new problem is -.-

No, nothing is stored, unless you wrote code to store something.
If the welcome message is no longer appearing, there must be something wrong in the code, which made lapper put the instance on hold.
Have a look in the logfile (there are 2 logfiles, a server logfile and an instance logfile, you need to have a look at the last one mentioned), to see what has gone wrong.
OK, I've made a sort of lfslapper.lpr lite file with little in it, except the welcome message - see attached file, which has been zipped down. Give it a try to see if it works.

1st image shows what should appear if you run lapper with this file.

This was run on my server, and image is screen dump when I joined. I didn't click anything, and when timer ran down, I was kicked off - so code works!

Thing is, people can agree to anything on front screen, and still do what they like when on the server - up to admins on server to try stop any bad behaviour.

For that reason, I have alternate message on my server, which I think is bit more friendly, but does advise what will happen if bad behavior is noted.
Attached images
Lapper Lite.png
Sinrs Welcome.png
Attached files
LFSLapper.zip - 1.4 KB - 442 views
If still having issues with your welcome message, look at this post HERE.

Basically, there's also a welcome message in the /includes/cif/config_membership.lpr file, and this might be what is causing you problems.

Totally forgot about that other welcome message till I saw the other post.
Quote from sinanju :OK, I've made a sort of lfslapper.lpr lite file with little in it, except the welcome message - see attached file, which has been zipped down. Give it a try to see if it works.

1st image shows what should appear if you run lapper with this file.

This was run on my server, and image is screen dump when I joined. I didn't click anything, and when timer ran down, I was kicked off - so code works!

Thing is, people can agree to anything on front screen, and still do what they like when on the server - up to admins on server to try stop any bad behaviour.

For that reason, I have alternate message on my server, which I think is bit more friendly, but does advise what will happen if bad behavior is noted.

Can you attach the lpr file for this one?
Look in the lfslapper.lpr file for 'main_welc1'. The first instance will be the code for the button, eg

openPrivButton( "welc",25,50,150,12,15,-1,ISB_NONE, langEngine("%{main_welc1}%", $NickName ) );

and the second instance will be in the language section - Lang "EN" - and will read something like

main_welc1 = "^7Welcome {0} ^7to this ^1LFSLapper ^7powered server !%nl%^2Type ^7!help ^2after leaving garage to see commands.";

Change the code in the language section to read what you like.

Language section code breakdown:
^7 is for white coloured text
{0} is for the drivers nickname
^1 red coloured text
%nl% is for new line - anything after this goes on next line - remember to put coloured text identifier (eg ^2) after, otherwise text will be gray

Different sized text just means that I've used different buttons, as in main_welc1, main_welc2, main_welc3, etc, and placed them one under another.

I'm flattered that you want to use my welcome message, but if you want to use lapper, then I'm not going to just give you the code - the welcome message is one of the very easiest things that you can change (was the very first thing I ever learned to do), and if you can change that, and make it look and work like you want, then that's a big step.

If you need help in what all the details (especially the numbers) mean in the code for making a button, then look at this POST.

Play around with the 'lite' version I made - you can even change the English to Portugese wording in the Lang "EN" section (this is the default for lapper to look in if no other languages specified), so you might change welc1 to

main_welc1 = "^7Bem-vindo a este servidor {0}%nl%^2escreva !help a ver comandos";

(Assuming google translate does what I asked!).
Quote from sinanju :Look in the lfslapper.lpr file for 'main_welc1'. The first instance will be the code for the button, eg

openPrivButton( "welc",25,50,150,12,15,-1,ISB_NONE, langEngine("%{main_welc1}%", $NickName ) );

and the second instance will be in the language section - Lang "EN" - and will read something like

main_welc1 = "^7Welcome {0} ^7to this ^1LFSLapper ^7powered server !%nl%^2Type ^7!help ^2after leaving garage to see commands.";

Change the code in the language section to read what you like.

Language section code breakdown:
^7 is for white coloured text
{0} is for the drivers nickname
^1 red coloured text
%nl% is for new line - anything after this goes on next line - remember to put coloured text identifier (eg ^2) after, otherwise text will be gray

Different sized text just means that I've used different buttons, as in main_welc1, main_welc2, main_welc3, etc, and placed them one under another.

I'm flattered that you want to use my welcome message, but if you want to use lapper, then I'm not going to just give you the code - the welcome message is one of the very easiest things that you can change (was the very first thing I ever learned to do), and if you can change that, and make it look and work like you want, then that's a big step.

If you need help in what all the details (especially the numbers) mean in the code for making a button, then look at this POST.

Play around with the 'lite' version I made - you can even change the English to Portugese wording in the Lang "EN" section (this is the default for lapper to look in if no other languages specified), so you might change welc1 to

main_welc1 = "^7Bem-vindo a este servidor {0}%nl%^2escreva !help a ver comandos";

(Assuming google translate does what I asked!).

Thanks but i just want the countdown thing (self message destruct) with that OK button, and without kick anyone when the time finishes
From that part


<?php 
Sub OnConnectClose
$KeyFlags,$id )
closePrivButton("welc&pos&clos&ref&clickmessage");
EndSub
Sub OnConnectCloseKick
$KeyFlags,$id )
closePrivButton("welc&pos&clos&ref&clickmessage");
cmdLFS("/kick " GetCurrentPlayerVar("UserName") );
EndSub
?>


Remove simply the line


<?php 
cmdLFS
("/kick " GetCurrentPlayerVar("UserName") );
?>

So after the countdown finished the windows will close and that's it.

It would be look like :


<?php 
Sub OnConnectClose
$KeyFlags,$id )
closePrivButton("welc&pos&clos&ref&clickmessage");
EndSub
Sub OnConnectCloseKick
$KeyFlags,$id )
closePrivButton("welc&pos&clos&ref&clickmessage");
EndSub
?>


In my 'welcome section', all my buttons now start with the prefix "welc_" with an identifier as suffix, as in 'welc_backing'.

This is so I can use the line
closeButtonRegex (GetCurrentPlayerVar("UserName"), "welc_*");

to close all the buttons without worrying about missing any, or closing the wrong one(s).

All buttons now changed from a time of -1 (never close unless a sub-routine closes them) to about 12 seconds or so, so that message will disappear off screen in not too much time without having to click any buttons. The timer is just to show when it will disappear - for anyone that even bothers to read what's on screen.

The timer uses the %cpt% function (look in the docs/changes.txt file).

The timer does nothing but show a countdown time. The buttons will disappear anyway.
Quote from sinanju :In my 'welcome section', all my buttons now start with the prefix "welc_" with an identifier as suffix, as in 'welc_backing'.

This is so I can use the line
closeButtonRegex (GetCurrentPlayerVar("UserName"), "welc_*");

to close all the buttons without worrying about missing any, or closing the wrong one(s).

All buttons now changed from a time of -1 (never close unless a sub-routine closes them) to about 12 seconds or so, so that message will disappear off screen in not too much time without having to click any buttons. The timer is just to show when it will disappear - for anyone that even bothers to read what's on screen.

The timer uses the %cpt% function (look in the docs/changes.txt file).

The timer does nothing but show a countdown time. The buttons will disappear anyway.

Thanks.. is there a way to "replace" the main_accept on the message self destruct or at the clickmessage, because now it doesnt show when someone log in, for example: "Robert a new visitor has logged in!" it only shows when i click at the accept button, so i just want to replace it to this i think
openPrivButton( "clickmessage",40,136,120,6,10,18,ISB_LIGHT,langEngine("%{main_clickmessage}%"),OnConnectCloseKick );

and when the message self destruct too..
Well i found the code at the config_membership.lpr i think it is this:
Sub GetMemberType($userName)
$mType = GetUserStoredNum($userName,"MemberType");
IF ( $mType <= $MEMBERTYPE_UNKNOWN )
THEN
$mType = $MEMBERTYPE_VISITOR;
SetUserStoredValue("MemberType", $MEMBERTYPE_VISITOR);
ENDIF
IF ( $mType >= $MEMBERTYPE_MAX )
THEN
$mType = $MEMBERTYPE_MAX - 1;
SetUserStoredValue("MemberType", $mType);
ENDIF
$mName = $MemberTypes[$mType];
return($mName);
EndSub

Sub LoginMember($userName)
$NickName = GetPlayerVar($userName, "NickName");
privMsg ("^7Hi there, ^8" . $NickName);
globalMsg ($NickName . "^8 has ^2logged in");
# OnConnectClose_Pitboard();
EndSub

Sub LoginNonMember($userName)
$NickName = GetPlayerVar($userName, "NickName");
IF ( GetUserStoredNum("MemberType") < $MEMBERTYPE_VISITOR )
THEN
SetUserStoredValue("MemberType", $MEMBERTYPE_VISITOR);
privMsg ("^7Welcome ^8" . $NickName);
globalMsg ($NickName . "^8, a new ^6Visitor^8 has ^2logged in");
ELSE
privMsg ("^7Welcome back, ^8" . $NickName);
globalMsg ($NickName . "^8, a returning ^6" . GetMemberType($userName) . "^8 has ^2logged in");
ENDIF
EndSub

Now i need help to add that at the self destruct message and at the clickmessage..
You are trying to do too much at once.

Do it one stage at a time, so you understand what is happening, and, more importantly, make it easier to change or fix if it doesn't work right.

Quote from MemoPedra :.. is there a way to "replace" the main_accept on the message self destruct or at the clickmessage, because now it doesnt show when someone log in, for example: "Robert a new visitor has logged in!" it only shows when i click at the accept button, so i just want to replace it to this i think
openPrivButton( "clickmessage",40,136,120,6,10,18,ISB_LIGHT,langEngine("%{main_clickmessage}%"),OnConnectCloseKick );

..

In the default lfslapper.lpr script, when someone connects, they get a welcome message with 2 buttons under the message. If the [ACCEPT] button is clicked, this does nothing BUT close the message and the buttons. If the [DENY] button is clicked, then the message and buttons are closed, AND the user will be kicked.

Because the timer is set to -1, the message will always stay on screen for the person that has connected, until they click either button.

The ACCEPT and DENY buttons are only triggers for starting a sub-routine when clicked. You could easily change these - for instance, you could change the wording, add a pop-up message when someone clicks on a button, change what they do - instead of just kicking someone if they click the DENY button, you could add a ban ( cmdLFS( "/ban " . $Username . " 30" )Wink, or add a message to say "I forgive you", and change the sub-routine at end of button code from "OnConnectCloseKick" to "OnConnectClose" (so both ACCEPT and DENY buttons do same thing). Or, for fun, reduce timer (eg -1 to 4) on DENY button sub to give new user only few seconds to hit button before it disappears, leaving only the ACCEPT button. Or, if you really wanted some serious fun, use the DelayedCommand code, then you could have the DENY button move around the screen every second or so.

What the buttons read, and what they do, is up to how you code them.

Your "clickmessage" button, which you have set to clear (self destruct!) in 18 seconds - if this is used in the 'Event OnConnect' section, and because its a private button, only the person joining should see this. So, if I understand correctly, why are you getting an ACCEPT button if someone else joins?

Best you show your whole OnConnect section (from Event to EndEvent), along with the relevant part of the language section. I can tell a lot about your "clickmessage" button - except what, if anything, it actually reads.
Quote from sinanju :You are trying to do too much at once.

Do it one stage at a time, so you understand what is happening, and, more importantly, make it easier to change or fix if it doesn't work right.

Quote from MemoPedra :.. is there a way to "replace" the main_accept on the message self destruct or at the clickmessage, because now it doesnt show when someone log in, for example: "Robert a new visitor has logged in!" it only shows when i click at the accept button, so i just want to replace it to this i think
openPrivButton( "clickmessage",40,136,120,6,10,18,ISB_LIGHT,langEngine("%{main_clickmessage}%"),OnConnectCloseKick );

..

In the default lfslapper.lpr script, when someone connects, they get a welcome message with 2 buttons under the message. If the [ACCEPT] button is clicked, this does nothing BUT close the message and the buttons. If the [DENY] button is clicked, then the message and buttons are closed, AND the user will be kicked.

Because the timer is set to -1, the message will always stay on screen for the person that has connected, until they click either button.

The ACCEPT and DENY buttons are only triggers for starting a sub-routine when clicked. You could easily change these - for instance, you could change the wording, add a pop-up message when someone clicks on a button, change what they do - instead of just kicking someone if they click the DENY button, you could add a ban ( cmdLFS( "/ban " . $Username . " 30" )Wink, or add a message to say "I forgive you", and change the sub-routine at end of button code from "OnConnectCloseKick" to "OnConnectClose" (so both ACCEPT and DENY buttons do same thing). Or, for fun, reduce timer (eg -1 to 4) on DENY button sub to give new user only few seconds to hit button before it disappears, leaving only the ACCEPT button. Or, if you really wanted some serious fun, use the DelayedCommand code, then you could have the DENY button move around the screen every second or so.

What the buttons read, and what they do, is up to how you code them.

Your "clickmessage" button, which you have set to clear (self destruct!) in 18 seconds - if this is used in the 'Event OnConnect' section, and because its a private button, only the person joining should see this. So, if I understand correctly, why are you getting an ACCEPT button if someone else joins?

Best you show your whole OnConnect section (from Event to EndEvent), along with the relevant part of the language section. I can tell a lot about your "clickmessage" button - except what, if anything, it actually reads.

Because as i said the tiggered accept button is connected to this for example: "Robert a new visitor has logged in!" when someone press the accept button it will shows up a privmsg with that... it depends on the membertype at the command !ma so i need to connect that to the self destruct and clickmessage..
Well i think it is working well at the momment, thanks.
Hello

openPrivButton( "ref",103,120,20,10,10,-1,ISB_DARK,langEngine("%{main_deny}%"),OnConnectCloseKick );

Can I Run This Command As A Pit ?
It isnt possible to send someone directly to the pit "SHIFT+P".

but if you want to change the 'kick' command. Find the Sub callback named OnConnectCloseKick( $KeyFlags,$id )

And change the '/kick' in something else, like '/pitlane'.

Sub OnConnectCloseKick( $KeyFlags,$id )
closePrivButton("welc&pos&clos&ref");
cmdLFS("/kick " . GetCurrentPlayerVar("UserName") );
EndSub

This thread is closed

FGED GREDG RDFGDR GSFDG