The online racing simulator
Searching in All forums
(882 results)
Bass-Driver
S3 licensed
sorry for the long respond.

I have tried to encode it first to UTF8 and Unicode and Windows-1251 and none of them works.
I also digged deeper into the sourcecode of lapper to encode the NickNames. Same result.

Have searched on the web for the Heximal and Decimal value of the "White Star". It came up with this.

//0x8199(HEX) 0x2606(DEC) #WHITE STAR

But i couldnt find out how to convert this into bytes. I might to think to difficult about this :S

I think '81' is one byte and '99' is the another one. But none of them are the same in as i can see in my LapperConsole.

Atm i have no clue what todo. Schwitz
See the last Packetcode below.



I know i'm new with this and you guys might think this i'm stupid. But this is a big learning process for me and i enjoy it. Big grin Big grin Big grin

Thanks in advanced.
Bass-Driver
S3 licensed
Sorry for being offtopic, But someone got really pissed.

AymanHilal does have a S2 account named Iceman121. He just wanted to buy a S3 licenses for the 'AymanHilal' account. He's now trying to unban his account. Not sure if thats gonna work Smile

Heres a link with a post from him aswell.
https://www.lfs.net/forum/post/1907440#post1907440

The reason why he wont post with his S2 account, is because he hates the Iceman121 accountname. Dont know why he choises for this name anyway.

Well on the otherside, i can blame you guys for banning him from this forum.
So guys, do not start a conversation about this, within this topic.

Thank you
Bass-Driver
S3 licensed
Well , after some code editing, and i even have used the encoding code of InsimDotNet ( JUST FOR TESTING!!!). I still cannot manage to get the japanese characters working.

Ill explain what i already did.

First i have set a Japanese Char as my Nickname.



Then i type a command to display my nickname.
In Lapper you use the following function to send a private message to your self or someone else.
In this case i sent a message to myself.

privmsg(GetPlayerVar($userName,"NickName"));

In the lapperconsole i get the following output , within the yellow square:
The first line is the sended message right next after 'Message:'
I dont know, if the output '^J T' is correct.



As last i show you the code after i used InsimDotNet's Encoding code.



So if someone got an idea about to fix this. Feel free to post.

Thanks in advanced.
Bass-Driver
S3 licensed
oke thanks Yisc[NL], for updating this script.

I will add this to my buglist, to see i can find anything that might cause this crash.
Bass-Driver
S3 licensed
Oke thanks for the feedback, will look into it.

For someone who's is interested in the codepage source.
Sending a MTC packet looks like this.


<?php 
public byte[] MTC(int UCIDint PLIDstring msg)
        {
            
int msgLen msg.Length 127 127 msg.Length;

            
byte[] packet = new byte[136];
            
packet[0] = 136;
            
packet[1] = (byte)TypePack.ISP_MTC;
            
packet[2] = 0;
            
packet[3] = 0;
            
packet[4] = (byte)UCID;
            
packet[5] = (byte)PLID;
            
packet[6] = 0;
            
packet[7] = 0;
            
InSim.CodePage.GetBytes(msg0System.Math.Min(127msg.Length), packet8);
            return 
packet;
        }
?>

The codepage source can be found in the attachment below.
Bass-Driver
S3 licensed
what happends if you add the leavestreet sub routine?
Bass-Driver
S3 licensed
Official Release of version V7.0.4.10 available.

Grab the version in the first post.

Thanks to everyone who tested lapper and the feedbacks during testing.
Bass-Driver
S3 licensed
Nice job with updating this script. Thumbs up
Insim String Encoding Help
Bass-Driver
S3 licensed
Hello programmers,

Since i have been started with updating LFSLapper insimlibrary, i want to solve old bugs.
One of them is a character bug.

This bug does not display the japanese characters when sending an string to LFS.
After some research on google, i found something that these Japanse characters works with Double Bytes.

After looking into the codepage sourcecode, i do not quite understand what the previous developer (Gai-Luron) has done with the code. And i have no idea how to edit the code to support Double Byte characters.

So my idea is to start from scratch and i want to ask you guys how to start with encoding strings in a proper way.

Just a small note: My C# experience is bad.

