The online racing simulator
Searching in All forums
(882 results)
Bass-Driver
S3 licensed
if i know the values, i can fix it in the Lapper sourcecode.

as a temporary fix you can try:

IF ( ToNum(GetPlayerVar( $userName, "Z" )) >= 0)
THEN
#Call joinrequest
ELSE
#Something else
ENDIF

Bass-Driver
S3 licensed
Not sure if thats possible within the discordbot. Because i do not send any text to the discordbot like "Playing:"
Need to look into their library to see if thats possible.
Bass-Driver
S3 licensed
As you said, LFSLapper crashes when you are below the map.
So i think the Z value (Height position of the car) might be the problem.

Can you provide me the axis values (X & Y & Z), before you call the joinrequest function.

GetPlayerVar($userName,"X");
GetPlayerVar($userName,"Y");
GetPlayerVar($userName,"Z");

Thanks
Bass-Driver
S3 licensed
You cannot request a IS_CIM packet.

The insim will receive the CIM packet once the player changed the interface such as entering the garage or going into Shift+U mode for example.
Bass-Driver
S3 licensed
Try the next line of code.
Add that line inside the OnConnect and OnDisconnect event.

You will see that the botstatus goes to: Playing: <numofplayers> Players

setconfigvar("DiscordBotStatus",":".GetLapperVar("numplayers")." Players"); #change discordbot statusmessage


<?php 
Event OnConnect
$userName # Player event

    
setconfigvar("DiscordBotStatus",":".GetLapperVar("numplayers")." Players"); #change discordbot statusmessage

EndEvent

Event OnDisConnect
$userName$reason # Player event

    
setconfigvar("DiscordBotStatus",":".GetLapperVar("numplayers")." Players"); #change discordbot statusmessage
  
EndEvent
?>


Bass-Driver
S3 licensed
Here is an example to start a loop for a specific player.
Did not test it, but its worth a try.


<?php 
CASE "!gps":
  
GPSMenu($userName,0);
BREAK;

Sub GPSMenu$userName,$id )
    
#Clickable Buttons
EndSub

Sub ClickedButton
$keyflags,$id # Lapper Event
    
$userName GetCurrentPlayerVar("UserName");
    
#Close unnecessary buttons here.
    
GPSLoop$userName);
EndSub


Sub GPSLoop
$userName# Lapper Event
    #Display Buttons
    #Delayedcommand for player 
    
PlayerDelayedCommand($userName,"GPSLoop_".$userName,1,GPSLoop);
EndSub

?>


To stop the loop.

<?php 
RemovePlayerDelayedCommand
($userName,"GPSLoop_".$userName);
?>

Bass-Driver
S3 licensed
now you know theres an error on line 40.
Goto line 40 in your script. To see which line gives the error.

Also check if all variables get an value. (also a part of debugging your code)

privmsg($userName); for example
Bass-Driver
S3 licensed
-Did you check the errorlogs?
-DistFromUser() Does this function exist?
Bass-Driver
S3 licensed
Just a few simple tasks to start debugging the code.

-Check the errorlog
-Create a "debug" message within the gpsotel() sub, to check if the sub is updating.

i prefer PlayerDelayedcommand(); for player specific delayedcommands


<?php 
PlayerDelayedcommand
(); #Start delayedcommand for a specific player

            
$UserName "Bass-Driver";
            
$NameOfDelay "CloseButton";
            
$DelayInSeconds 3;
            
$SubCallBack "ThisSub";

            
PlayerDelayedcommand($UserName,$NameOfDelay,$DelayInSeconds,$SubCallBack);

Sub CloseButton($userName)
privmsg($userName,"debug: this sub works");
EndSub
?>


Bass-Driver
S3 licensed
Quote from arda556 :I wonder if it's me or the lapper.

Its has something todo with encoding the characters.
So its a bug in LFSLapper.
Bass-Driver
S3 licensed
Quote from arda556 :It will really help me a lot, thank you Thumbs up
Also, I opened a topic about the Character error, is there still no solution?

haven't looked into it.
Bass-Driver
S3 licensed
ignore my first post.

I've implemented 2 functions to get the distance and angle between players/objects.

Get the username of the police and the suspect.
Or get the coordinates of the police and the suspect.

$GetDistanceInMeters = trackuserdistance($userNameOfPolice, $userNameOfSuspect);
$GetAngleInDegrees = GetAngle($userNameOfPolice,$userNameOfSuspect);

