The online racing simulator
Searching in All forums
(31 results)
1
alau07
S3 licensed
Quote from Creepingwing :Hello all. I’m creepingwing just downloaded the demo. I’m from uk.

Welcome [LCS] Cruise Server is best demo server Tongue
[Solved] File Directory Unknown, failed to create file.
alau07
S3 licensed
Context:
I am making a script which backups user data and some lfs lapper stored values into .txt files.

Problem:
With LFS Hosting, I won't know the exact directory, I can just go back or forward a folder.

In the cmd console we could just do .\ to stay within the current directory, or ..\ to go back a folder, but it seems like that doesn't work in LFSLapper. (it won't create a file).

Example directory: (my script is in LFSLapper/includes)
$Directory = "..\Databases";

Temporary Solution:

However, this works if I put the exact directory in (but I won't be able to do this in LFS Hosting):
$Directory = "C:\Games\LFSLapper V7.0.6.3\bin\default\Databases";

Question:
Does anyone have a way to create a .txt file within a directory that they are unfamiliar of, using the CreateFile() function?
alau07
S3 licensed
I know this thread is old, but has anyone got around this yet without installing other 3rd party software?
alau07
S3 licensed
Quote from Ante Bekavac :Hi!

I made that dash for RB4... You can check it out and download in the following link http://forum.city-driving.co.uk/showthread.php?tid=30771

https://imgur.com/a/6E91BTn

It looks great but only works for LFS version 0.6U Frown

I'm on 0.6T, would it be possible to port it to this ver.?

Such a bummer i got so excited xd
alau07
S3 licensed
Dashboard Request: Audi Sport Quattro - Car: RB4

Sadly there is not enough space between the two big dials to place 9 indicators and a digital time. The turbo meter fits nicely at the top though.

Images sourced from:
https://i.wheelsage.org/audi/sport_quattro/101824/1110/pictures/zgcgp9/
https://en.wheelsage.org/audi/sport_quattro/101824/1110/pictures/427747/
alau07
S3 licensed
(OLD) LFSLazy AE86 gauge ported from Vano Paniashvili's old AE86 mod (I had permission from him to share ported dash).

AE86 Gauges for XRG/T. Turbo on XRT is a bit lazy sorry, if anyone can improve it pls do xd

e.g. LEFT_XRG = Gauge for XRG for Left-hand drivers. In the image I am right-hand driver (UK) so i use RIGHT_XRG and Right_XRT.

Use the appropriate gauge from your respective driver's side otherwise the gauges will not be aligned with the dashboard.

Only works up to ver. 97 (Jul 7 2018)

Also coloured linear RPM is cool.
Last edited by alau07, .
alau07
S3 licensed
Thanks, it actually looks much cleaner than setting RegisterScheduleAction 60 times lel.

Can't believe I hadn't thought of this Face -> palm
[Solved] RegisterScheduleAction - FOREACH
alau07
S3 licensed
Problem:
1. Every second the timer is supposed to execute, it only executes once on lapper start.
2. $mList - It reports as 0 entries even though I'm online.
3. Even if I remove every line except the first one ( to report the time ) it only runs once.
#. Error logs say nothing Frown

Has anyone encountered this problem before? it works for me for scheduled actions of 1 minute tho...


CatchEvent OnLapperStart()
# Some functions ... #
RegisterScheduleAction( "* * * * * * *", Second_Timer ); # Execute every second.
EndCatchEvent

Sub Second_Timer() # Timer #
writeline( "RSB_Time timer " . GetLapperVar( "longtime" ) );
$mList = GetListOfPlayers();
$mListCount = arrayCount( $mList ); # Reports as 0 entries.
writeline( "RSB_Time $mList: " . $mListCount . " entries: " . $mList[0] . ", " . $mList[1] . "." );
FOREACH ( $maVar IN $mList )
writeline( "RSB_Time FOREACH" );
IF ( GetPlayerVar( $maVar["value"] , "UserName" ) != "" ) # Not Host #
THEN
# DO SOMETHING #
writeline( "RSB_Time Username exists" );
IF ( GetPlayerVar( $maVar["value"] , "Delivery" ) != "" )
THEN
$distance = ToNum( trackuserdistance( GetPlayerVar( $maVar["value"] , "Delivery" ) , $maVar["value"] ));
IF ( $distance < 5 )
THEN
SetPlayerVar( $maVar["value"] , "DeliveryTick" , ToNum( GetPlayerVar( $maVar["value"] , "DeliveryTick" ) + 1 ) );
$TickCount = ToNum(GetPlayerVar( $maVar["value"] , "DeliveryTick" ));
IF ( $TickCount >= 3 )
THEN
SetPlayerVar( $maVar["value"] , "DeliveryStatus" , "1" );
$DeliverToUserID = GetPlayerVar( GetPlayerVar( $maVar["value"] , "Delivery" ) , "UserID" ); #Get Receiving Player UCID.
FOREACH ( $CompanyArray IN $Companies )
$OrderVar = ToString( "UserName_Order_" . $CompanyArray["value"] . "_" . $DeliverToUserID );
$OrderCompany = ToString( $CompanyArray["value"] );
IF ( GetStoredValue( $OrderVar ) != "" )
THEN
$DeliverToNickName = GetPlayerVar( GetStoredValue( "UserName_Number_" . $DeliverToUserID ) , "NickName" );
PrivMsg( $maVar["value"] , "^7You have ^2successfully delivered ^7to " . $DeliverToNickName );
Delivery_Order_Delivered( $OrderCompany , $DeliverToUserID );
ENDIF
ENDFOREACH
ENDIF
ENDIF
ENDIF
ENDIF
ENDFOREACH
EndSub

Temp fix: wrote a RegisterScheduleAction for every second from 00 to 59 T_T
Last edited by alau07, .
alau07
S3 licensed
Hey, sorry for the late reply I just got back to this post. I'm using global Set/GetStoredValue( "UserName_Cash_" . $userName ) as a 'reserve' so when player's connect it goes into their wallet. On the plus side I can also use it to store mail for when they come online.

Nevertheless thank you very much for the script, I will be sure to use it when I need to change UserStoredValue(s) again, and I'm sure it'll be very helpful for other users to implement into their server, as it has done wonders for mine.

I know I can't always depend on global stored values as the table has to make a new row every time I name a new variable. I'm planning on scripting player contracts, memberships and insurance soon and I can't imagine how many more variables I have to name.
alau07
S3 licensed
New Problem:
## This part of the code is within a FOR loop, algorithm works, SetUserStoredValue doesn't.
## $IDUser = GetStoredValue( "UserName_Number_" . $i ) ## from FOR loop ##
writeline( "attempting to give user " . $IDUser . " cash from " . GetUserStoredValue( $IDUser, "Cash" ) );
SetUserStoredValue( $IDUser , "Cash", Round(ToNum( GetUserStoredValue( $IDUser, "Cash" ) + $Dividend ),2) );
writeline( "attempted to give user " . $IDUser . " cash to " . GetUserStoredValue( $IDUser, "Cash" ) );

SetUserStoredValue cannot be used on an offline user...If you can GET why shouldn't you be able to SET? For the record GetUserStoredValue works...

I've tried it with other stored values other than "Cash" too, but it just can't Set stored values for any offline users.

Does this mean I have to resort to using SetStoredValue( "UserName_Cash_" . $IDUser ) instead?
alau07
S3 licensed
Thanks a lot Heart , it's working flawlessly! Big grin

Now time for me to write the dividend script cuz rip some people missed out on the money today Frown
Last edited by alau07, .
alau07
S3 licensed
Sorry I forgot to mention it, but it actually starts with:

[b]CatchEvent OnConnect ( $userName )[/b]
....does some stuff....
IF ( GetStoredValue( "REGISTER_COUNTER" ) == "" )
... # see my previous post for whole section of relevant code # ....
ENDFOR
... some other stuff ...
EndCatchEvent

I haven't altered anything except added those lines of code (see previous reply) to my Event OnConnect. I think those pieces of code are enough, it's just that the algorithm seems to be wrong and I'm having trouble applying the right algorithm (just can't wrap my head around it Confused ) so it only registers unique usernames. As far as error logs go it doesn't say anything's wrong (from the ERR.log file in bin/default/logs).

