Guest User

Untitled

a guest
Jul 25th, 2012
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #define PM_INCOMING_COLOR 0xFFFF22AA
  4. #define PM_OUTGOING_COLOR 0xFFCC2299
  5.  
  6. //------------------------------------------------
  7.  
  8. public OnFilterScriptInit()
  9. {
  10. print("\n--Base FS loaded.\n");
  11. return 1;
  12. }
  13.  
  14.  
  15. //------------------------------------------------
  16.  
  17. public OnPlayerCommandText(playerid, cmdtext[])
  18. {
  19. new cmd[256];
  20. new tmp[256];
  21. new Message[256];
  22. new gMessage[256];
  23. new pName[MAX_PLAYER_NAME+1];
  24. new iName[MAX_PLAYER_NAME+1];
  25. new idx;
  26.  
  27. cmd = strtok(cmdtext, idx);
  28.  
  29. // PM Command
  30. if(strcmp("/pm", cmd, true) == 0) {
  31. tmp = strtok(cmdtext,idx);
  32.  
  33. if(!strlen(tmp) || strlen(tmp) > 5) {
  34. SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: /pm (id) (message)");
  35. return 1;
  36. }
  37.  
  38. new id = strval(tmp);
  39. gMessage = strrest(cmdtext,idx);
  40.  
  41. if(!strlen(gMessage)) {
  42. SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: /pm (id) (message)");
  43. return 1;
  44. }
  45.  
  46. if(!IsPlayerConnected(id)) {
  47. SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"/pm : Bad player ID");
  48. return 1;
  49. }
  50.  
  51. if(playerid != id) {
  52. GetPlayerName(id,iName,sizeof(iName));
  53. GetPlayerName(playerid,pName,sizeof(pName));
  54. format(Message,sizeof(Message),">> %s(%d): %s",iName,id,gMessage);
  55. SendClientMessage(playerid,PM_OUTGOING_COLOR,Message);
  56. format(Message,sizeof(Message),"** %s(%d): %s",pName,playerid,gMessage);
  57. SendClientMessage(id,PM_INCOMING_COLOR,Message);
  58. PlayerPlaySound(id,1085,0.0,0.0,0.0);
  59.  
  60. printf("PM: %s",Message);
  61.  
  62. }
  63. else {
  64. SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"You cannot PM yourself");
  65. }
  66. return 1;
  67. }
  68.  
  69. return 0;
  70. }
Advertisement
Add Comment
Please, Sign In to add comment