How to log PM
#1

I want log PM.
put how to do it with
public OnPlayerPrivmsg(playerid, recieverid, text[])

Reply
#2

https://sampwiki.blast.hk/wiki/OnPlayerPrivmsg has been depricated in 0.3.

You have to create a pm system(from same link), then you can insert a printf statement,
pawn Код:
if(!strcmp("/pm", cmdtext, true))
{
  tmp = strtok(cmdtext,idx);
  if(!strlen(tmp)) return SendClientMessage(playerid,0xFF0000FF,"USAGE: /PM (id) (message)");
  new id = strval(tmp);
  gMessage = strrest(cmdtext,idx);
  if(!strlen(gMessage)) return SendClientMessage(playerid,0xFF0000FF,"Usage: /pm (id) (message)");     
  if(!IsPlayerConnected(id)) return SendClientMessage(playerid,0xFF0000FF,"/pm :Invalid ID");  
  GetPlayerName(id,iName,sizeof(iName));
  GetPlayerName(playerid,pName,sizeof(pName));
  format(Message,sizeof(Message),">> %s(%i): %s",iName,id,gMessage);
  SendClientMessage(playerid,0xFFD720FF,Message);
  format(Message,sizeof(Message),"** %s(%i): %s",pName,playerid,gMessage);
  SendClientMessage(id,0xFFD720FF,Message);

//Here it logs to your server output, this us just an example, you can also write to file etc
  printf("%s(%i)->%s(%i): %s", pName, playerid, iName, id, gMessage);

  PlayerPlaySound(id,1085,0.0,0.0,0.0);
  return 1;
}
Or if you look through one of the existing ones you will find examples:
http://forum.sa-mp.com/index.php?topic=74021.0
Reply
#3

You know that your code doesn`t work at all if he`s not using the same GM (edit) as you do?
Reply
#4

Quote:
Originally Posted by ray187
You know that your code doesn`t work at all if he`s not using the same GM (edit) as you do?
The code is from the https://sampwiki.blast.hk/wiki/OnPlayerPrivmsg, its an example of how to log it /facepalm
Reply
#5

why the sound? is in that?
ok but how but it PM.log file?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)