Thanks in advance
Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
Very quick looking at it:

-BL2 doesnt exist.
-Whole Rockingham doesnt exist in the code, Which is easy to add. If you have the correct lengths.

To make RO track compatible with 4 or 5 characters long. I have used this code in lapper.

//Get last char of shorttrackname
string GetShortNameTrack = track.Substring(cp.Length - 1, 1);

//Read last char
if ((GetShortNameTrack == "X") || (GetShortNameTrack == "R") || (GetShortNameTrack == "Y"))
GetTrack = track.Substring(0, cp.Length - 1);
else
GetTrack = track.ToUpper();

Bass-Driver
S3 licensed
Turned out the GetListOfPlayers() testcode didnt work well after some tests.
Because of Arrays in Lapper. Always an enjoyment to work with arrays in Lapper.

New testversion available: PublicTest_04 . Without the testcode for GetListOfPlayers().
Bass-Driver
S3 licensed
Uhm oke this is odd.

I have add a debug message in the Race Restart packet, and it seems its still executing when Lapper is reloaded/started after the race is finished. Not sure if this is normal Schwitz

Fixed: Failed RST_Insim packet request.
Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
New PublicTest version is available:

Rebuilded this version again from 7.0.4.8 after some old features did not work properly.
Compiled multiple times and tested the .exe to be sure that the old and new events are working.

-Added some debug messages for GetListOfPlayers() in the console.
-Added 2 extra Lappervars : LFSVersion and LFSMode
-Added testversion/state of Lapper in Title of the console.

####### GetListOfPlayers() TEST############

If you have more than 11 players in the server, please make a screenshot of the Lapperconsole.

Also use this code to get the usernames of the current players in the server. And also make a screenshot of the results.

You can use this code in a command of sub or in the onconnect event

$Number = 1;
$Racers = GetListOfPlayers("U");
FOREACH( $Var IN $Racers ) #For each player in the server
privmsg("^3[".$Number."] ^7".$Var["value"]); #Current Number + UserName of Player
$Number = $Number + 1;
ENDFOREACH

Some feedback after testing whould be appreciated.

Thank you.
Bass-Driver
S3 licensed
uhmm right. Nothing special. deleted a line from layoutlist.lpr
Bass-Driver
S3 licensed
New testversion available. Grab the version in the first post

New features added and 1 fix

Thanks to LakynVonLegendaus, Lapper supports now fully JoinRequest system.
See info below.

New event: OnNewJoinRequest # Player event (Thanks to LakynVonLegendaus)

#######################################
#Player sends a join request (Shift+J)#
#######################################
NOTE:
#To enable OnNewJoinRequest event, $ReceiveJoinRequest has to be set to 1.
#If enabled, LFS waits (cca 1 second) for a response from the Lapper on each join request.
#To respond to a join request - use joinrequest() function.
#The Player's unique ID (PLID Must be 0 to use the join request system)
#If no response is sent, LFS spawns the car normally (with a delay [because LFS waits for the join request response]).
#For more info see ..\LFS\docs\InSim.txt

$ReceiveJoinRequest = -1; #Enable (1) or disable (-1) for Receive JoinRequest.

Event OnNewJoinRequest( $userName ) # Player event
/*
$Flags = 0; #Move car (128) else (0)
$X_Axis = 0; #X axis SpawnPoint
$Y_Axis = 0; #Y axis SpawnPoint
$Z_Axis = 0; #Z axis SpawnPoint
$Heading = 0; #Heading of the players car at Spawnpoint

$UCID = GetCurrentPlayerVar("UCID"); #Connection unique ID
$PLID = 0; #GetCurrentPlayerVar("PLID"); #Player's unique ID

###$PLID MUST BE 0 TO USE JOIN REQUEST###
#$JRRAction = 0; # Reject join request.
$JRRAction = 1; # Allow join request.

joinrequest($X_Axis ,$Y_Axis ,$Z_Axis ,$Flags ,$Heading ,$UCID ,$PLID ,$JRRAction); #Send Data to LFS
*/
EndEvent

#New Lappervar:
-lapperversion //Returns the current version of LFSLapper.
(could be used to protect your script against older lapperversions).



