Problem with /reply command
#1

I tried to create command with which player could reply on last pm sent to him.I did, but when player replies, target player doesnt see any text

pawn Код:
new cmd[512], idx;
    cmd = strtok(cmdtext, idx);
    if(strcmp(cmd, "/reply", true) == 0)
    {
    new tmp[512];
    tmp = strtok(cmdtext, idx);
    if(strlen(tmp) == 0) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /reply "#COL_RED"[message]");
    player = replyid[playerid];
    GetPlayerName(player, incriminato, sizeof(incriminato)); GetPlayerName(playerid, adminname, sizeof(adminname));
    format(string, sizeof(string), "{ff0000}<<< {00ff00}PM from {ffcc00}%s (ID:%i): {ffffff}%s >>>", adminname,playerid, strval(tmp)), SendClientMessage(player,COLOR_LIGHTGREEN,string);
    format(string, sizeof(string), "<<< PM for %s (ID:%i): %s >>>",incriminato, player, strval(tmp)),SendClientMessage(playerid,COLOR_LIGHTGREEN,string);
    return 1;
    }
Players see only: "<<< PM from examplename (ID:exampleid): >>>"
Reply
#2

I already ask you if you need help with PM Reply you said no now you need help...
You need to store the playerid to a variable or a PVarInt
Reply
#3

Quote:
Originally Posted by Romel
Посмотреть сообщение
I already ask you if you need help with PM Reply you said no now you need help...
You need to store the playerid to a variable or a PVarInt
It is /reply, id of a player to reply is stored in "replyid" when player resieves pm, and when player types /reply [message] message sends to this player.

For example:

Player A: /pm 1 Hi friend!
Player B: /reply Hi! How are you?
Player A: /reply I am Fine, Thanks!
Reply
#4

pawn Код:
//Top of script
new LastReply[MAX_PLAYERS];

//PM command
CMD:PM(playerid, params[])
{
  new id, message[120];
  if(sscanf(params, "is[120]", id, message)) return SendClientMessage(playerid, -1, "Usage: /pm ID message");
  SendClientMessage(id, -1, message);
  SendClientMessage(playerid, -1, "message sent");
  LastReply[id] = playerid;
  return 1;
}

CMD:r(playerid, params[])
{
  SendClientMessage(LastReply[playerid], -1, params);
  SendClientMessage(playerid, -1, "message sent");
  return 1;
}
You basically need that, I am unsure if it has bugs as I haven;'t tested it, but you should get the idea.
Reply
#5

i cant use zcmd with usual commands, because i will have "unnknown command"
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)