SA-MP Forums Archive
/pm /r +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: /pm /r +REP (/showthread.php?tid=332713)



/pm /r +REP - TheMightyEddy - 09.04.2012

Is there a possible way where there's a simple PM system that is like this:

/pm john OR /pm 0

PM From Test (1): Hello John... This is a test message

Then John does /r (his message)

PM To Test: This is a simple /r message.

I also want it to be in yellow. Can anyone please help me? I don't want the PM to pop up. I just want it in the chat box. Please help? +REP


Re: /pm /r +REP - Reklez - 09.04.2012

stop being lazy learn how to script.

CODE:

pawn Код:
#define YELLOW 0xFFFF00FF

COMMAND:pm(playerid, params[])
{
    new string[128], pname[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME], id, message[92];
    if(sscanf(params, "us[92]", id, message)) return SendClientMessage(playerid, -1, "USAGE: /pm [playerid] [text]");
    GetPlayerName(playerid, pname, sizeof(pname));
    GetPlayerName(id, name, sizeof(name));
    PlayerPlaySound(id, 1085, 0.0, 0.0, 0.0);
    format(string, sizeof(string), "PM Sent to %s(%d): %s", name, id, message);
    SendClientMessage(playerid, COLOR_YELLOW, string);  
    format(string, sizeof(string), "PM From %s(%d): %s", pname, playerid, message);
    SendClientMessage(id, COLOR_YELLOW, string);
    return 1;
}



Re: /pm /r +REP - TheMightyEddy - 09.04.2012

Thank you but when I put invalid ID, it automatically PM's 65535. How can I make it so when I PM an invalid player or ID, it will show "Invalid Player Name or ID!". And also how do I do the /r(eply) (message)?


Re: /pm /r +REP - Reklez - 09.04.2012

pawn Код:
if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "Invalid Player ID or not connected!");



Re: /pm /r +REP - TheMightyEddy - 09.04.2012

Thanks And also how do I do the /r(eply) (message)?


Re: /pm /r +REP - Reklez - 09.04.2012

pawn Код:
new PMCheck[MAX_PLAYERS];

COMMAND:pm(playerid, params[])
{
    new string[128], pname[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME], id, message[92];
    if(sscanf(params, "us[92]", id, message)) return SendClientMessage(playerid, -1, "USAGE: /pm [playerid] [text]");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "Invalid Player ID or not connected!");
    GetPlayerName(playerid, pname, sizeof(pname));
    GetPlayerName(id, name, sizeof(name));
    if(PMCheck[id]) return SendClientMessage(playerid, -1, "Use (/r) according to PM, you have last PM MSG to this player!");
    PMCheck[id]++;
    PlayerPlaySound(id, 1085, 0.0, 0.0, 0.0);
    format(string, sizeof(string), "PM Sent to %s(%d): %s", name, id, message);
    SendClientMessage(playerid, COLOR_YELLOW, string);
    format(string, sizeof(string), "PM From %s(%d): %s", pname, playerid, message);
    SendClientMessage(id, COLOR_YELLOW, string);
    return 1;
}

COMMAND:r(playerid, params[])
{
    new string[128], pname[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME], id, message[92];
    if(sscanf(params, "us[92]", id, message)) return SendClientMessage(playerid, -1, "USAGE: /r [playerid] [text]");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "Invalid Player ID or not connected!");
    GetPlayerName(playerid, pname, sizeof(pname));
    GetPlayerName(id, name, sizeof(name));
    if(!PMCheck[id]) return SendClientMessage(playerid, -1, "You do not have last PM MSG to this player according to PM!");
    PlayerPlaySound(id, 1085, 0.0, 0.0, 0.0);
    format(string, sizeof(string), "You reply %s(%d)'s last PM: %s", name, id, message);
    SendClientMessage(playerid, COLOR_YELLOW, string);
    format(string, sizeof(string), "PM From %s(%d): %s", pname, playerid, message);
    SendClientMessage(id, COLOR_YELLOW, string);
    return 1;
}



Re: /pm /r +REP - Shetch - 09.04.2012

I'l tell you how to do it, i won't actually script it cuz i'm lazy like that.

So, you make a new variable like
new playerid2[MAX_PLAYERS];

once a player PMs you, it will save his id.
so once john types /pm mike, you will do playerid2[mike] = john;

/r would be the same as the /pm command only without the parameter for the id because the ID will be the playerid2[mike].

Hope you get it.


Re: /pm /r +REP - TheMightyEddy - 09.04.2012

Okay well for this,

pawn Код:
COMMAND:r(playerid, params[])
{
    new string[128], pname[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME], id, message[92];
    if(sscanf(params, "us[92]", id, message)) return SendClientMessage(playerid, -1, "USAGE: /r [playerid] [text]");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "Invalid Player ID or not connected!");
    GetPlayerName(playerid, pname, sizeof(pname));
    GetPlayerName(id, name, sizeof(name));
    if(!PMCheck[id]) return SendClientMessage(playerid, -1, "You do not have last PM MSG to this player according to PM!");
    PlayerPlaySound(id, 1085, 0.0, 0.0, 0.0);
    format(string, sizeof(string), "You reply %s(%d)'s last PM: %s", name, id, message);
    SendClientMessage(playerid, COLOR_YELLOW, string);
    format(string, sizeof(string), "PM From %s(%d): %s", pname, playerid, message);
    SendClientMessage(id, COLOR_YELLOW, string);
    return 1;
}
it wants me to put /r [id] [message]. How can I just put /r [message] because I'm replying to my last pm?

Example:

PM From John: Hello
PM From Test: Hello

I type /r hello how are you

and the message goes to Test because test the last PM i receive. How can i do that?


Re: /pm /r +REP - Reklez - 09.04.2012

Do what Shetch say.


Re: /pm /r +REP - TheMightyEddy - 09.04.2012

It's confusing. I don't really get it. Please help?