PM the last User you pmed -
Blackazur - 16.07.2013
Hello, how to make an command to pm the last user you write with it? I dont know how.
Re: PM the last User you pmed -
PaulDinam - 16.07.2013
Use a PVar with the last ID you pmed and then make a command, /reply or something.
Respuesta: PM the last User you pmed -
Xabi - 16.07.2013
Store the last id you sent a PM into a variable, and write a command like /reply that sends the private message to the id stored in that variable.
AW: PM the last User you pmed -
Blackazur - 16.07.2013
My variable is that:
Код:
if(pInfo[targetid][pPM]
{
Can you give me an simple example, please?
Re: PM the last User you pmed -
Konstantinos - 16.07.2013
pawn Код:
// Global variable
new
Last_PM_From[ MAX_PLAYERS ]
;
// OnPlayerConnect
Last_PM_From[ playerid ] = -1;
// Command
if( Last_PM_From[ playerid ] == -1 ) return SendClientMessage( playerid, -1, "You did not recieve any PM to reply back!" );
if( Last_PM_From[ playerid ] == INVALID_PLAYER_ID ) return SendClientMessage( playerid, -1, "That player is not online anymore!" );
// code...
SendClientMessage( ast_PM_From[ playerid ], color_here, message_here );
Oh and when you recieve a message, assign to the variable the id of the player.
AW: PM the last User you pmed -
Blackazur - 16.07.2013
thanks but how to assign the variable of the id of the player?
Re: PM the last User you pmed -
Konstantinos - 16.07.2013
pawn Код:
CMD:pm( playerid, params[ ] )
{
new
id,
msg[ 64 ]
;
if( sscanf( params, "rs[64]", id, msg ) ) return SendClientMessage( playerid, -1, "Usage: /pm <ID/Part Of Name> <message>" );
if( id == INVALID_PLAYER_ID ) return SendClientMessage( playerid, -1, "That player is not online" );
new
pm_msg[ 128 ],
name1[ MAX_PLAYER_NAME ],
name2[ MAX_PLAYER_NAME ]
;
GetPlayerName( playerid, name1, MAX_PLAYER_NAME );
GetPlayerName( id, name2, MAX_PLAYER_NAME );
format( pm_msg, sizeof( pm_msg ), "PM From %s (%d): %s", name1, playerid, msg );
SendClientMessage( id, -1, pm_msg );
format( pm_msg, sizeof( pm_msg ), "PM To %s (%d): %s", name2, id, msg );
SendClientMessage( playerid, -1, pm_msg );
Last_PM_From[ id ] = playerid;
return 1;
}
AW: PM the last User you pmed -
Blackazur - 16.07.2013
well, my command is so:
Код:
CMD:pm(playerid,params[])
{
new targetid,message[256],pmstring[256];
if(pInfo[playerid][IsPlayerMuted] == 1) {
SendClientMessage(playerid,-1,""chat""COL_ADMINCMD" {8DD7FF}You Are Muted!"); return 1; }
if(sscanf(params,"us[256]", targetid, message)) return SendClientMessage(playerid,-1,""chat" /pm [playerid] [message]");
if(pInfo[playerid][pLogged] == 1)
{
if(pInfo[targetid][pPM] == 0)
{
format(pmstring,sizeof(pmstring),""chat""COL_RED" {FFF1AF}[PM][%s][%d]: %s",PlayerName(playerid),playerid,message);
SendClientMessage(targetid,-1,pmstring);
format(pmstring,sizeof(pmstring),""chat""COL_RED" {CFCFCF}[PM Sent][%s][%d]: %s",PlayerName(playerid),playerid,message);
SendClientMessage(playerid,-1,pmstring);
}
else {
SendClientMessage(playerid,-1,""chat""COL_YELLOW" This player dont accepting private messages [PM's].");
}
}
return 1;
}
how can i make that with my variable "pPM"?
Re: PM the last User you pmed -
Konstantinos - 16.07.2013
pPM is for toggling the PMs, right? So, you cannot use it for the last id too.
Make a variable to store the last id and use it like I showed you on my example:
pawn Код:
Last_PM_From[ targetid ] = playerid;
// Change "Last_PM_From[ targetid ]" to your variable's name
AW: PM the last User you pmed -
Blackazur - 16.07.2013
Should i make that
Код:
Last_PM_From[ targetid ] = playerid;
in the normal pm command or in the /r command to answer the last user which i pmed?