The online racing simulator
Sending private msg
hi
i was was trying to make a code in lfslapper.lpr to send a privet msg to someone. but i failed.
could someone send/make a code for it??
thx
#2 - Krayy
Already exists...search in the Lapper.lpr file for commands called privMsg to check your syntax.

Basic usage is: privMsg ( "Message_text");
k i found it
but i want to do is

!prvmsg (Username here)== ($arvg)
Then open openPrivTextButton("prvmsg",50,51,25,15,5,96,"$arvg1"PrvMsg");
then send $arvg1 to $arvg)

i know this is wrong but i just give an example
could u help me with this??
krayy he is talking about sending a pm to another user
#6 - Krayy
In that case:

Short answer...yes, it is possible

Long answer...yes it is possible, BUT...currently lapper has 2 messaging functions...privMsg (for messages to current racer) and globalMsg (to all racers). I mentioned your request to my team last night and they think it would be a good idea to be able to pm people, so I will create a new function to send a msg to a specific player and integrate it with the !who command (I'll put a button on the right to PM someone, then prompt for a message).

I'll hopefully post it by next week.
Quote from Krayy :In that case:

Short answer...yes, it is possible

Long answer...yes it is possible, BUT...currently lapper has 2 messaging functions...privMsg (for messages to current racer) and globalMsg (to all racers). I mentioned your request to my team last night and they think it would be a good idea to be able to pm people, so I will create a new function to send a msg to a specific player and integrate it with the !who command (I'll put a button on the right to PM someone, then prompt for a message).

I'll hopefully post it by next week.

thats great... if i could get !who to work
#8 - Krayy
Here's the base code...
Okay guys,

Here's the base code that I will be using, wrapped in a !pm command for you.

Add this code in the LFSLapper.lpr file in amongst the other ! commands:

<?php 
        
CASE "!pm":
            
$idxSpace indexOf$argv" ");
            
$toUser subStr$argv,0,$idxSpace );
            
$argv trimsubStr$argv,$idxSpace ) );
            
userMsg (GetCurrentPlayerVar"Nickname" ), $toUser$argv);
            BREAK;
?>

Add this code to the parseEvent.cs file just above the code for the "privmsg" command:

<?php 
                
case "usermsg":
                    {
                        
testArgs(ident"SSS"args);
                        
currInfoPlayer listOfPlayers.getPlayerByUserName((string)args[1]);
                        if (
currInfoPlayer == null)
                            throw new 
GLScript.GLApp.GLScriptException("You can't use " ident " in this context, not a player event");
                        
string text args[2].ToString();
                        if (
text == "[[TranslateEngine]]")
                            
text lfsLang.replaceParmsLangStr(currInfoPlayer.idLang);
                        
SendMsgToConnection(currInfoPlayer.UCID"^6Personal msg from: ^8" + (string)args[0]);
                        
SendMsgToConnection(currInfoPlayer.UCID"^7" text );
                        break;
                    }
?>

Use by typing in a normal text window:
!pm krayy hey there matey

Note: To use the code, you need to address it using the username, not the nickname. This won't matter when I make it a button off of the !who display
Quote from Krayy :Okay guys,

Here's the base code that I will be using, wrapped in a !pm command for you.

Add this code in the LFSLapper.lpr file in amongst the other ! commands:

<?php 
        
CASE "!pm":
            
$idxSpace indexOf$argv" ");
            
$toUser subStr$argv,0,$idxSpace );
            
$argv trimsubStr$argv,$idxSpace ) );
            
userMsg (GetCurrentPlayerVar"Nickname" ), $toUser$argv);
            BREAK;
?>

Add this code to the parseEvent.cs file just above the code for the "privmsg" command:

<?php 
                
case "usermsg":
                    {
                        
testArgs(ident"SSS"args);
                        
currInfoPlayer listOfPlayers.getPlayerByUserName((string)args[1]);
                        if (
currInfoPlayer == null)
                            throw new 
GLScript.GLApp.GLScriptException("You can't use " ident " in this context, not a player event");
                        
string text args[2].ToString();
                        if (
text == "[[TranslateEngine]]")
                            
text lfsLang.replaceParmsLangStr(currInfoPlayer.idLang);
                        
SendMsgToConnection(currInfoPlayer.UCID"^6Personal msg from: ^8" + (string)args[0]);
                        
SendMsgToConnection(currInfoPlayer.UCID"^7" text );
                        break;
                    }