Also $userName is already declared in the beginning, and should not be the problem as it returns my username when registered (it basically registers me as a new user every reload Shrug )

Regarding starting with 2:
I had trouble with it starting at $i = 0 so I just moved up 1. The problem isn't where it starts but how it executes. I think the main problem might be the parameters, or the order of the IF statements...

I also manually set the stored-values "REGISTER_COUNTER" and "UserName_Number_" . $i
if I find duplicates after connecting/reloading.

CONTEXT: (If it helps...)
I need a script that runs at 5pm, everyday, that distributes the player's dividend (gives them some money from the total profit) relative to their shareholding from the companies they have partial ownership of, even when they're offline. This is where listing all usernames from storedvalue.dbs comes in:
(All in a WHILE Loop with $i = 1 and $register_counter = "REGISTER_COUNTER")
IF ( GetStoredValue( "UserName_Number_" . $i ) != "" )
THEN
IF ( GetPlayerVar( GetStoredValue( "UserName_Number_" . $i ), "NickName" ) == "" ) # Offline
THEN
# distribute dividend by set/getuserstoredvalue. #
ELSE
IF ( GetPlayerVar( GetStoredValue( "UserName_Number_" . $i ), "NickName" ) != "" ) # Online
THEN # distribute dividend normally by set/getplayervar. #
ENDIF
ENDIF
ENDIF