IF((ToNum($GetAngleInDegrees) > 80)&&(ToNum($GetAngleInDegrees) < 120))THEN
privmsg(>>>);
ENDIF


Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
Quote from Racon :15:03 is later than 14:59, but will fail that check because the minutes value is lower and you've used '&&'. I think you need to compile both values into seconds before comparing to avoid a whole bunch of conditional testing, ie:


<?php 

$test1 
= ($Split1[0]*3600)+($Split1[1]*60)+$Split1[2];
$test2 = ($Split2[0]*3600)+($Split2[1]*60)+$Split2[2];

IF (
$test1>$test2THEN
  
#code
ENDIF

?>


Yeah didnt think of that.
your code is much more efficient, ill edit the code in my first post.
Thx
Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
For time it should look something like this.
For the date GetLapperVar("ShortDate") it should somewhat the same.

$SplitCurrTime = SplitToArray(GetLapperVar("ShortTime"), ":");
$SplitSetTime = SplitToArray("21:00:00", ":");


$SplitCurrTime[0] = Hours
$SplitCurrTime[1] = Minutes
$SplitCurrTime[2] = Seconds

$SplitSetTime[0] = Hours
$SplitSetTime[1] = Minutes
$SplitSetTime[2] = Seconds

IF((ToNum($SplitCurrTime[0]) > ToNum($SplitSetTime[1])) && (ToNum($SplitCurrTime[1]) > ToNum($SplitSetTime[0])) &&(ToNum($SplitCurrTime[2]) > ToNum($SplitSetTime[2]))) THEN
#Your Code.
ENDIF


Thx to Racon for a much more efficient way.


<?php 
$SplitCurrTime 
SplitToArray(GetLapperVar("ShortTime"), ":");
$SplitSetTime SplitToArray("21:00:00"":");

$TimeInSecondsCurrTime ToNum(($SplitCurrTime[0]*3600) + ($SplitCurrTime[1]*60) + ($SplitCurrTime[2]));
$TimeInSecondsSetTime ToNum((SplitSetTime[0]*3600) + ($SplitSetTime[1]*60) + ($SplitSetTime[2]));

IF (
$TimeInSecondsCurrTime $TimeInSecondsSetTimeTHEN
  
#code
ENDIF
?>

Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
There isnt an option that tracks the position of the modded cars on that page.
So when the position of the car has changed in that table. The Red X might be obsolete.

What is the servername you run the insim on. I might join one day to see what you have built so far. Not that understand the language. Big grin
Bass-Driver
S3 licensed
Sorry for hijacking this topic.

Look for these functions

[*]setuserstoredvalue();
[*]getuserstoredvalue();

To get the date and time use the function GetLapperVar(""); To get the current date/time from the server.
Use these 2 vars the get the date/time ShortDate & ShortTime


<?php 
IF(getuserstoredvalue($userName,"LastSeen") == ""THEN
     globalmsg
(GetPlayerVar($userName,"NickName"). " ^7is a new player");
     
#Set Date/Time to userstoredvalue.
ELSE
     
#Get Date/Time from  userstoredvalue.
     
globalmsg(GetPlayerVar($userName,"NickName"). " ^7Last seen @".);
     
#Set Date/Time to  userstoredvalue.
ENDIF
?>

Bass-Driver
S3 licensed
You really need it?
I'll look into it when i have the time and the motivation for it.

Also this is gonna take a while because i have to find a way to maintain the compatibility of those buttonfunctions.

Its not like adding a new parameter. There is alot of code before/after (which i have no idea what it does) that need to be changed aswell.

Maybe something can be done with the buttonstyle parameter.
Bass-Driver
S3 licensed
Hello,

That is a very good question:
Scrolling through in the Insim document.
I found a parameter you have to set to display a button on all the screens (incl garage/menu).

#define INST_ALWAYS_ON 128 // if this bit is set the button is visible in all screens

// NOTE : You should not use INST_ALWAYS_ON for most buttons. This is a special flag for buttons
// that really must be on in all screens (including the garage and options screens). You will
// probably need to confine these buttons to the top or bottom edge of the screen, to avoid
// overwriting LFS buttons. Most buttons should be defined without this flag, and positioned
// in the recommended area so LFS can keep a space clear in the main screens.

I dont think its possible to that set parameter within the current Buttonfunctions:


<?php 
[*]openprivtextbutton();
[*]
opentextbutton();
[*]
openglobalbutton();
[*]
openprivbutton();
[*]
openbutton();
?>

Ill look into that soon, and maybe there is an easy way to implement it, without making the functions incompatible.
Or someone else made it already possible in LFSLapper.

Those buttonfunctions hasnt been touched since Gai-Luron worked on it back in the days.

EDIT: Checking the sourcecode, it is NOT possible to create buttons in the Garage/Menu, this parameter has never been added into the buttonfunctions.
Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
When do you get this message? During connecting?
You get this message for every server you tried to join?

Not sure if this is a LFSLapper issue.
Bass-Driver
S3 licensed
There is an delay between joining the server and set the ipaddress player value.
I recommend to set a delay of 2 a 3 seconds between OnConnect() Event and sending the discordmessage.

Edit: Sending messages on the phone is not ideal Tongue
Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
I've did some tests with the normal discord messages and discord embedded messages.

$DayNow = GetLapperVar(ShortDate);
$DayNowPlusFive = GetLapperVar(ShortDate,+5);

Embedded messages seems to be fine.

#DISCORD EMBED MESSAGE
$Title = "";
$Desc = "";
$Color = "0xFFFFFF";
$FieldTitle = "Test Day";
$FieldValue = StripLFSColor("**Day Now: **".$DayNow."\n **Day Now + 5: **".$DayNowPlusFive."");
$FieldInline = "True";
$Footer = "";
$ThumbnailUrl = "";
$ImageUrl = "";
SendDiscordEmbed($DiscordChannel_cmd,$Title,$Desc,$Color,$FieldTitle,$FieldValue,$FieldInline,$Footer,$ThumbnailUrl,$ImageUrl);

on the normal discordmessages sendmessagetodiscord(), the text wont be displayed.
while i was writing this, Yisc[NL] came up with a solution that might help.

Yisc[NL]'s his line did the trick. Thanks Thumbs up

$Text = Replace( "Day Now: ".$DayNow." + Day Now + 5: ".$DayNowPlusFive."","/","-");

#DISCORD NORMAL MESSAGE
sendmessagetodiscord($DiscordChannel_cmd,StripLFSColor($Text));



I have never experienced this, so this is good way to test the discord function in LFSLapper.

Do not understand why there is a difference between Embedded discord messages and normal ones when it comes to odd characters.
Bass-Driver
S3 licensed
i've did a test with GetLapperVar(ShortDate,+5);
Seems to work fine ingame.


<?php 
CASE "!day":
   
privmsg("Date Now: "   .GetLapperVar(ShortDate));
   
privmsg("Date Now + 5: " .GetLapperVar(ShortDate,+5));
BREAK;
?>



Instead of testing the code in discord. Do a couple of basic tests ingame with privmsg() or globalmsg() before testing it with other complicated code.

Might do some other tests later, but ill wait on your results first.
Bass-Driver
S3 licensed
You have this


$NewDate = GetLapperVar(LongDate,+5);
$NewDate2 = GetLapperVar(LongDate);

Should be this


$NewDate = GetLapperVar(ShortDate,+5);
$NewDate2 = GetLapperVar(ShortDate);

LongDate Lappervar doesnt support the "AddDays" feature.
Bass-Driver
S3 licensed
You can use "ShortDate" Lappervar get calculate the end date of the ban or something else.

GetLapperVar(ShortDate): Possible to add an 2nd parameter to add/delete days

$NewDate = GetLapperVar(ShortDate,5); // Adds 5 days to the current date
$NewDate = GetLapperVar(ShortDate,+5); // Adds 5 days to the current date
$NewDate = GetLapperVar(ShortDate,-5); // Deletes 5 days from the current date

Bass-Driver
S3 licensed
The website and mods do load slower than asual.
Also the sending insim commands to the server is slow sometimes.

1 <1 ms <1 ms <1 ms 192.168.178.1
2 10 ms 5 ms 5 ms 10.255.225.1
3 16 ms 21 ms 10 ms venl-rc0003-cr102-et101-251.core.as33915.net [213.51.193.45]
4 14 ms 15 ms 15 ms asd-tr0021-cr101-be153-10.core.as9143.net [213.51.158.50]
5 21 ms 15 ms 15 ms nl-ams04a-ri3-ae51-0.core.as9143.net [213.51.64.194]
6 18 ms 14 ms 14 ms 213.46.191.90
7 15 ms 31 ms 43 ms nlrtm1-rt002i.i3d.net [109.200.218.84]
8 18 ms 14 ms 14 ms nlrtm1-rt017i.i3d.net [109.200.219.55]
9 * * * Request timed out.
10 14 ms 13 ms 17 ms s2.lfs.net [188.122.74.149]
FGED GREDG RDFGDR GSFDG