Advertisement
slenderm48

PM

Aug 1st, 2015
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.39 KB | None | 0 0
  1. #define FILTERSCRIPT
  2.  
  3. #include <a_samp>
  4. #include <zcmd>
  5. #include <sscanf2>
  6. #include <YSI\y_ini>
  7.  
  8. #define COLOR_RED 0xFF0000FF
  9. #define COLOR_YELLOW 0xFFFF00AA
  10. #define COLOR_ORANGE 0xFF9900AA
  11.  
  12. enum PMInfo
  13. {
  14. LastPM,
  15. NoPM,
  16. };
  17. new pInfo[MAX_PLAYERS][PMInfo];
  18.  
  19.  
  20. #if defined FILTERSCRIPT
  21.  
  22. public OnFilterScriptInit()
  23. {
  24. print("\n**************************************");
  25. print("* PM System Made By OngTung *");
  26. print("* Don't Remove My Credits! *");
  27. print("* [ LOADED ] *");
  28. print("**************************************\n");
  29. return 1;
  30. }
  31.  
  32. public OnFilterScriptExit()
  33. {
  34. return 1;
  35. }
  36.  
  37. #endif
  38.  
  39. CMD:pm(playerid, params[])
  40. {
  41. new pName[MAX_PLAYER_NAME], string[250], String[250],target, tName[MAX_PLAYER_NAME];
  42. if(sscanf(params, "us[50]",target,params)) return SendClientMessage(playerid, -1, "{FF0000}Su dung : {FF0000}/pm [ID][MESSAGE]");
  43. if(target == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "ERROR : {FF0000}Sai ID nguoi choi");
  44. if(target == playerid) return SendClientMessage(playerid, 0, "ERROR : {FF0000}Ban khong the PM cho rieng minh!");
  45. if(pInfo[target][NoPM]) return SendClientMessage(playerid, -1, "ERROR : {FF0000}Nguoi choi da tat che do PM!");
  46. GetPlayerName(playerid, pName, sizeof(pName));
  47. GetPlayerName(target, tName, sizeof(tName));
  48. format(string ,sizeof(string), "{C0C0C0}|- PM tu %s : %s -|", pName, params);
  49. SendClientMessage(target,0, string);
  50. format(String, sizeof(String), "{C0C0C0}|- PM gui den %s -|", tName);
  51. SendClientMessage(playerid, 0, String);
  52. return 1;
  53. }
  54.  
  55. CMD:nopm(playerid, params[])
  56. {
  57. if(pInfo[playerid][NoPM] == 0)
  58. {
  59. pInfo[playerid][NoPM] = 1;
  60. SendClientMessage(playerid, -1, "{FF0000}INFO : {FFFFFF}Ban da bat che do PM cua ban!");
  61. }
  62. else
  63. {
  64. pInfo[playerid][NoPM] = 0;
  65. SendClientMessage(playerid, -1, "{FF0000}INFO : {FFFFFF}Ban da tat che do PM cua ban!");
  66. }
  67. return 1;
  68. }
  69.  
  70. CMD:reply(playerid, params[])
  71. {
  72. new pName[MAX_PLAYER_NAME], string[128],target, tName[MAX_PLAYER_NAME];
  73. if(sscanf(params, "s", params)) return SendClientMessage(playerid, COLOR_RED, "Su dung: /reply [MESSAGE]");
  74. new pID = pInfo[playerid][LastPM];
  75. if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, COLOR_RED, "ERROR : Nguoi choi khong co online.");
  76. if(pID == playerid) return SendClientMessage(playerid, COLOR_RED, "ERROR : Ban khong the PM cho rieng minh.");
  77. if(pInfo[pID][NoPM] == 1) return SendClientMessage(playerid, COLOR_RED, "ERROR : Nguoi choi da tat che do PM, ban khong the PM hay cho nguoi choi dap lai!");
  78. GetPlayerName(playerid, pName, sizeof(pName));
  79. GetPlayerName(target, tName, sizeof(tName));
  80. format(string, sizeof(string), "{C0C0C0}|- PM gui den %s -|", tName, params);
  81. SendClientMessage(playerid, COLOR_YELLOW, string);
  82. format(string, sizeof(string), "{C0C0C0}|- PM tu %s : %s -|", pName, params);
  83. SendClientMessage(pID, COLOR_YELLOW, string);
  84. pInfo[pID][LastPM] = playerid;
  85. return 1;
  86. }
  87.  
  88. CMD:r(playerid, params[])
  89. {
  90. new pName[MAX_PLAYER_NAME], string[128],target, tName[MAX_PLAYER_NAME];
  91. if(sscanf(params, "s", params)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /reply [MESSAGE]");
  92. new pID = pInfo[playerid][LastPM];
  93. if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, COLOR_RED, "ERROR : Nguoi choi khong co online.");
  94. if(pID == playerid) return SendClientMessage(playerid, COLOR_RED, "ERROR : Ban khong the PM cho rieng minh.");
  95. if(pInfo[pID][NoPM] == 1) return SendClientMessage(playerid, COLOR_RED, "ERROR : Nguoi choi da tat che do PM, ban khong the PM hay cho nguoi choi dap lai!");
  96. GetPlayerName(playerid, pName, sizeof(pName));
  97. GetPlayerName(target, tName, sizeof(tName));
  98. format(string, sizeof(string), "{C0C0C0}|- PM Sent To %s -|", tName, params);
  99. SendClientMessage(playerid, COLOR_YELLOW, string);
  100. format(string, sizeof(string), "{C0C0C0}|- PM From %s : %s -|", pName, params);
  101. SendClientMessage(pID, COLOR_YELLOW, string);
  102. pInfo[pID][LastPM] = playerid;
  103. return 1;
  104. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement