SA-MP Forums Archive
How To Make /r (Reply PM Command) ZCMD +rep - 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)
+--- Thread: How To Make /r (Reply PM Command) ZCMD +rep (/showthread.php?tid=589388)



How To Make /r (Reply PM Command) ZCMD +rep - TitanEVG - 18.09.2015

old thread.


Re: How To Make /r (Reply PM Command) ZCMD +rep - Sellize - 18.09.2015

Save the ID of the last PM sender and set it to send a PM to that player when using /r


Re: How To Make /r (Reply PM Command) ZCMD +rep - TitanEVG - 18.09.2015

Quote:
Originally Posted by Sellize
Посмотреть сообщение
Save the ID of the last PM sender and set it to send a PM to that player when using /r
I'm new in scripting so I want to learn how to make it.


Re: How To Make /r (Reply PM Command) ZCMD +rep - [XST]O_x - 18.09.2015

pawn Код:
new lastSender[MAX_PLAYERS] = {INVALID_PLAYER_ID, ...};

CMD:pm(playerid, params[])
{
    //Add this at the end:
    lastSender[id] = playerid;
    return 1;
}

CMD:r(playerid, params[])
{
    new send_to = lastSender[playerid];
   
    //Now just send the pm to 'send_to'
    return 1;
}
Also make sure you put INVALID_PLAYER_ID in lastSender in OnPlayerConnect so it won't pass the id to a new player who joins