PM command
#1

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;
}
Reply
#2

What do you mean "last PM they've got" ?
Reply
#3

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

Store it in a PVarString?
Reply
#5

Quote:
Originally Posted by Anthony ©
Посмотреть сообщение
Store it in a PVarString?
how? could u show an example
Reply
#6

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;
}
Reply
#7

Yeah but that'd mean all can view that lastpm[128]?
Reply
#8

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

so how do I continue then?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)