The online racing simulator
String Message Length?
(5 posts, started )
String Message Length?
Hi,

Sorry for making these threads but im just trying to learn more and more each day :P So let me get started :P

Basiclly i've made a OnCarContact code witch works perfectly fine untill a PlayerName gets to long or the message itself gets to long a example :


<?php 
MessageToAll
("^1** ^2Collision : " _players[CON.A.PLID].PName " ^1(^2" _players[CON.A.PLID].CName "^1)" "^2 hit " _players[CON.B.PLID].PName);
?>

This does not show the whole message when a player is hit. I've tried to but it in a Var but still diden't work any ideas?

Thanks! Yoran
If i remember right my MessageToAll function is using /msg which has a low limit in characters.

You can use the updated here:

void MessageToAll(string Message)
{
foreach (var CurrentConnection in _connections.Values) MessageToUCID(CurrentConnection.UCID, Message);
}

Also you can use StringHelper.StripColors(_connections[CON.A.PLID].PName) to remove the colors of a Player Name. This will reduce the characters! Happy coding.
Thanks!

Works pefectlly fine now

Yoran
Since InSim v5 if you set the UCID to 255 in a IS_MTC (Message To Connection) packet, it will send the message to all players. No need to use foreach etc, it can be done with one packet.

I've never used this library before, but I assume this would work:
void MessageToAll(string Message)
{
MessageToUCID(255, Message);
}

Quote from Degats :Since InSim v5 if you set the UCID to 255 in a IS_MTC (Message To Connection) packet, it will send the message to all players. No need to use foreach etc, it can be done with one packet.

I've never used this library before, but I assume this would work:
void MessageToAll(string Message)
{
MessageToUCID(255, Message);
}


Thanks for that optimise, just noticed it on Insim document.

String Message Length?
(5 posts, started )
FGED GREDG RDFGDR GSFDG