A Question
#1

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!
Reply
#2

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
Reply
#3

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!
Reply
#4

//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
Reply
#5

Use the proper color: 0xFFE100FF
Reply
#6

Quote:
Originally Posted by SilentHuntR
Use the proper color: 0xFFE100FF
YEah, i didn't know that colorcode :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)