If they're offline, I can send them a mail by a:

IF ( GetUserStoredValue("HAVEMAIL") == 1 ) THEN PrivMsg GetStoredValue("MAIL_" . $userName)

if they do receive dividends while offline. These investors have every right to know how much dividend they receive at 5pm, even if they come online at 6pm.
Last edited by alau07, .
alau07
S3 licensed
Problem 2: This is the code so far, but it keeps registering the same user (me) every !reload. The "REGISTER_COUNTER" also increases by 1 as a consequence too. And yes, some of it is from your reg_system.txt.

IF ( GetStoredValue( "REGISTER_COUNTER" ) == "" )
THEN
SetStoredValue( "REGISTER_COUNTER" , ToNum("2") );
ENDIF
$register_counter = ToNum( GetStoredValue( "REGISTER_COUNTER" ) );
IF ($register_counter == "")
THEN
$register_counter=2;
ENDIF

FOR ( $i = 1; $i < $register_counter; $i = $i + 1 ) ### Set $i as 1 unit under $register_counter. ###
IF ( ToString(GetStoredValue( "UserName_Number_" . $i )) == ToString(GetPlayerVar( $userName , "UserName" )) )
THEN
GlobalMsg( "User already registered on system" );
GlobalMsg( "^7User ID: ^6" . $i );
writeline( "User already registered on system" );
$i = $i + $register_counter;
ELSE
IF (( GetStoredValue( "UserName_Number_" . $i ) != "" ) && ( GetStoredValue( "UserName_Number_" . $i ) != "0" ))
THEN
GlobalMsg( "^7Stored User/ID " . GetStoredValue( "UserName_Number_" . $i ) . "/" . $i . "." );
ELSE
IF ( ( GetStoredValue( "UserName_Number_" . $i ) == "" ) || ( GetStoredValue( "UserName_Number_" . $i ) == "0" ) )
THEN
SetStoredValue( "UserName_Number_" . ToString( $register_counter ) , $userName );
SetStoredValue( "REGISTER_COUNTER" , ToNum( GetStoredValue( "REGISTER_COUNTER" ) + 1 ) );
GlobalMsg( "^7New User (^6" . $userName . "^7) has been registered." );
GlobalMsg( "^7New User ID: ^6" . ToNum( $register_counter ) );
writeline( "^7New User (^6" . $userName . "^7) has been registered." );
ENDIF
ENDIF
ENDIF
ENDFOR

[Solved] Retrieve UserNames - storedvalue.dbs
alau07
S3 licensed
As the title says,
Problem:
I need to distribute a large sum of money (which occurs on a regular interval) for all players (users) in my server whether they are online or offline. One of the problems is that all the users' and server data are stored in storedvalue.dbs (located in "./bin/default/Databases" ).

GetListOfPlayers() - only returns list of all players online ...
GetListOfUsersGroup - doesn't work for storedvalue.dbs ...

Is there a way to retrieve all usernames of players in storedvalue.dbs so I can #do something# with their stored data?

