SA-MP Forums Archive
How to log 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: How to log PM (/showthread.php?tid=124997)



How to log PM - whitedragon - 01.02.2010

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




Re: How to log PM - mansonh - 01.02.2010

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



Re: How to log PM - ray187 - 01.02.2010

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


Re: How to log PM - mansonh - 01.02.2010

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


Re: How to log PM - whitedragon - 02.02.2010

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