[Solved] Noob question about PM
#1

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)