SA-MP Forums Archive
[Solved] Noob question about PM - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Solved] Noob question about PM (/showthread.php?tid=95347)



[Solved] Noob question about PM - ded - 03.09.2009

Hi, I have quickly put this command together last night (3 am -.-) and it works fine except that it doesn't show the message ... what am I doing wrong? I'm still pretty new at coding pawno so I don't really know.

Any help appreciated.

Код:
dcmd_pm(playerid, params[]) {
	if(PlayerInfo[playerid][LoggedIn] == 1) {
		new tmp[256], tmp2[256], str[128], str2[128], Index;	tmp = strtok(params,Index), tmp2 = strtok(params,Index);
    new player1, message;
		if(!strlen(tmp)||!strlen(tmp2)) return SendClientMessage(playerid,red,"USAGE: /pm [id] [message]");
		
		player1 = strval(tmp);
		message = strval(tmp2);
		
	  #if defined IRC_ON_PLZ
    new str3[128];//,reciever[MAX_PLAYER_NAME];
	  //GetPlayerName(playerid, str, sizeof(str)); GetPlayerName(recieverid, reciever, sizeof(reciever));
	  format(str3, sizeof(str3), "7*** PM: %s To %s: %s", PlayerName2(playerid), PlayerName2(player1), message);
	  ircSay(EchoConnection, CrewChan, str3);
	  #endif

	  if(ServerInfo[ReadPMs] == 1 && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel])
	  {
  	  new strr[128];//,recievername[MAX_PLAYER_NAME];
		  //GetPlayerName(playerid, string, sizeof(string)); GetPlayerName(recieverid, recievername, sizeof(recievername));
		  format(strr, sizeof(strr), "Admin Message: *** PM: %s To %s: %s", PlayerName2(playerid), PlayerName2(player1), message);
		  for (new a = 0; a < MAX_PLAYERS; a++) if (IsPlayerConnected(a) && (PlayerInfo[a][Level] >= ServerInfo[MaxAdminLevel]) && a != playerid)
		  SendClientMessage(a, MAD_WHITE, strr);
		  return 1;
	  }

 	  if(PlayerInfo[playerid][Muted] == 1)
	  {
		  new string[128];
 		  PlayerInfo[playerid][MuteWarnings]++;
		  if(PlayerInfo[playerid][MuteWarnings] < ServerInfo[MaxMuteWarnings]) {
			  format(string, sizeof(string),"WARNING: You are muted, if you continue to type you will be kicked (Warning: %d/%d)", PlayerInfo[playerid][MuteWarnings], ServerInfo[MaxMuteWarnings] );
			  SendClientMessage(playerid,red,string);
		  } else {
			  SendClientMessage(playerid,red,"You were warned! Now you have been kicked");
			  GetPlayerName(playerid, string, sizeof(string));
			  format(string, sizeof(string),"*** %s was kicked for exceeding mute warnings.", string);
			  SendClientMessageToAll(COLOR_ORANGE,string);
			  SaveToFile("KickLog",string); Kick(playerid);
		  }
		  return 1;
	  }
	  //if(player1 == playerid) return SendClientMessage(playerid, red,"You cannot PM yourself!");
	  if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
		  format(str, sizeof(str),"PM from %s[%d]: %s",PlayerName2(playerid),playerid,message);
		  format(str2, sizeof(str2),"PM sent to %s[%d]: %s",PlayerName2(player1),playerid,message);
			SendClientMessage(player1, DAYTONA_YELLOW, str);
			PlayerPlaySound(player1,1085,0.0,0.0,0.0);
		  SendClientMessage(playerid,DAYTONA_YELLOW,str2);
		} else return SendClientMessage(playerid, red, "Player is not connected!");
	} else return SendClientMessage(playerid, red, "You need to log in to use this command!");
	return 1;
}



Re: Noob question about PM - Redirect Left - 03.09.2009

Check base.pwn in filterscripts for an example to help you.


[SOLVED] Noob question about PM - ded - 03.09.2009

Quote:
Originally Posted by Redirect Left
Check base.pwn in filterscripts for an example to help you.
It's okay, this is solved now.