The online racing simulator
Searching in All forums
(7 results)
StickerBomb
Demo licensed
Quote from DarkKostas :I'd suggest you to start converting your project on InSim.NET as LFS External is now dead and wont be supported. That's what i've done myself in the past.

I can't remember now how to do this in External and I don't think it's possible. You can do a small search by typing "insim." and you will see the available functions. Or else you can contact DarkTimes. I am quite sure he knows more about that.

Ok . Thanks a lot DarkKostas for support.
StickerBomb
Demo licensed
Quote from DarkKostas :Oops forgot to add it.

<?php 
        CarFlags CarToPLC
(string CarName)
        {
            switch (
CarName.ToUpper())
            {
                case 
"XRG": return CarFlags.XRG;
                case 
"LX4": return CarFlags.LX4;
                case 
"LX6": return CarFlags.LX6;
                case 
"RB4": return CarFlags.RB4;
                case 
"FXO": return CarFlags.FXO;
                case 
"XRT": return CarFlags.XRT;
                case 
"RAC": return CarFlags.RAC;
                case 
"FZ5": return CarFlags.FZ5;
            }
            return 
CarFlags.None;
        }
?>

I am running this code on InSim.NET by the way.

I know, me too. Code work perfect!! Now i want to run the code on LFS External, but i don't know how to run that in External

<?php 
insim
.Send(new IS_PLC UCID UCIDCars AvailableCars });  
?>

(btw thanks for all support )
InSim Send Packet
StickerBomb
Demo licensed
How to make this think

<?php 
insim
.Send(new IS_PLC UCID UCIDCars AvailableCars });
?>


to work on LFS External?
StickerBomb
Demo licensed
Quote from DarkKostas :

<?php 
//Replace string AVAILABLE_CARS with the var that a person owns a car
string AVAILABLE_CARS "XRG+LX4+LX6+RB4+XRT+RAC+FZ5+FXO";
string[] AllCars AVAILABLE_CARS.Split('+');

string CurrentCar "";
bool DrivingNotOwnedCar true;
byte PlayerID GetPlayer(UCID);
if (
PlayerID != 255CurrentCar _players[PlayerID].CName;

CarFlags AvailableCars CarFlags.None;
foreach (var 
ThisCar in AllCars)
{
    if (
ThisCar == CurrentCarDrivingNotOwnedCar false;
    
AvailableCars |= CarToPLC(ThisCar);
}

insim.Send(new IS_PLC UCID UCIDCars AvailableCars });
return 
DrivingNotOwnedCar;
?>

You can use it as a function on NPL to check if he doesn't own the car so you can spectate him.

great code, but what funcion execute code of CarToPLC?
Last edited by StickerBomb, .
StickerBomb
Demo licensed
Quote from DarkKostas :

<?php 
vars Conn 
Connection[GetConnIDX(PLC.UCID)];

//Reset their cars first. They have none
PLC.Cars 0;

//Start giving them cars
if (Conn.CarsList.contains("XFG")) PLC.Cars |= 1;
if (
Conn.CarsList.contains("XRG")) PLC.Cars |= 2;
if (
Conn.CarsList.contains("FBM")) PLC.Cars |= 0x80000;
?>

This should work.

I tryed but i got 2 errors "Error 1 Operator '|=' cannot be applied to operands of type 'InSimDotNet.Packets.CarFlags' and 'int' "

"Error 2 Cannot implicitly convert type 'int' to 'InSimDotNet.Packets.CarFlags'. An explicit conversion exists (are you missing a cast?)
"
StickerBomb
Demo licensed
Quote from doowle :BOSCHO i had the same problem, i'm nor programmer and have little php skills but i think it has something to do with the script not being able to access the file.

I got around this by removing this line in server.php

$filepath[$c] = $serverprot[$c] . "://" . $ftpuser[$c] . ":". $ftppw[$c] . "@" . $serverip[$c] . $hostpath[$c] . "/host" . $lfsport[$c] . ".txt";

and putting this line in _data_config.php in the connention info for Server 1

$filepath[0] = "/lfs/host63392.txt";

I can do this as the php scripts are running on the same server as the LFS dedicated server (that may not be the case for you)


I also had to change;
die "File access error!";

for
echo "File access error!";
exit();

In server.php

Not really a fix, but certainly a work around!

Doowle

I have this problem too, but this fix no work for me..

Help me pls
StickerBomb
Demo licensed
Here is my command..
[Command("kick", "kick <username> <reason>")]
public void kick(string Msg, string[] StrMsg, Packets.IS_MSO MSO)
{
clsConnection Conn = Connections[GetConnIdx(MSO.UCID)];

if (StrMsg.Length > 2)
{
if (Conn.IsAdmin == 1 || Conn.IsSuperAdmin == 1 || Conn.IsModerator == 1)
{
bool KickUserfound = false;
foreach (clsConnection C in Connections)
{
string Message20 = Msg.Remove(0, C.Username.Length + 6);

if (C.Username == StrMsg[1] && StrMsg[1].Length > 1)
{
KickUserfound = true;

MsgAll("^1" + C.PlayerName + " was kicked by " + Conn.PlayerName);
MsgAll("^1Reason:^7" + Message20);
Message("/kick " + C.Username);

}
}
if (KickUserfound == false)
{
InSim.Send_MTC_MessageToConnection("^3Wrong username.", MSO.UCID, 0);
}
}

}
else
{
InSim.Send_MTC_MessageToConnection("^3Wrong command", MSO.UCID, 0);
}

}

FGED GREDG RDFGDR GSFDG