The online racing simulator
Searching in All forums
(354 results)
TechEdison
S3 licensed
Yours is definitely more technically skilled than mine Tongue
[PHP] LFS Color Codes -> HTML tag
TechEdison
S3 licensed
I've written a basic PHP function to convert LFS color coded strings into a string using HTML
<span>

tags. See the code below:


<?php 
        
function lfsColorToHTML($text)
        {
        
                
$repred 0;
                
$repgreen 0;
                
$repyellow 0;
                
$repblue 0;
                
$reppink 0;
                
$replightblue 0;
                
$repwhite 0;
                
$repblack 0;
                
                
$htmlCode str_replace("^1""<span style='color:red'>"$text$repred);
                
$htmlCode str_replace("^2""<span style='color:green'>"$htmlCode$repgreen);
                
$htmlCode str_replace("^3""<span style='color:yellow'>"$htmlCode$repyellow);
                
$htmlCode str_replace("^4""<span style='color:blue'>"$htmlCode$repblue);
                
$htmlCode str_replace("^5""<span style='color:pink'>"$htmlCode$reppink);
                
$htmlCode str_replace("^6""<span style='color:lightblue'>"$htmlCode$replightblue);
                
$htmlCode str_replace("^7""<span style='color:white'>"$htmlCode$repwhite);
                
$htmlCode str_replace("^8""<span style='color:black'>"$htmlCode$repblack);
                
                
$totalrep $repred+$repgreen+$repyellow+$repblue+$reppink+$replightblue+$repwhite+$repblack;
                
$repcounter 0;
                
                while(
$repcounter $totalrep)
                {
                        
$htmlCode .= "</span>";
                        
$repcounter++;
                }
                
                return 
$htmlCode;
        }
?>

Usage:


<?php 

$myString 
"^1Hello ^2World. ^3Testing.";

$newString lfsColorToHTML($myString);

echo 
$newString//Result: <span style='color:red'>Hello <span style='color:green'>World. <span style='color:yellow'>Testing.</span></span></span>

?>

An example can be seen on my team website. The server color codes are converted using this function: https://www.team-vtec.ga/
TechEdison
S3 licensed
The servers are having a bit of downtime. Hope to have it resolved within the next day or so.
TechEdison
S3 licensed
Some fun in the drift server (S2) today Smile

[VT] Team VTEC Servers (Drift and Race, S2 and Demo)
TechEdison
S3 licensed


Team VTEC has a server for everyone!

We run an S2 server and a Demo server, both being run in either RACE mode or DRIFT mode. On the S2 DRIFT mode, we have a list of layouts that automatically change every 2 hours (thanks to PMD9409 for the layouts)

Feel free to join us any time!

Disclaimer:

I do not own the layouts or any of the lapper plugins, except for the automatic messages and layout changer.
Last edited by TechEdison, .
TechEdison
S3 licensed
The above script effectively creates a server whitelist using a website as the list..
TechEdison
S3 licensed
Is it basically as simple as this?

website:

<?php 

    $allowed_list 
= array(

    
"TechEdison" => "yes",
    
"Bass-Driver" => "no"

    
);

    
$username $_GET["u"];

    if(
$allowed_list[$username] == "yes")
    {

        echo 
'GlobalVar $allowed; $allowed = 1;';

    }
    else
    {

        echo 
'GlobalVar $allowed; $allowed = 0;';

    }

?>

lapper:

<?php 

Event OnConnect
($userName)

    
http("http://myurl.com/script.php?u=".$userName);

    IF(
$allowed == 0)
    
THEN

        cmdLFS
("/kick ".$userName);
        
GlobalMsg("Kicked: ".$userName.". Reason: Not Alowed");

    ELSE

        
GlobalMsg("Welcome Back: ".$userName);

    ENDIF

EndEvent

?>


TechEdison
S3 licensed
... This is pretty darn amazing...

I will be having lots of fun with this in the near future. The possibilities are literally endless since PHP is such a versatile language.
Bought S3
TechEdison
S3 licensed
Smile

hopeful for new content in the future, keep it up devs.
TechEdison
S3 licensed
How Tongue
TechEdison
S3 licensed
I'm totally open for advice. These are less supposed to be amazing shots, and more to just show off the team skins Smile

I used the popular "how to render with blender" and made 4 individual renders, then just used GIMP and placed each image as a layer on top of the other (mainly just to put them all in one image).