e.g.: (This is what I'm trying to do)
Sub < this sub >
$mList = [b]< Get List of All Players' "UserNames" from storedvalue.dbs >[/b] ;
FOREACH ( $maVar IN $mList )
IF ( <they are online, their nickname != "" > )
THEN
# Distribute moneys #
SetPlayerVar( $maVar["value"] , "<var>" , <change> );
ELSE
# Rest aren't online, so distribute moneys to remaining (offline) players too #
SetUserStoredValue( $maVar["value"] , "<var>" , <change> );
ENDIF
ENDFOREACH
EndSub

Note: No, I am not asking for a full script lol, I just need a function that can draw all usernames from the current storedvalue.dbs database.
Last edited by alau07, .
alau07
S3 licensed
I can confirm that I get the same error with GetPlayerVarByUcid. I removed it, and it returns the $Days value. The second problem is that it needs to execute a command that bans a specific user, which is where the Ucid of the player comes in...

WHILE ( $plyNum < $mCount )
$thisPlayer = GetPlayerInfo($mList[$plyNum]);
$uName = $mList[$plyNum];
$uUCID = $thisPlayer["UCID"];
$uNick = $thisPlayer["NickName"];
$uUser = $thisPlayer["UserName"];
$PanelRowHeight = 5;
$Prefix = $uUCID . "_";
openPrivTextButton( "BAN_" . $Prefix ,$ModBtnX+80,$ModBtnY + 2 + ( $PanelRowHeight * ( $plyNum+1 ) ),20,$PanelRowHeight,5,16,"^3No. of Days?","",3, BanPanel_Ban );


It works for 1 step buttons, such as Pitlane and Kick... because I don't need to input 2 arguments to execute the cmdLFS, 1 being the username and 2 being the number of days.

It also doesn't help that the backcalled sub for executing the text button can only contain 2 arguments, I can't add more than:

BanPanel_Ban ( $KeyFlags, $Days) or ($KeyFlags, $id).

The current state of the sub:

Sub BanPanel_Ban ( $KeyFlags, $Days ) #If >2 arguments, Error: Incorrect number of arguments.
#$Ucid = ToNum(split( $id,"_",1 )); # Error: empty string in ToNum function.
writeline ( "DEBUG: " . $Days );
$Cash = ToNum( ToString( $Days ) );
$userName = GetCurrentPlayerVar("UserName");
closePrivButton( "BAN_" . $Prefix );
#SetPlayerVar( GetPlayerVarByUCID( $Ucid , "UserName" ) , "Cash" , Round((ToNum( GetPlayerVarByUCID( $Ucid , "Cash" ) + $Cash )),2) ); # Error: Parameter is wrong.
GlobalMsg( "Test $Days: ^6" . $Days );
PrivMsg( GetPlayerVarByUCID( $Ucid , "UserName" ), "Value: " . $Cash ); # Error: Parameter is wrong.
Cruise_HUD( $userName );
#Cruise_HUD( GetPlayerVarByUCID( $Ucid , "UserName" ) );
BanPanel_Close ();
EndSub

(I put a # where it doesn't execute or generates an error in the log file.)
Last edited by alau07, .
alau07
S3 licensed
Thanks, so far I have:
openPrivTextButton( "BAN_UI_Days",90,100,20,10,5,16,"^3Input: No. of Days","^7###",3, BanPanel_Ban );

Sub BanPanel_Ban ( $KeyFlags, $Days )

$Cash = ToNum( ToString( $Days ) );
$userName = GetCurrentPlayerVar("UserName");
SetPlayerVar( GetPlayerVarByUCID( $Ucid , "UserName" ) , "Cash" , Round((ToNum( GetPlayerVarByUCID( $Ucid , "Cash" ) + $Cash )),2) );
GlobalMsg( "Test $Days: ^6" . $Days );
PrivMsg( GetPlayerVarByUCID( $Ucid , "UserName" ), "Value: " . $Cash );
Cruise_HUD( $userName );
Cruise_HUD( GetPlayerVarByUCID( $Ucid , "UserName" ) );
ModPanel_Close ();
BanPanel_Close ();
EndSub

Problem 1:
The private button doesn't close even with closebuttonregex. It has infinite duration...

Problem 2:
Nothing happens after I enter text.

P.S. I read your ban script but the problem is I can't create new files in the directory (LFS hosting). This means I can't retrieve offline banned players... so I have to do it under the original ban system. The openprivtextbutton should allow user input for # days for execute by cmdLFS.
Last edited by alau07, .
[Solved] OpenTextButton/OpenPrivTextButton
alau07
S3 licensed
openPrivTextButton( "dopm_message",61,56,78,8,5,80,"^3Type message (up to 50 chars)","^3Click here to edit message",50,pm_text_input );

^^^
Found that in Gai-Luron's who.lpr.txt.
- The missing variable happens to be duration.

Problem:
I need a ban button for my admin panel that asks for "How many days?" which requires user input of up to 3 digits, before executing the cmdLFS function.

After looking through examples and some testing I can't figure out what the "5" means.

Also can anyone guide me onto the full format and values of a openPrivTextButton/opentextbutton?

It's not as similar to openPrivButton as I thought it was...
Last edited by alau07, .
alau07
S3 licensed
Thank you.
[Solved] NumToMSH(var)
alau07
S3 licensed
Brief:

Well someone asked me today if it was possible to change the lap time format from:

Minutes.Seconds.Milliseconds
to
Minutes:Seconds.Milliseconds

As you can see, barely any difference lol.

So I was wondering if it's possible to edit the NumToMSH function?

Or can anyone think of another method to approach this?
alau07
S3 licensed
THANK YOU SO MUCH IT WORKED LOL. I just had to fix the dot rip.

So at that specific point, the required script:

GlobalMsg("Direction: " . GetPlayerVar( $userName, "Direction" ) . "."); #Print User Direction
GlobalMsg("Direction: " . GetPlayerVar( $userName, "Heading" ) . "."); #Print User Direction
IF ( Round(GetPlayerVar( $userName, "Direction" ), 2) >= 160 && Round(GetPlayerVar( $userName, "Direction" ), 2) <= 240 )
THEN
GlobalMsg( "Calculated Wrong Way Direction" );
cmdLFS( "/pitlane " . GetPlayerVar( $userName , "UserName") );
GlobalMsg( GetPlayerVar( $userName, "NickName") . " ^2 pitlaned for wrong way!");
ENDIF
alau07
S3 licensed
I can't seem to print out Direction or Heading...

GlobalMsg("Direction: " . ToNum( GetPlayerVar( $userName, "Direction" ) ) "."); #Print User Direction
GlobalMsg("Direction: " . ToNum( GetPlayerVar( $userName, "Heading" ) ) "."); #Print User Direction

I've tried using $ instead of quotes, I've tried without ToNum, just what am i doing wrong.

What are the units of Direction?
[Solved] No Wrong Way On Cruise Server
alau07
S3 licensed
I can't seem to find the answer to this anywhere so...

Brief:
I'm making a hotlap server, but has some rpg elements to it for people who are spectating/parking/fooling around in car park.

Objective:
So I'm trying to write a script that pitlanes on wrong way at a certain point (see image for wrong way direction). At the moment, I can RegisterNodeAction and can execute a "pitlane" command, the problem is, I cannot specify a direction...

Script:
RegisterNodeAction( "BL1", 339, ReverseCheck, "" );

Sub ReverseCheck ( $userName, $ZoneID )
IF ( $Mode == "Cruise" )
THEN

GlobalMsg( "Player is Exiting Pits" );
IF ( GetPlayerVar( $userName, $Direction ) != "0" )
THEN

GlobalMsg( "Attempting to Spectate Player for Wrong Way" );
cmdLFS( "/pitlane " . GetPlayerVar( $userName , "UserName") );
HERE I JUST ADD MESSAGES AND FINES
ENDIF
ENDIF
EndSub

Comment:
As you can see there's a problem with indicating the direction, and the manual only says:
"Direction: 0 = positive y-direction."

Solutions?
Are there any other variables I can use? How would you approach this problem?

(And no, I need cruise mod lol)
alau07
S3 licensed
Hellos amigos Smile)
alau07
S3 licensed
Quote from DANIEL-CRO :Yesterday I updated my version of Lazy to work with test patch. However dashboard is now drawn in 512x512 (before 256x256). I also did required changes that dashboard is drawn at correct resolution, however that required me to scale up all individual png textures by 2. Also multiply all x and y positions. Downside is that all current gauges should be manually converted prior to use. I really want to do that automatically to keep all current gauges compatible.

@DANIEL_CRO

So will the oil/engine temp gauges get fixed in the new update, so they can be shown underneath the dials?

The same issue also exists with the handbrake and lights, dunno if that's to do with LFSLazy or LFS.

*EDIT: nvm I managed to move the oil and temp gauges to a place under the RPM gauge by setting them to (1,0) and working from there.
Last edited by alau07, .
alau07
S3 licensed
@DANIEL-CRO

1. For LFSLazy dashboards, (specifically on XRG) would it be possible to have oil and engine temp needles next to the dials?

When I try move them they only show either between the dials, or above the shifter (middle of car - XRG).

2. If it is not possible to fix (1.), would it be possible to add linear oil and engine temp gauges? (so they can be used as OilLin and TempLin, displayed where the dials typically are in XRG).

Screenshots of the WIP (with permission from Vano Paniashvili):
a.) as you can see the oil and engine temp gauges underneath the RPM dial doesn't have the respective needles. I'm trying to either add needles to both of them, or make them lin-gauges.
b.) I don't want to have to edit the .dds files as well, as its nice to keep the whole mod within one gauges folder.

1
FGED GREDG RDFGDR GSFDG