Bass-Driver
S3 licensed
Thank you for testing and your report
Release: LFSLapper V7.0.4.10
Bass-Driver
S3 licensed


Hello Lapperusers,

After some weird bug reports and checking the sourcecode, i couldnt explain were those bugs came from.
So i rebuild the new version from the working 7.0.4.8 version.

For the one who downloaded 7.0.4.9, i highly recommend to upgrade to V7.0.4.10

NOTE: Its not the same as V7.0.4.9

EDIT: official version available

See the summery of changes below.


+--------------------------------+
|Changes from 7.0.4.8 to 7.0.4.10| #7.0.4.9 is skipped, caused by a big sourcecode bug
+--------------------------------+
-New Lappervars added
-New Events/InsimPackets added : OnPlayerFlags , OnAdminCommandReport
=================================================
New:
=================================================
01: New lappervars added: (retrieve values from LFS)

mustpit //MustPit is enabled on the server ( Returns 0 or 1)
canvote //Guest may vote kick/ban ( Returns 0 or 1)
canselect //Guest may select track/car ( Returns 0 or 1)
canreset //Guest may reset theire car ( Returns 0 or 1)
midracejoin //Guest may join during a race ( Returns 0 or 1)
cruise //Guest is allowed to drive the wrong way (Returns 0 or 1)
forcedcockpitview //Forced cockpitview ( Returns 0 or 1)
nbofcheckpoints //Number of checkpoints ( Returns 0, 1, 2 or 3) Also works on layouts (Insim checkpoints doesnt count)
timing //Type of Timing:
-Returns 0 : Open config without use checkpoints
-Returns 1 : Normal laptiming ( normal circuit)
-Returns 2 : Custom/AutoX laptiming ( userplaced checkpoints/finishline)
lapperversion //Returns only the lapperversion
lfsversion //Returns version of lfsserver. currently 0.6R
lfsmode //Returns mode of LFSServer (Demo/S1/S2/S3)

02: New Event: OnPlayerFlags (Detects Yellow/Blue flags and Lag/Missing packets)

##########################################################################################
#Action on Event when player receives a Flag (Yellow/Blue flags and Lag/Missing packets).
##########################################################################################
#The Flags below returns 1 or 0 depends on which flag is received by the user
#$YellowFlag: Player receives a YellowFlag
#$BlueFlag : Player recieves a BlueFlag
#$LagFlag : Player is lagging or is missing carpackets
#$Time : ShortTimeFormat,same as GetLapperVar("ShortTime");

##########################################################################################
$PlayerFlagEvent = -1; #Enable Event 1 = ON / -1 = OFF
Event OnPlayerFlags($userName,$YellowFlag,$BlueFlag,$LagFlag,$Time) # Player event
/*
IF( $YellowFlag == 1) THEN
privmsg("^3YELLOW FLAG");
ENDIF
IF( $BlueFlag == 1) THEN
privmsg("^4BLUE FLAG");
ENDIF
IF( $LagFlag == 1) THEN
privmsg("^5LAG");
ENDIF
*/
EndEvent

03: New Event: OnAdminCommandReport (Report admincommands)

######################################################
#Action on entering a admincommand ( "/ commands" )
######################################################
#$userName = username of the player who typed the admincommand.
#$IsAdmin = Is player a admin ( 0 = no admin / 1 = is an admin)
#$Status = Status of command ( 1 - processed / 2 - rejected / 3 - unknown command)
#$Command = Entered command by player
#$Time = Date/Time of action
######################################################

Event OnAdminCommandReport( $userName,$IsAdmin,$Status,$Command,$Time ) # Player event
#Yourcode
EndEvent

04: New Function: InArray(), Check if a value already exist in the current array.

#Array = $TESTARRAY[]
#Value = 7

IF( inarray($TESTARRAY,"7") == 1) THEN
privmsg("^2Does exist");
ELSE
privmsg("^1Does not exist");
ENDIF

05: New Function: Remove(), Remove chars from a string. Old way: Trim( SubStr ());

There are 2 ways to use the function

Remove amount of characters from the string from StartIndex
1 : $NewString = remove($OldString,$StartIndex,$Charstoremove)
or
Remove everything from StartIndex
2 : $NewString = remove($OldString,$StartIndex)