I'm not that experienced with renders, and these tips will be helpful.
HTTP requests: are they possible
TechEdison
S3 licensed
Title says it all. Can I ping a website to make a request? My thought is to make a web status thing that shows the status of the server.

something along the lines of: httpRequestFunction("http://url.com/somepage.php?som=val");
TechEdison
S3 licensed
(old post i know)

You don't need a license do do any insim/outsim things. I started out on the forum with a neat little spedo that ran on a website that used outgauge, I was a demo user.

You do however need a license to do anything except for Blackwood and the 3 demo cars, so it's definitely worth getting S1 or S2.
TechEdison
S3 licensed
I used to run demo events hmm...
TechEdison
S3 licensed
probably not going to find someone to host for you, but you can rent a host here for quite cheap, or rent a vps and host it there.
TechEdison
S3 licensed


The entire fleet.
TechEdison
S3 licensed
You can host an event, but you'll be restricted to Blackwood and the 3 demo cars obviously.

S2 is totally worth it though, I'd suggest getting it Smile
TechEdison
S3 licensed
Some context: this broadcasts a message every 30 seconds, each being the next in the list. It loops through those 6 messages.
Broadcaster
TechEdison
S3 licensed

<?php 
CatchEvent OnLapperStart
()
    
GlobalVar $line_number;
    
GlobalVar $lines;
    
GlobalVar $total;
    
    
$lines[0] = "^1Test 1";
    
$lines[1] = "^2Test 2";
    
$lines[2] = "^3Test 3";
    
$lines[3] = "^4Test 4";
    
$lines[4] = "^5Test 5";
    
$lines[5] = "^6Test 6";
    
$lines[6] = "^7Test 7";
    
    
$total 6;
    
$line_number=0;
        
RegisterScheduleAction"0 * * * * * *"broadcast );
        
RegisterScheduleAction"30 * * * * * *"broadcast );
EndCatchEvent

Sub broadcast
()
        
cmdLFS("/msg ".$lines[$line_number]);
        
$line_number $line_number 1;
        IF(
$line_number $total)
        
THEN
                $line_number 
0;
        ENDIF
EndSub
?>


Change the messages to what you'd like. Save the text in a file called "broadcaster.lpr".

No need to credit me, feel free to modify the code.
[Solved] Some questions
TechEdison
S3 licensed
Is it possible to do the following, and if so, how:
  • Get a list of usernames and their associated driver names
  • Prevent a sent message by a player from being displayed
I'm thinking of creating a very basic moderation tool..
TechEdison
S3 licensed
Is the scheduled action in cron format? If so, it appears that would cause an issue the way it's written, and should instead be * * * * *?
TechEdison
S3 licensed
I'll give it a go and do a report back here. I know a lot of hosts run Linux, and the performance is probably better on a small VPS compared to Windows Server.

Edit:

Actually I think I'll just try it with the virtual C: drive in Wine.
TechEdison
S3 licensed
What about, and this is a wild idea... OpenGL :o
TechEdison
S3 licensed
Quote from Bass-Driver :I have made something quick.

Be aware. This script isnt tested and may be unstable.

This script uses the new function i have implemented a while ago in LFSLapper.

<?php 
getlistoflayouts
($Filter,$Sort,$TypeSort);
?>

This retreives all the layouts of the current loaded track. From a layoutfolder you have set.
The list with layouts must also exist in the default layoutfolder of your LFS directory.

This is perfect man thanks!

Quick question though. I run my server on a linux machine using wine/mono. How do paths work in lapper this way? Can I use a linux path or relative paths (such as ../../s2_server/data/layouts/)?

If there is no easier way to do this and it has to be absolute, I can just stick my server directory in the virtual wine C: drive.
TechEdison
S3 licensed
<?php

GlobalVar $highest = 10;

SetStoredValue("layout_1", "layout name");
SetStoredValue("layout_2", "layout name");
SetStoredValue("layout_3", "layout name");
SetStoredValue("layout_4", "layout name");
SetStoredValue("layout_5", "layout name");.... etc

GlobalVar $layout_number = 1;

==some loop that runs every 6hr==
change layout to GetStoredValue("layout_".$layout_number);

$layout_number++;

IF($layout_number == $highest)
THEN
$layout_number = 1;
ENDIF
==end of some loop==

?>

basically all I need is that
FGED GREDG RDFGDR GSFDG