The online racing simulator
Searching in All forums
(879 results)
Bass-Driver
S3 licensed
Online at :
VM.Infected
with posting the values, i ment the value output of certain parameters.

Privmsg("X = ".$X_Axis);
Privmsg("Y = ".$Y_Axis);
Privmsg("Z = ".$Z_Axis);
Privmsg("Heading = ".$Heading);
Privmsg("PLID = ".$PLID);
Privmsg("UCID = ".$UCID);

you get the idea now.
Bass-Driver
S3 licensed
Online at :
VM.Infected
Nice that the code works. But that is just a temporary fix.
i whould like to fix that crash, so i need your values i provided in my post above.
Bass-Driver
S3 licensed
Online at :
VM.Infected
Looking into the sourcecode.
And Joinrequest shouldnt execute when Z value is below 0.
so should be something else.

I need all the values before you call joinrequest().

X-Axis
Y-Axis
Z-Axis
Heading
Flags
PLID
UCID
JRRAction

Also give me the name of the trackconfig and the position where you get "retired". (X and Y axis).
Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
Online at :
VM.Infected
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
Online at :
VM.Infected
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
Online at :
VM.Infected
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
Online at :
VM.Infected
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
Online at :
VM.Infected
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
Online at :
VM.Infected
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
Online at :
VM.Infected
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
Online at :
VM.Infected
-Did you check the errorlogs?
-DistFromUser() Does this function exist?
Bass-Driver
S3 licensed
Online at :
VM.Infected
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
Online at :
VM.Infected
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
Online at :
VM.Infected
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
Online at :
VM.Infected
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
Online at :
VM.Infected
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
Online at :
VM.Infected
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
Online at :
VM.Infected
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
Online at :
VM.Infected
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
Online at :
VM.Infected
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
Online at :
VM.Infected
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
Online at :
VM.Infected
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
Online at :
VM.Infected
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
Online at :
VM.Infected
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
Online at :
VM.Infected
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.
FGED GREDG RDFGDR GSFDG