A Question - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: A Question (
/showthread.php?tid=66711)
A Question -
notec100 - 23.02.2009
Hi I would like to know how to create a /r command for a fast reply for Pms. The way it would work is like this:
player1(senderid): hi!
player2(recieverid): *types* /r (message) and the last person who sent a pm to this player will receive it.
sort of a shortcut from /pm 1 everytime so you recieve a message and you can type /r to make things faster and the last sender to send /pm message to the player would recive the /r message.
Sorry if it doesn't make a whole lot of sense but I am lost at it too adn that is why I come to you for help! Thanks in advance!
Re: A Question -
pspleo - 23.02.2009
I would use OnPlayerReciwvedPrivateMessage (or some callback like that) and save the senderid somewhere. Then when player types /r, senderid (from the saved one) is automatically inserted.
Leopard
Re: A Question -
notec100 - 23.02.2009
Quote:
|
Originally Posted by [K4L
Leopard ]
I would use OnPlayerReciwvedPrivateMessage (or some callback like that) and save the senderid somewhere. Then when player types /r, senderid (from the saved one) is automatically inserted.
Leopard
|
Thank you but to be honest I am not sure how to set it up any examples? Thank you!
Re: A Question -
Sandra18[NL] - 23.02.2009
//Top of script:
Код:
new LastSender[MAX_PLAYERS] = -1;
//OnPlayerPrivmsg
Код:
public OnPlayerPrivmsg(playerid, recieverid, text[])
{
LastSender[recieverid] = playerid;
return 1;
}
//OnPlayerConnect
Код:
public OnPlayerConnect(playerid)
{
LastSender[playerid] = -1;
return 1;
}
//OnPlayerCommandText:
Код:
if(strcmp(cmtext, "/r", true, 2)==0)
{
if(!strlen(cmdtext[3]) return SendClientMessage(playerid, 0xFF0000AA, "Use: /r [message]");
if(LastSender[playerid] == -1)
{
SendClientMessage(playerid, 0xFF0000AA, "No PM recieved yet! No one to reply to!");
return 1;
}
new str[128], pName[MAX_PLAYER_NAME];
GetPlayerName(LastSender[playerid], pName, MAX_PLAYER_NAME);
format(str, 128, "PM from %s: %s", pName, cmdtext[3]");
SendClientMessage(LastSender[playerid], 0xFFE100FF, str);
SendClientMessage(playerid, 0xFFE100FF, "PM send");
return 1;
}
Not tested tough
Re: A Question -
Joe Staff - 24.02.2009
Use the proper color: 0xFFE100FF
Re: A Question -
Sandra18[NL] - 24.02.2009
Quote:
|
Originally Posted by SilentHuntR
Use the proper color: 0xFFE100FF
|
YEah, i didn't know that colorcode :P