View Full Version : Sending private msg
Bass-Driver
30th September 2009, 17:30
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
Krayy
30th September 2009, 20:19
Already exists...search in the Lapper.lpr file for commands called privMsg to check your syntax.
Basic usage is: privMsg ( "Message_text");
Bass-Driver
30th September 2009, 20:34
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??
Fire_optikz001
30th September 2009, 22:10
krayy he is talking about sending a pm to another user
Bass-Driver
1st October 2009, 16:40
krayy he is talking about sending a pm to another user
thats right
Krayy
1st October 2009, 20:49
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.
Fire_optikz001
1st October 2009, 21:54
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
Krayy
2nd October 2009, 05:38
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:
CASE "!pm":
$idxSpace = indexOf( $argv, " ");
$toUser = subStr( $argv,0,$idxSpace );
$argv = trim( subStr( $argv,$idxSpace ) );
userMsg (GetCurrentPlayerVar( "Nickname" ), $toUser, $argv);
BREAK;
Add this code to the parseEvent.cs file just above the code for the "privmsg" command:
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
Bass-Driver
2nd October 2009, 17:04
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:
CASE "!pm":
$idxSpace = indexOf( $argv, " ");
$toUser = subStr( $argv,0,$idxSpace );
$argv = trim( subStr( $argv,$idxSpace ) );
userMsg (GetCurrentPlayerVar( "Nickname" ), $toUser, $argv);
BREAK;
Add this code to the parseEvent.cs file just above the code for the "privmsg" command:
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
AndroidXP
2nd October 2009, 17:26
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. :shrug:
Also Bass-Driver, it's spelled private, not privet.
Bass-Driver
2nd October 2009, 18:32
Also Bass-Driver, it's spelled private, not privet.
ye i know i'm tired so i cant type my english correctly :)
Fire_optikz001
2nd October 2009, 18:54
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
Krayy
2nd October 2009, 21:25
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.
AndroidXP
2nd October 2009, 21:52
I'm pretty sure that LFS will not let you register a username with a space in itWell, you're wrong :)
For example "Bob Smith"
Tim NL
3rd October 2009, 10:49
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.:smileypul
Krayy
3rd October 2009, 11:16
Hi,
I have "tim nl" with a space.:smileypul
As your actual user name or as your nickname that you set in the options screen?
Tim NL
3rd October 2009, 13:26
As your actual user name or as your nickname that you set in the options screen?
Its my username "tim nl"
AndroidXP
3rd October 2009, 14:34
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.
Fire_optikz001
3rd October 2009, 17:18
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 :
CASE "!pm":
$idxSpace = indexOf( $argv, " ");
$toUser = subStr( $argv,0,$idxSpace );
$argv = trim( subStr( $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
Krayy
3rd October 2009, 20:36
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.
Fire_optikz001
16th October 2009, 03:10
i know this is a lil late but...
for your !pm command do
CASE "!pm":
IF( $argv != "" ) THEN
$idxSpace = indexOf( $argv, " ");
IF( $idxSpace != -1 ) THEN
$toUser = subStr( $argv,0,$idxSpace );
$argv = trim( subStr( $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" :)
Bass-Driver
22nd October 2009, 19:16
Krayy
when do u release the !pm code??
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.