PM command help
#1

Hello,I have a gamemode which has the PM command made as a dialog,and I want you to help me to make it all work in the chat(F6) not in a dialog,here is the function:
Код HTML:
function OnPMReceived(playerid, Receiver, text[])
{
    new Str[1000], Str2[1000], Str3[200], Str4[129];
	//--------------------------------------------------------------------------
	format(Str4, sizeof(Str4), "*** PM: %s To %s: %s ***", PlayerName(playerid), PlayerName(Receiver), text);
	//--------------------------------------------------------------------------
	if(ServerInfo[ReadPMs] == 1) MessageToAdmins(COLOR_GREY, Str4);
	//--------------------------------------------------------------------------
	PlayerInfo[Receiver][PMID] = playerid;
	//--------------------------------------------------------------------------
    format(Str2, sizeof(Str2), "{00FF00}Hi, {FF0000}%s{00FF00}!\n", PlayerName(Receiver)), strcat(Str, Str2, sizeof(Str));
	format(Str2, sizeof(Str2), "{FF0000}%s {00FF00}sent you a {00BBF6}Personal Message{00FF00}:\n", PlayerName(playerid)), strcat(Str, Str2, sizeof(Str));
	format(Str2, sizeof(Str2), "{FFCC00}%s", text), strcat(Str, Str2, sizeof(Str));
	//--------------------------------------------------------------------------
	format(Str2, sizeof(Str2), "{AFAFAF}Send a Message to {FF0000}%s", PlayerName(playerid)), strcat(Str3, Str2, sizeof(Str3));
	//--------------------------------------------------------------------------
	return ShowPlayerDialog(Receiver, DIALOG_PM, DIALOG_STYLE_INPUT, Str3, Str, "Send", "Close");
and here is the command:
Код HTML:
}
CMD:pm(playerid,params[])
{
    new Str[129], Str2[128], Str3[129];
	//--------------------------------------------------------------------------
	if(sscanf(params, "u", PlayerInfo[playerid][PMID])) return SendUsage(playerid, "/PM [PlayerID]");
	//--------------------------------------------------------------------------
	if(IsPlayerConnected(PlayerInfo[playerid][PMID]) && PlayerInfo[playerid][PMID] != INVALID_PLAYER_ID)
	{
	    //----------------------------------------------------------------------
		if(PlayerInfo[playerid][PMID] == playerid) return
		SendError(playerid, "You cannot PM yourself!");
		//----------------------------------------------------------------------
		if(PlayerInfo[playerid][Muted] == 1) return Announce(playerid, "~w~~h~You are ~r~~h~muted~w~~h~!", 3000, 4), false;
	    //----------------------------------------------------------------------
		if(PlayerInfo[PlayerInfo[playerid][PMID]][Ignore_PM] == 1 && PlayerInfo[playerid][Level] <= 3) return
  		SendError(playerid, "This player have /Ignore PM On!");
	    //----------------------------------------------------------------------
        format(Str2, sizeof(Str2), "{00FF00}Hi, {FF0000}%s{00FF00}!\n", PlayerName(playerid));
		strcat(Str, Str2, sizeof(Str));
		format(Str2, sizeof(Str2), "{00FF00}Please type before the message you want to send to {00BBF6}%s{00FF00}!", PlayerName(PlayerInfo[playerid][PMID]));
		strcat(Str, Str2, sizeof(Str));
		//------------------------------------------------------------------
		format(Str2, sizeof(Str2), "{AFAFAF}Send a Private Message to {FF0000}%s", PlayerName(PlayerInfo[playerid][PMID]));
		strcat(Str3, Str2, sizeof(Str3));
	 	//----------------------------------------------------------------------
 		return ShowPlayerDialog(playerid, DIALOG_PM, DIALOG_STYLE_INPUT, Str3, Str, "Send", "Close");
	}
	else return SendError2(playerid, "Player not connected!", "Jucatorul nu este conectat!");
}
Reply
#2

Sorry! I thought it was a different thread, my bad!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)