Jump to content

Cerere tutorial comanda PM fara dialog


lordhell12

Recommended Posts

Salutare,comanda PM pe care o am eu in gamemode este toata un dialog,cand trimiti si cand primesti.Vreau sa ma ajutati sa o fac sa se execute in chat nu intr-un dialog.

Aceasta este functia:

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");

iar aceasta este comanda:

}
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!");
}

 

Edited by lordhell12
Link to comment
Share on other sites

Salutare,comanda PM pe care o am eu in gamemode este toata un dialog,cand trimiti si cand primesti.Vreau sa ma ajutati sa o fac sa se execute in chat nu intr-un dialog.

Aceasta este functia:

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");

iar aceasta este comanda:

}
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!");
}

 

omule... nu e atat de greu... trebuie doar sa inlocuiesti showplayerdialog  cu sendclientmessage...

Link to comment
Share on other sites

omule... nu e atat de greu... trebuie doar sa inlocuiesti showplayerdialog  cu sendclientmessage...

return ShowPlayerDialog(playerid, DIALOG_PM, DIALOG_STYLE_INPUT, Str3, Str, "Send", "Close");

Aici ce trebuie scris?

Eu am scris SendClientMessage(playerid, text); si mi-a zis ca nu am definit text,cand il definesc imi pica pawno,adica numai raspunde programul.

Link to comment
Share on other sites

:|

SendClientMessage(playerid,culoarea,str);

Acum imi apare mesajul acesta in joc,iar jucatorul nu imi primeste mesajul pe care eu il trimit:

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));

 

Edited by lordhell12
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.