?>

Use by typing in a normal text window:
!pm krayy hey there matey

Note: To use the code, you need to address it using the username, not the nickname. This won't matter when I make it a button off of the !who display

cool will try it later but could u change the code when u do :

!pm Bass-Driver
Then
openPrivTextButton("")
then it will do

(This is what Bass-Driver see when he get a private message from someone)
-^2Username sended u a private message
-^3Here the message what u write to Bass-Driver

i hope u understand what i'm saying here
Sorry for barging in, but, what if the user name has a space in it? Mind, I have never even looked at lapper and have no idea how it works, but just using the first occurrence of a space as user/message separation (looking at the !pm command here) seems problematic.

Also Bass-Driver, it's spelled private, not privet.
Quote :Also Bass-Driver, it's spelled private, not privet.

ye i know i'm tired so i cant type my english correctly
i would do "username"

this would also be solved with the priv button
becauseu would do !pm username

then that would open a button that u clikc and typer ur pm
Thtas why I said that this initial !pm command is a temporary solution. I'll get time to wrap it nicely later. As to spaces in the username, I'm pretty sure that LFS will not let you register a username with a space in it, and nicknames are local to your client/server, so that will never be an issue.
Quote from Krayy :I'm pretty sure that LFS will not let you register a username with a space in it

Well, you're wrong
For example "Bob Smith"
Quote from Krayy :I'm pretty sure that LFS will not let you register a username with a space in it.

Hi,

I have "tim nl" with a space.
Quote from Tim NL :Hi,

I have "tim nl" with a space.

As your actual user name or as your nickname that you set in the options screen?
Quote from Krayy :As your actual user name or as your nickname that you set in the options screen?

Its my username "tim nl"
Quote from Krayy :As your actual user name or as your nickname that you set in the options screen?

The forum name is equal to the license name

Or just go here: https://www.lfs.net/?page=register
And enter a user name with space and click "Check availability & spelling" below.
kravvy i found another bug with the temp thing

when u do !pm (user) with no message it crashes i was trying to find a way to fix it but i tired this :


<?php 
CASE "!pm":
            
$idxSpace indexOf$argv" ");
            
$toUser subStr$argv,0,$idxSpace );
            
$argv trimsubStr$argv,$idxSpace ) );
            
            IF( 
$argv != "" )
            
Then
              privmsg
("^6Personal Msg To ^8" GetPlayerVar$toUser"Nickname" ) );
              
privmsg("^7" $argv );
            
userMsg (GetCurrentPlayerVar"Nickname" ), $toUser$argv);
            ELSE
                          
privmsg("^1YOU Must Have A Message To Send To The User!");
            ENDIF
            BREAK; 
?>

and it dont work
Guys,

I did say that it was a temporary solution.

I have posted some updated code in a new thread that integrates the functions into the !who screen, as it's more to do with adding database functionality and the PM code is a result of that.

http://www.lfsforum.net/showthread.php?t=61992

Be aware that there is a lot of custom code that will need to be added to your LFSLapper.lpr file for some globals

Also, the a patch needs to be applied to the source code for 5.8.4.6, but it could most likely work in versions since 5.8.4.4.
i know this is a lil late but...
for your !pm command do


<?php 
    
CASE "!pm":
           IF( 
$argv != "" )   THEN
            $idxSpace 
indexOf$argv" ");
                                IF( 
$idxSpace != -THEN
            $toUser 
subStr$argv,0,$idxSpace );
            
$argv trimsubStr$argv,$idxSpace ) );
          
privMsg "^6Private Msg To ^8" GetPlayerVar$toUser "Nickname" )  );
            
privMsg "^7" $argv );
            
userMsg (GetCurrentPlayerVar"Nickname" ), $toUser$argv);
  ELSE
             
privMsg "^7Command needs 2 paremters" );
 ENDIF
 ELSE
             
privMsg "^7Command needs 2 paremters" );
 ENDIF
            BREAK;
?>

because it prevents lapper from crashing when a user just types "!pm"
Krayy
when do u release the !pm code??

FGED GREDG RDFGDR GSFDG