The online racing simulator
Quote from bananas111 :Hi
I need to do something like that then I drived 50km I can buy xfg when I drived 200km I can drive xrg how I can do that?? I need simple code nothing else.

Well here we go:

- declare a uservar on first connect, set it to 0 and store it in the database (new user)
- retrieve an already stored value from the database (already registered user)
- measure the distance driven and when a user disconnects, add it to the created/retrieved value and store that value into the database
- when distance driven is bigger then 50km, make a buy button for xfg available
- when distance driven is bigger then 200km, make a buy button for xrg available

Not too hard to code and certainly a very good way to learn a program like Lapper.
Quote from Yisc[NL] :Well here we go:

- declare a uservar on first connect, set it to 0 and store it in the database (new user)
- retrieve an already stored value from the database (already registered user)
- measure the distance driven and when a user disconnects, add it to the created/retrieved value and store that value into the database
- when distance driven is bigger then 50km, make a buy button for xfg available
- when distance driven is bigger then 200km, make a buy button for xrg available

Not too hard to code and certainly a very good way to learn a program like Lapper.

Can you make that code when bigger then 50km xfg is available. Next codes I make by me self. Thank's
Quote from bananas111 :Can you make that code when bigger then 50km xfg is available. Next codes I make by me self. Thank's

No I won't.
When you have a clear goal of what you want to make, it is an excelent opportunity to start and learn coding your self.
I learned it when coding the pitboard.
Make some code, debug it and when you really get stuck, show us the code you have and we are happy to help.
Quote from Yisc[NL] :No I won't.
When you have a clear goal of what you want to make, it is an excelent opportunity to start and learn coding your self.
I learned it when coding the pitboard.
Make some code, debug it and when you really get stuck, show us the code you have and we are happy to help.

I think I need to use something like that

<?php 
IF ( ToNumGetCurrentPlayerVar"KM" ) > 100)
        
THEN
        openPrivButton
"XRG",45,54,110,6,5,-1,32,strFormat"^7{0}",Format_Car_Cash_Needed"XRG" ) ),Buy_Car );
?>

but it didn't work
Quote from LFSCruise :Is it possible to make each player to show only those cars which he has have?

As
ISP_PLC, // 53 - instruction : player cars

Quote from Krayy :Very soon it will be..watch the forums

Once Krayy finishes new packets I plan to rewrite a decent amount of Plugin Code, and fix all of the bugs found in this forum.
Quote from bananas111 :I think I need to use something like that

<?php 
IF ( ToNumGetCurrentPlayerVar"KM" ) > 100)
        
THEN
        openPrivButton
"XRG",45,54,110,6,5,-1,32,strFormat"^7{0}",Format_Car_Cash_Needed"XRG" ) ),Buy_Car );
?>

but it didn't work

Can you help?
Quote from bananas111 :Can you help?

Not sure ... haven't used Lapper since the last version of this add-on was released.. but I will surely help you once I look over my code again.
-
(ViKTOOR-LFS) DELETED by ViKTOOR-LFS : nothing
Quote from LFSCruise :You probably read what was written previously.
I need that speed to be displayed during openPrivButton.

Well I have a old insim with a welcome displayed messenger, I will search for it, if I can find it i will post it on here


Greetings
Welcome,

Do you know how to make
[^0-9]

does not work and why?

IF ( $argv != "" && $argv == "[^0-9]" && $argv >= "1")
THEN

Quote from Hunhard : $argv == "[^0-9]"

== equals equal to
^0 equals black text
-9 equals negative number

So you are saying if argument is equal to a black -9?

-EDIT-

Or are you trying to use the ^ pow symbol for a number to the power of (e.g. squared, cubed, etc)?
Quote from sinanju :== equals equal to
^0 equals black text
-9 equals negative number

So you are saying if argument is equal to a black -9?

-EDIT-

Or are you trying to use the ^ pow symbol for a number to the power of (e.g. squared, cubed, etc)?

It should be that if the $argv is not a number that missed conditions.
Only numbers allowed.
preg_replace(); or something like that.
It's like:
ereg_replace("[^A-Za-z0-9]", "", $argv);
anyone can give this lapper? the download link is down...
This is a version I downloaded in November 2010 ... not sure how up to date it is compared to the final version.
Attached files
Cruise.zip - 1 MB - 848 views
Quote from Hunhard :It should be that if the $argv is not a number that missed conditions.
Only numbers allowed.
preg_replace(); or something like that.
It's like:
ereg_replace("[^A-Za-z0-9]", "", $argv);

It is impossible to?
lapper does not support regular expressions like you are trying to do.

You could use the substr function to extract the first character and use IsNum to see if it is a numeric like this:


<?php 
$Char 
subStr$text,0,);
    IF ( 
IsNum($Char) == TRUE )
    
THEN
....
?>

or for your example:

$Char = subStr( $argv,0,1 );
IF ( $argv != "" && IsNum($Char) == TRUE && ToNum($argv) >= 1) THEN
...
I use ToNum as Lapper is not a typed language so this function explicitly casts it as a Numeric.

openPrivButton("Time",1,5,30,5,10,-1,16,"^2".GetLapperVar("ShortTime")."");

Why time stands instead?
You were close.....

...should be

<?php 
    openPrivButton
("Time",1,5,30,5,10,-1,16,"^2" GetLapperVar("ShortTime"));
?>

Notice space both sides of full stop before GetLapperVar and you don't need the double quotes at the end of the line.
Quote from sinanju :You were close.....

...should be

<?php 
    openPrivButton
("Time",1,5,30,5,10,-1,16,"^2" GetLapperVar("ShortTime"));
?>

Notice space both sides of full stop before GetLapperVar and you don't need the double quotes at the end of the line.

No it didn't help. Time stands still on the spot, not updating, do not change. It's like the clock stopped.
Time to change every minute.
Ah, get you now. I thought you had a syntax error. My bad.

However.

Not sure that it will update as my understanding is that getting a variable only gives you a snapshot at the time you call it.

The only way I can see to do what you want is to use the RegisterScheduleAction along with a sub-routine, e.g.

RegisterScheduleAction( "0 1 * * * * *", SA_Timer );

Sub SA_Timer
closePrivButton("Timer");
openPrivButton("Timer",1,5,30,5,10,-1,0,"^2" . GetLapperVar("ShortTime"));
End Sub

Maybe someone else has better idea?

By the by; If (?) this is being used as a host timer, why not use a Global button instead of a private one?

Quote from sinanju :Ah, get you now. I thought you had a syntax error. My bad.

However.

Not sure that it will update as my understanding is that getting a variable only gives you a snapshot at the time you call it.

The only way I can see to do what you want is to use the RegisterScheduleAction along with a sub-routine, e.g.

RegisterScheduleAction( "0 1 * * * * *", SA_Timer );

Sub SA_Timer
closePrivButton("Timer");
openPrivButton("Timer",1,5,30,5,10,-1,0,"^2" . GetLapperVar("ShortTime"));
End Sub

Maybe someone else has better idea?

By the by; If (?) this is being used as a host timer, why not use a Global button instead of a private one?


And if you still want to show clock and seconds you would do then?
There is no real-time.

Or can we any code can be used from C# ?
Timers are tricky in Lapper because the app is running indepedantly of the LFS server and also only displays information to you as buttons on the client.

This induces a certain period of lag, as any timer needs to first calculate the time to display then cycle through all connections one by one updating the button used to display that timer. Each client will have a particular response time (say 20ms to 200ms) that adds to the time each update takes.

This is why sometimes with you use the %cnt% variable in a text button it will count down but may skip a number...it is taking more than 1 second to cycle through all of the clients.

Technically a function to create a button and update it with a timer, time of day etc, but there is no guarantee that it would be smooth.

maybe in the next version of InSim they will add functions that can do a simultaneous write or button update to all connections, which would solve the problem, but until then i could have a look but it would not be 100% accurate or smooth.

BTW, what sort of time do you want to display, race time, time of day?
Quote from Krayy :Timers are tricky in Lapper because the app is running indepedantly of the LFS server and also only displays information to you as buttons on the client.

This induces a certain period of lag, as any timer needs to first calculate the time to display then cycle through all connections one by one updating the button used to display that timer. Each client will have a particular response time (say 20ms to 200ms) that adds to the time each update takes.

This is why sometimes with you use the %cnt% variable in a text button it will count down but may skip a number...it is taking more than 1 second to cycle through all of the clients.

Technically a function to create a button and update it with a timer, time of day etc, but there is no guarantee that it would be smooth.

maybe in the next version of InSim they will add functions that can do a simultaneous write or button update to all connections, which would solve the problem, but until then i could have a look but it would not be 100% accurate or smooth.

BTW, what sort of time do you want to display, race time, time of day?

Of course that time of day.

It should not only naturally display the date and time but also show the speed is definitely not changing every minute. It should show that as well as it shows LFSExternal.
Copy of LFSLapper Cruise Addon Version 10.11.9.0 by T3charmy as requested via PM, as file no longer available on dropbox.
Attached files
LFSLapper-Cruise.zip - 1.1 MB - 1521 views
how police will be fined?
how police will be fined ???
how police will be fined ???

FGED GREDG RDFGDR GSFDG