The online racing simulator
PM Command problem
Hello! I have problem with pm command if licence who im writing pm is like this: user name not username. I mean Two words pm say to me user was not found...
its the command
clsConnection Conn = Connections[GetConnIdx(MSO.UCID)];
bool PMUserFound = false;
foreach (clsConnection C in Connections)
{
string Message = Msg.Remove(0, C.Username.Length + 5);

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

InSim.Send_MTC_MessageToConnection("^4|^3 Message Sent To: ^7" + C.NoColPlyName + " (" + C.Username + ")", MSO.UCID, 0);
InSim.Send_MTC_MessageToConnection("^4|^3 Msg: ^7" + Message, MSO.UCID, 0);

PMBox("> PM Msg From: " + Conn.NoColPlyName + " (" + Conn.Username + ") to " + C.NoColPlyName + " (" + C.Username + ")");
PMBox("> Msg: " + Message);

InSim.Send_MTC_MessageToConnection("^4|^3 PM From: ^7" + Conn.NoColPlyName + " (" + Conn.Username + ")", C.UniqueID, 0);
InSim.Send_MTC_MessageToConnection("^4|^3 Msg: ^7" + Message, C.UniqueID, 0);
InSim.Send_MTC_MessageToConnection("^4|^3 To reply use ^2!pm " + Conn.Username + " <message>", C.UniqueID, 0);

foreach (clsConnection F in Connections)
{
if ((F.IsAdmin == 1 && F.IsSuperAdmin == 1) && F.UniqueID != MSO.UCID)
{
InSim.Send_MTC_MessageToConnection("^4|^3 PM From: ^7" + Conn.NoColPlyName + " to " + C.NoColPlyName, F.UniqueID, 0);
InSim.Send_MTC_MessageToConnection("^4|^3 Msg: ^7" + Message, F.UniqueID, 0);
}
}
}
}
if (PMUserFound == false)
{
InSim.Send_MTC_MessageToConnection("^4|^7 Username not found.", MSO.UCID, 0);
}

You have to split StrMsg[1] into 2 differend words. More info about split()

string user = StrMsg[1];
// Split string on spaces.
// ... This will separate all the words.
string[] username = user.Split(' ');

And then combine them together. Something like this i guess?

string UName = username[0] + " " + username[1];

if (C.Username == StrMsg[1])
{
blah
}
else if (C.Username == UName)
{
blahblah
}
else
{
InSim.Send_MTC_MessageToConnection("^4|^7 Username not found.", MSO.UCID, 0);
}

LFS External is a good place to start, but once you've learned how to handle packets and have had your fun there. You should upgrade to InSim.NET, LFS External is outdated Tongue
Hello! And first thx for replys, guys! @Bass-Driver This tactic does not worked...I mean if licence of player is example: djani ko0o insim send to me ''user was not found'' i mean if your licence is with two words, but if its one like a djaniko0o there is no problem. Problem is when players are using two words for them accounts.. I know lfs external is outdated, im just trying for fun Smile Thank you again! Please i need your support Frown
Hmm, these could be two possible solutions (most probably not the best ones, but this is what came in my mind):

1. Basically as inputs you have: the string that the user wrote (!pm "bla blabla bla"), and the list of the Usernames of the players in the server.
At the moment your code is splitting the "bla blabla bla" string and then comparing the first word (in our case "bla") with all the Usernames. Of course it fails if the complete username to search was "bla blabla", for example.
So, you could temporarily split also all the Usernames of the list, and then check for each Username in the list wich is the one that matches the highest number of strings contained in the !pm message.

Example to make things clearer:
Usernames in the list: Conn[0].Username="Hello", Conn[1].Username="Hello Hey", Conn[2].Username="Bye".
!pm Message="Hello Hey How are you?"

The code splits the Usernames of the list:
Conn[0].TempUser[] = Conn[0].Username.Split(' ');
Conn[1].TempUser[] = Conn[1].Username.Split(' ');
Conn[2].TempUser[] = Conn[2].Username.Split(' ');

And the !pm Message as well:
Msg[] = Message.Split(' ');

Now for each User let's check how many matches we have:
Conn[0].TempUser[0] == Msg[0] ---> 1 Match

Conn[1].TempUser[0] == Msg[0] ---> 1 Match
Conn[1].TempUser[1] == Msg[1] ---> 2 Match

Conn[2].TempUser[0] == Msg[0] ---> 0 Match

So the one who should receive the pm would be the 2nd one (Conn[1]).

In case of zero matches for all players, you can write "User not found".


2. Change the way in which the !pm command works:
- Create a new command (for example !upm <username>) which takes and stores the username of the player you want to send messages to. In this way you know for sure that the username is the whole string after !upm characters, so usernames with spaces won't create problems.
- Then, you can send whatever you want to that player just by sending a !pm <message> command.
Idk why people still helping crackers. Seriously...

A quick look on Djaniko0o profile:

Driven distance : 2.34 Ml
Fuel burnt : 0.72 Ltr

Do you believe a player registered in 2013 and with 2 miles driven decided to create a cruise InSim?

Going deeper, in 2013 (same year of register...) he asked for a login system, what isn't necessary on official servers: https://www.lfs.net/forum/thread/84360


Going even deeper, a quick search on Google shows a cracked cruise server including its page containing explanations about how to ip patch the LFS, and so on.

I'd like to ask a favor for these people how wanna show how smart they are with programming: DO A FAVOR TO LFS COMMUNITY AND TAKE A LOOK ON PLAYER'S PROFILE BEFORE HELP THESE CRACKERS.
Where's the moderator to delete this topic and all information that may help the crackers?
I mean, yeah:

But what if you're wrong? Djaniko0o could have just been super inactive and just got back after a few years, as much as I want to call out 'crackers' myself, that is up to the mods and devs. Not us as users.
Oh yeah... And then a cracked player took a look on his profile here on forum and then decided to use the same nick name, right?

I never seen a player with ALMOST NO driving stats opening a server. But if you believe someone can create/decide to open a Cruise server, do the tests online, and so on, I think the Santa Claus wont visit you on next christmas.

This is the commom behavior of people that just don't care about crackers, but still asking devs for updates.
kristofferandersen is cool. He is Norwegian.
As I saw the beginning of @cargame.nl's post, I was like:
Alright, this is it: he's going to flame me. Rofl
Uh, well what to say... Sorry. I had just given a glance to his registration date next to his avatar and (also considering that I got the same question also from other players) I thought that it was ok to answer here, so that everyone might have got help Shrug
Please could we stop this attacking of demo users who ask a question?

For example, you could choose to just help them if you feel like it and they haven't said anything about licensed content. Or if you have your suspicions or even evidence, perhaps it might be possible to ask them politely if they have been using a crack?

The problem is there is too much speech that is sort of attacking or accusing and it comes across as unpleasant. These posts are being reported and it takes up our time, and sometimes I guess it puts people off coming here. Maybe a polite suggestion about getting a license could bring people into our community?

FGED GREDG RDFGDR GSFDG