The online racing simulator
[Help] !carinfo - Shows the information of the car
Ok, this is what I have done:

case "!carinfo":
if (StrMsg.Length == 1)
{
foreach (clsPlayer Player in Players)
{
InSim.Send_MTC_MessageToConnection([COLOR=Black]"^6> ^7Car info of " + Player.PlayerName + ":"[/COLOR], MSO.UCID, 0);
InSim.Send_MTC_MessageToConnection("^6> ^7Skin Name: " + Player.SkinName + ".jpg", MSO.UCID, 0);
InSim.Send_MTC_MessageToConnection("^6> ^7Car: " + Player.CarName + "", MSO.UCID, 0);
InSim.Send_MTC_MessageToConnection("^6> ^7Plate: " + Player.Plate + "", MSO.UCID, 0);
InSim.Send_MTC_MessageToConnection("^6> ^7Passengers: " + Player.Passengers + "", MSO.UCID, 0);
}
}
break;

It works good but it shows the information for all players, I want to show only the information of the player who write it.

Thank you
#2 - gru
U have to modify foreach loop, add if clause checking user id

foreach (clsPlayer Player in Players)
{
if (Player.UniqueID == MSO.UCID)
{
//show info code
break;
}
}

next time post it in lfs_external or cruise thread, this is general programming section
It stills showing everyone's car information :S

case "!carinfo":
if (StrMsg.Length == 1)
{
foreach (clsPlayer Player in Players)
{
if (Player.UniqueID == MSO.UCID)
InSim.Send_MTC_MessageToConnection("^6> ^7Car info of " + Player.PlayerName + ":", MSO.UCID, 0);
InSim.Send_MTC_MessageToConnection("^6> ^7Skin Name: " + Player.SkinName + ".jpg", MSO.UCID, 0);
InSim.Send_MTC_MessageToConnection("^6> ^7Car: " + Player.CarName + "", MSO.UCID, 0);
InSim.Send_MTC_MessageToConnection("^6> ^7Plate: " + Player.Plate + "", MSO.UCID, 0);
InSim.Send_MTC_MessageToConnection("^6> ^7Passengers: " + Player.Passengers + "", MSO.UCID, 0);
}
}
break;

case "!carinfo":
if (StrMsg.Length == 1)
{
InSim.Send_MTC_MessageToConnection("^6> ^7Car info of " + Players[GetPlyIdx(MSO.PLID)].PlayerName + ":", MSO.UCID, 0);
InSim.Send_MTC_MessageToConnection("^6> ^7Skin Name: " + Players[GetPlyIdx(MSO.PLID)].SkinName + ".jpg", MSO.UCID, 0);
InSim.Send_MTC_MessageToConnection("^6> ^7Car: " + Players[GetPlyIdx(MSO.PLID)].CarName + "", MSO.UCID, 0);
InSim.Send_MTC_MessageToConnection("^6> ^7Plate: " + Players[GetPlyIdx(MSO.PLID)].Plate + "", MSO.UCID, 0);
InSim.Send_MTC_MessageToConnection("^6> ^7Passengers: " + Players[GetPlyIdx(MSO.PLID)].Passengers + "", MSO.UCID, 0);
}
break;

This will only work if the player is on-track though, if they aren't then obviously there's no data to show
#5 - PoVo
Quote from stickylfs :It stills showing everyone's car information :S

case "!carinfo":
if (StrMsg.Length == 1)
{
foreach (clsPlayer Player in Players)
{
if (Player.UniqueID == MSO.UCID)
InSim.Send_MTC_MessageToConnection("^6> ^7Car info of " + Player.PlayerName + ":", MSO.UCID, 0);
InSim.Send_MTC_MessageToConnection("^6> ^7Skin Name: " + Player.SkinName + ".jpg", MSO.UCID, 0);
InSim.Send_MTC_MessageToConnection("^6> ^7Car: " + Player.CarName + "", MSO.UCID, 0);
InSim.Send_MTC_MessageToConnection("^6> ^7Plate: " + Player.Plate + "", MSO.UCID, 0);
InSim.Send_MTC_MessageToConnection("^6> ^7Passengers: " + Player.Passengers + "", MSO.UCID, 0);
}
}
break;


Try this

case "!carinfo":
if (StrMsg.Length == 1)
{
foreach (clsPlayer Player in Players)
{
if (Player.UniqueID == MSO.UCID)
{
InSim.Send_MTC_MessageToConnection("^6> ^7Car info of " + Player.PlayerName + ":", MSO.UCID, 0);
InSim.Send_MTC_MessageToConnection("^6> ^7Skin Name: " + Player.SkinName + ".jpg", MSO.UCID, 0);
InSim.Send_MTC_MessageToConnection("^6> ^7Car: " + Player.CarName + "", MSO.UCID, 0);
InSim.Send_MTC_MessageToConnection("^6> ^7Plate: " + Player.Plate + "", MSO.UCID, 0);
InSim.Send_MTC_MessageToConnection("^6> ^7Passengers: " + Player.Passengers + "", MSO.UCID, 0);
}
}
}
break;

Haven't tested it, but it might work.
Quote from PoVo :Try this

case "!carinfo":
if (StrMsg.Length == 1)
{
foreach (clsPlayer Player in Players)
{
if (Player.UniqueID == MSO.UCID)
{
InSim.Send_MTC_MessageToConnection("^6> ^7Car info of " + Player.PlayerName + ":", MSO.UCID, 0);
InSim.Send_MTC_MessageToConnection("^6> ^7Skin Name: " + Player.SkinName + ".jpg", MSO.UCID, 0);
InSim.Send_MTC_MessageToConnection("^6> ^7Car: " + Player.CarName + "", MSO.UCID, 0);
InSim.Send_MTC_MessageToConnection("^6> ^7Plate: " + Player.Plate + "", MSO.UCID, 0);
InSim.Send_MTC_MessageToConnection("^6> ^7Passengers: " + Player.Passengers + "", MSO.UCID, 0);
}
}
}
break;

Haven't tested it, but it might work.

Thaaaanks ! It works now ^^
#7 - PoVo

FGED GREDG RDFGDR GSFDG