Privet Message bug
#1

The error:
warning 235: public function lacks forward declaration (symbol "OnPlayerPrivmsg")

The code:

Код:
public OnPlayerPrivmsg(playerid, recieverid, text[])
{
	new string[128];
	if(PMsEnabled[recieverid])
	{
		format(string, sizeof(string), "[PM:] PM from %s(%d): %s", GetPlayerNameEx(playerid),playerid, text);
		SendClientMessage(recieverid,COLOR_MEDIUMBLUE,string);
		format(string, sizeof(string), "[OOCPM:] PM sent to %s(%d): %s", GetPlayerNameEx(recieverid),recieverid, text);
		SendClientMessage(playerid,COLOR_MEDIUMBLUE,string);
		format(string, sizeof(string), "[PM:] PM from %s(%d) to %s(%d): %s", GetPlayerNameEx(playerid),playerid, GetPlayerNameEx(recieverid),recieverid, text);
		PMLog(string);
		for(new i = 0; i < MAX_PLAYERS; i++)
			{
				if(IsPlayerConnected(i))
				{
				  if(PlayerInfo[i][pSeepm] == 1)
				  {
              format(string, sizeof(string), "[PM:] PM from %s(%d) to %s(%d): %s", GetPlayerNameEx(playerid),playerid, GetPlayerNameEx(recieverid),recieverid, text);
              SendClientMessage(i, COLOR_DBLUE, string);
					}
				}
			}

		return 1;
	}
	else
	{
	  SendClientMessage(playerid,COLOR_LIGHTYELLOW2,"[ERROR:] That user has disabled PM's.");
	}
	return 1;
}
What is the problem here guys?
Reply
#2

It was removed in 0.3, just rename it if you're actually using it.
Reply
#3

does it work?
Reply
#4

up at the top do:

forward OnPlayerPrivmsg(playerid, recieverid, text[]);
Reply
#5

Nothing works.. I think I just need a new /pm command..
Reply
#6

add forward OnPlayerPrivmsg(playerid, recieverid, text[]);

and under OnPlayerCommandText do

pawn Код:
if(!strcmp(cmdtext[1],"pm",true,2))
{
  if(!cmdtext[3]||!cmdtext[4])return SendClientMessage(playerid,0xFF0000FF,"USAGE: /pm [id] [text]");
  new receiverid=strval(cmdtext[4]);
  new begintext=strfind(cmdtext[4]," ")+1;
  if(begintext<1)return SendClientMessage(playerid,0xFF0000FF,"USAGE: /pm [id] [text]");
  if(!IsPlayerConnected(receiverid))return SendClientMessage(playerid,0xFF0000FF,"Invalid Playerid");
  if(!strlen(cmdtext[begintext]))return SendClientMessage(playerid,0xFF0000FF,"USAGE: /pm [id] [text]");
  OnPlayerPrivmsg(playerid,receiverid,cmdtext[begintext]);
  return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)