06: New event: OnHostMSO($Text,$Time) (Thanks to LakynVonLegendaus)

#Every messages by the host will be sent to this event.
#DO NOT USE GlobalMsg()!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Event OnHostMSO($Text,$Time)
#YourCode
EndEvent

07: New event: OnPlayerSelectCar($userName,$Car,$Time) # Player event

#This event will execute when a player select a car in the garage
Event OnPlayerSelectCar($userName,$Car,$Time)
#YourCode
EndEvent

08: New event: OnNewJoinRequest # Player event (Thanks to LakynVonLegendaus)

#######################################
#Player sends a join request (Shift+J)#
#######################################
NOTE:
#To enable OnNewJoinRequest event, $ReceiveJoinRequest has to be set to 1.
#If enabled, LFS waits (cca 1 second) for a response from the Lapper on each join request.
#To respond to a join request - use joinrequest() function.
#The Player's unique ID (PLID Must be 0 to use the join request system)
#If no response is sent, LFS spawns the car normally (with a delay [because LFS waits for the join request response]).
#For more info see ..\LFS\docs\InSim.txt

$ReceiveJoinRequest = -1; #Enable (1) or disable (-1) for Receive JoinRequest.

Event OnNewJoinRequest( $userName ) # Player event
/*
$Flags = 0; #Move car (128) else (0)
$X_Axis = 0; #X axis SpawnPoint
$Y_Axis = 0; #Y axis SpawnPoint
$Z_Axis = 0; #Z axis SpawnPoint
$Heading = 0; #Heading of the players car at Spawnpoint

$UCID = GetCurrentPlayerVar("UCID"); #Connection unique ID
$PLID = 0; #GetCurrentPlayerVar("PLID"); #Player's unique ID

###$PLID MUST BE 0 TO USE JOIN REQUEST###
#$JRRAction = 0; # Reject join request.
$JRRAction = 1; # Allow join request.

joinrequest($X_Axis ,$Y_Axis ,$Z_Axis ,$Flags ,$Heading ,$UCID ,$PLID ,$JRRAction); #Send Data to LFS
*/
EndEvent


=================================================
Updates:
=================================================

01: Changed hardcoded visible records in Toplist/UserTop/Drifttop from 24 to 10000

$list = GetListTop( getConfigVar( DefaultTopCar ), 0, 0 );
Note: Users must edit theire script to see the max visible Records. This can be done with a FOR loop: ( $i=0;$i<25;$i=$i+1)


=================================================
Fixes:
=================================================
01: Removed GLobalmsg(); in Layoutlist.LPR. Spammed the chat after paging up or down
02: Didnt retreive RaceInfo from LFS after rebooting Lapper

Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
After stopped working on this Minigame and because its still a WIP project. Ill upload the script.

Be aware, Its far from finished and has lack on commentary. But the good side is, Its contains only 270 lines, incl the ignored lines. So starting the script and to see what it does, give you a good expaination of the code.

I recommend to use Note++ or EditPlus to edit the scripts.

Go to this topic for some Syntax Highlighting: https://www.lfs.net/forum/thread/91403-Lapper-Syntax-Highlighting-for-Code-Text-Editors

Do not forget to change the fileextension to .LPR and adding the script in Addonsused.LPR
Bass-Driver
S3 licensed
Thank you for creating this usefull script.
Bass-Driver
S3 licensed
Noted.
Thanks for reporting.
Bass-Driver
S3 licensed
There is already a cruiseinsim created with LFS External. You can find it somewhere on this forum. And by reading the code you will understand how to create a Button or sending messages.

But i have to agree with Yisc[NL]. You could better move to a another insim library's like : Insim DotNet or Prism or LFSLapper, which are more updated than LFS External.
Bass-Driver
S3 licensed
is the folder do not exist. The player who use the readfile() function will receive an errormessage. But in this case the host receives this kind of message.
But indeed what Yisc[NL] siad. You wont see the messages.
Bass-Driver
S3 licensed
I think that is already suggested.
And i believe the insim 'LFSLazy' does have a feature like that.
FGED GREDG RDFGDR GSFDG