PM command -
JEkvall95 - 26.10.2012
I have a simple PM command but how do I make a command which allows people to see the lastpm they've got?
pawn Код:
CMD:pm(playerid, params[]) {
new id, message[1024];
if(sscanf(params,"ds[1024]",id,message))return SendClientMessage(playerid, COLOR_RED, "USAGE: /pm <playerid> <message>");
if (!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "ERROR: Player is not connected.");
if(playerid != id) {
new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
new ReturnName[MAX_PLAYER_NAME];
GetPlayerName(id, ReturnName, sizeof(ReturnName));
format(szString,sizeof(szString), ">> PM To %s (ID:%d): %s", ReturnName, id, message);
SendClientMessage(playerid, 0xFFCC2299, szString);
format(szString,sizeof(szString),"<< PM From %s (ID:%d): %s",PlayerName, playerid, message);
SendClientMessage(id, 0xFFFF22AA, szString);
PlayerPlaySound(id, 1085, 0.0, 0.0, 0.0);
format(szString, sizeof(szString), "5*** [PM] From %s (ID:%d) To %s (ID:%d): %s",PlayerName,playerid,ReturnName,id,message);
IRC_GroupSay(gGroupID, IRC_CHANNEL2, szString);
}
else {
SendClientMessage(playerid, COLOR_RED, "ERROR: You cannot PM yourself");
}
return 1;
}
Re: PM command -
Skillet` - 26.10.2012
What do you mean "last PM they've got" ?
Re: PM command -
JEkvall95 - 26.10.2012
Quote:
Originally Posted by Skillet`
What do you mean "last PM they've got" ?
|
like if you type /lastpm you will see the last pm the person have got
Re: PM command -
Anthony © - 26.10.2012
Store it in a PVarString?
Re: PM command -
JEkvall95 - 26.10.2012
Quote:
Originally Posted by Anthony ©
Store it in a PVarString?
|
how? could u show an example
Re: PM command -
Skillet` - 26.10.2012
Simply,store it in array.
pawn Код:
new lastpm[MAX_PLAYERS][128];
CMD:pm(playerid, params[]) {
new id, message[1024];
if(sscanf(params,"ds[1024]",id,message))return SendClientMessage(playerid, COLOR_RED, "USAGE: /pm <playerid> <message>");
if (!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "ERROR: Player is not connected.");
if(playerid != id) {
new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
new ReturnName[MAX_PLAYER_NAME];
GetPlayerName(id, ReturnName, sizeof(ReturnName));
format(szString,sizeof(szString), ">> PM To %s (ID:%d): %s", ReturnName, id, message);
SendClientMessage(playerid, 0xFFCC2299, szString);
format(szString,sizeof(szString),"<< PM From %s (ID:%d): %s",PlayerName, playerid, message);
SendClientMessage(id, 0xFFFF22AA, szString);
PlayerPlaySound(id, 1085, 0.0, 0.0, 0.0);
format(szString, sizeof(szString), "5*** [PM] From %s (ID:%d) To %s (ID:%d): %s",PlayerName,playerid,ReturnName,id,message);
IRC_GroupSay(gGroupID, IRC_CHANNEL2, szString);
lastpm[playerid] = message;
}
else {
SendClientMessage(playerid, COLOR_RED, "ERROR: You cannot PM yourself");
}
return 1;
}
Re: PM command -
Anthony © - 26.10.2012
Yeah but that'd mean all can view that
lastpm[128]?
Re: PM command -
♣Frosty♣ - 26.10.2012
Quote:
Originally Posted by Anthony ©
Yeah but that'd mean all can view that lastpm[128]?
|
It's a string for the command to make it work and to have more msg
Re: PM command -
JEkvall95 - 27.10.2012
so how do I continue then?