DeeadPool

Pm and whisper system by DeeadPool

Aug 26th, 2016
407
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.51 KB | None | 0 0
  1. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  2. Start Of Script: Pm and Whisper system - DeeadPool©
  3. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
  4.  
  5. #include <a_samp>
  6. #include <zcmd>
  7. #include <sscanf>
  8.  
  9. //Colors
  10. #define COLOR_RED 0xFF0000FF
  11. #define COLOR_YELLOW 0xFFFF00FF
  12. #define COLOR_GREEN 0x00FF00FF
  13. #define COLOR_BLUE 0x0000FFFF
  14. #define COLOR_GREY 0xCCCCCCFF
  15.  
  16.  
  17. //enum
  18. enum PlayerInfo
  19. {
  20. Readpm,
  21. Lastpm,
  22. PM,
  23. PmOff,
  24. Block
  25. }
  26. new PlayerData[MAX_PLAYERS][PlayerInfo];
  27.  
  28. //Stock
  29. stock PlayerName(playerid)
  30. {
  31. new pName[MAX_PLAYER_NAME];
  32. GetPlayerName(playerid, pName, sizeof(pName));
  33. return pName;
  34. }
  35.  
  36. public OnFilterScriptInit()
  37. {
  38. print("\n--------------------------------------");
  39. print(" Pm and whisper filterscript by DeeadPool");
  40. print(" Loaded ");
  41. print("--------------------------------------\n");
  42. return 1;
  43. }
  44.  
  45. public OnFilterScriptExit()
  46. {
  47. print("\n--------------------------------------");
  48. print(" Pm and whisper filterscript by DeeadPool");
  49. print(" Unloaded ");
  50. print("--------------------------------------\n");
  51. return 1;
  52. }
  53.  
  54.  
  55. public OnPlayerConnect(playerid)
  56. {
  57. PlayerData[playerid][Lastpm] = -1;
  58. PlayerData[playerid][PmOff] = 0;
  59. PlayerData[playerid][Readpm] = -1;
  60. PlayerData[playerid][Block] = -1;
  61. return 1;
  62. }
  63.  
  64. public OnPlayerDisconnect(playerid, reason)
  65. {
  66. PlayerData[playerid][Lastpm] = -1;
  67. PlayerData[playerid][PmOff] = 0;
  68. PlayerData[playerid][Readpm] = -1;
  69. PlayerData[playerid][Block] = -1;
  70. return 1;
  71. }
  72.  
  73. /*=====================================================================================================
  74. PM System
  75. =====================================================================================================*/
  76. CMD:pm(playerid, parmas[])
  77. {
  78. new ID,
  79. Message[256],
  80. String[256],
  81. String2[256];
  82. if(sscanf(parmas, "us[256]", ID, Message)) return SendClientMessage(playerid, COLOR_RED, "Usage: /pm [id] [message]");
  83. if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, -1, "Player not connected!");
  84. if(ID == playerid) return SendClientMessage(playerid, COLOR_RED, "You can not PM yourself!");
  85. if(PlayerData[ID][Block] == playerid) return SendClientMessage(playerid, COLOR_RED, "The player has chosen not recieve Pms from you!");
  86. format(String, sizeof(String), "%s [%d] is no more accepting private messages!");
  87. if(PlayerData[ID][PmOff] == 1) return SendClientMessage(playerid, COLOR_YELLOW, String);
  88. if(PlayerData[playerid][PmOff] == 1) return SendClientMessage(playerid, COLOR_RED,"You can not send private message when you have switched off your pms!");
  89. format(String2, sizeof(String2), "PM to %s : %s", PlayerName(ID), Message);
  90. SendClientMessage(playerid, COLOR_YELLOW, String2);
  91. format(String2, sizeof(String2), "PM From %s : %s", PlayerName(playerid), Message);
  92. SendClientMessage(ID, COLOR_YELLOW, String2);
  93. PlayerData[ID][Lastpm] = playerid;
  94. return 1;
  95. }
  96.  
  97. CMD:reply(playerid, parmas[])
  98. {
  99. new Message[256],
  100. String[256],
  101. String2[256];
  102. new ID = PlayerData[playerid][Lastpm];
  103. if(sscanf(parmas, "s[256]", Message)) return SendClientMessage(playerid, COLOR_RED, "Usage: /r(eply) [Message]");
  104. if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, -1, "Player not connected!");
  105. if(ID == playerid) return SendClientMessage(playerid, COLOR_RED, "You can not PM yourself!");
  106. if(PlayerData[ID][Block] == playerid) return SendClientMessage(playerid, COLOR_RED, "The player has chosen not recieve Pms from you!");
  107. if(PlayerData[playerid][Lastpm] == -1) return SendClientMessage(playerid, -1, "You have recieved no PM's till now!");
  108. format(String, sizeof(String), "%s [%d] is no more accepting private messages!");
  109. if(PlayerData[ID][PmOff] == 1) return SendClientMessage(playerid, COLOR_YELLOW, String);
  110. format(String2, sizeof(String2), "PM to %s : %s", PlayerName(ID), Message);
  111. SendClientMessage(playerid, COLOR_YELLOW, String2);
  112. format(String2, sizeof(String2), "PM From %s : %s", PlayerName(playerid), Message);
  113. SendClientMessage(ID, COLOR_YELLOW, String2);
  114. PlayerData[ID][Lastpm] = playerid;
  115. return 1;
  116. }
  117.  
  118. CMD:r(playerid, parmas[]) return cmd_reply(playerid, parmas);
  119.  
  120. CMD:pmon(playerid, parmas[])
  121. {
  122. if(PlayerData[playerid][PmOff] == 0) return SendClientMessage(playerid, COLOR_YELLOW, "You have already enabled your Pms!");
  123. if(PlayerData[playerid][PmOff] == 1)
  124. {
  125. SendClientMessage(playerid, COLOR_YELLOW, "You have enabled your Pms!");
  126. PlayerData[playerid][PmOff] = 0;
  127. }
  128. return 1;
  129. }
  130.  
  131. CMD:pmoff(playerid, parmas[])
  132. {
  133. if(PlayerData[playerid][PmOff] == 1) return SendClientMessage(playerid, COLOR_YELLOW, "You have already disabled your Pms!");
  134. if(PlayerData[playerid][PmOff] == 0)
  135. {
  136. SendClientMessage(playerid, COLOR_YELLOW, "You have disabled your Pms!");
  137. PlayerData[playerid][PmOff] = 1;
  138. }
  139. return 1;
  140. }
  141.  
  142. CMD:block(playerid, parmas[])
  143. {
  144. new ID,
  145. String[128];
  146. if(sscanf(parmas, "u", ID)) return SendClientMessage(playerid, COLOR_RED, "Usage: /block [id]");
  147. if(ID == playerid) return SendClientMessage(playerid, COLOR_RED, "you can not block yourself");
  148. if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, -1, "Player not connected!");
  149. format(String, sizeof(String), "You have blocked %s from sending you PMs", PlayerName(ID));
  150. SendClientMessage(playerid, COLOR_YELLOW, String);
  151.  
  152. PlayerData[playerid][Block] = ID;
  153.  
  154. return 1;
  155. }
  156.  
  157. CMD:unblock(playerid, parmas[])
  158. {
  159. new ID,
  160. String[128];
  161. if(sscanf(parmas, "u", ID)) return SendClientMessage(playerid, COLOR_RED, "Usage: /unblock [id]");
  162. if(ID == playerid) return SendClientMessage(playerid, COLOR_RED, "you can not unblock yourself");
  163. if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, -1, "Player not connected!");
  164. format(String, sizeof(String), "You are now accepting Pms from %s", PlayerName(ID));
  165. SendClientMessage(playerid, COLOR_YELLOW, String);
  166.  
  167. PlayerData[playerid][Block] = -1;
  168.  
  169. return 1;
  170. }
  171. /*=====================================================================================================
  172. End of PM System
  173. =====================================================================================================*/
  174. /*=====================================================================================================
  175. Whisper System
  176. =====================================================================================================*/
  177.  
  178. CMD:w(playerid,params[])
  179. {
  180. new String[128];
  181. new String2[128];
  182. new Float:x,
  183. Float:y,
  184. Float:z;
  185.  
  186. if(sscanf(params, "s[128]", String)) return SendClientMessage(playerid, -1, "Usage: /w(hisper) [message]");
  187. SetPlayerChatBubble(playerid, String, COLOR_YELLOW, 35, 10000);
  188. GetPlayerPos(playerid, x, y, z);
  189. for(new i = 0; i < MAX_PLAYERS; i++)
  190. {
  191. if(IsPlayerInRangeOfPoint(i, 15.0, x, y, z))
  192. {
  193. format(String2, sizeof(String2), "%s[%i]: %s", PlayerName(playerid), playerid, String);
  194. SendClientMessage(i, COLOR_YELLOW, String2);
  195. }
  196. }
  197.  
  198. return 1;
  199. }
  200.  
  201. CMD:whisper(playerid, parmas[]) return cmd_w(playerid, parmas);
  202. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  203. End Of Script: Pm and Whisper system - DeeadPool©
  204. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
Add Comment
Please, Sign In to add comment