Guest User

Word Filter by Vital

a guest
Mar 3rd, 2011
437
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.92 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. public OnFilterScriptInit()
  4. {
  5.     print("\n=====================================");
  6.     print("=========-Word Filter by Vital-===========");
  7.     print("=====================================\n");
  8.     return 1;
  9. }
  10.  
  11. new const badwords[][] = { "fuck", "piss", "shit", "wanker", "prick" }; // Words which will be filtered out
  12. new const goodwords[][] = { "f**k", "p**s", "s**t", "w****r", "p***k" }; // Replacement Words (It is important to keep the replacement word the same length as the bad word)
  13. new FilterState[MAX_PLAYERS] = 0;
  14.  
  15. public OnFilterScriptExit()
  16. {
  17.     return 1;
  18. }
  19.  
  20. public OnGameModeInit()
  21. {
  22.     return 1;
  23. }
  24.  
  25. public OnGameModeExit()
  26. {
  27.     return 1;
  28. }
  29.  
  30. public OnPlayerRequestClass(playerid, classid)
  31. {
  32.     return 1;
  33. }
  34.  
  35. public OnPlayerConnect(playerid)
  36. {
  37.     return 1;
  38. }
  39.  
  40. public OnPlayerDisconnect(playerid, reason)
  41. {
  42.     FilterState[playerid] = 0;
  43.     return 1;
  44. }
  45.  
  46. public OnPlayerSpawn(playerid)
  47. {
  48.     return 1;
  49. }
  50.  
  51. public OnPlayerDeath(playerid, killerid, reason)
  52. {
  53.     return 1;
  54. }
  55.  
  56. public OnVehicleSpawn(vehicleid)
  57. {
  58.     return 1;
  59. }
  60.  
  61. public OnVehicleDeath(vehicleid, killerid)
  62. {
  63.     return 1;
  64. }
  65.  
  66. public OnPlayerText(playerid, text[])
  67. {
  68.     if(FilterState[playerid] == 0) return 1;
  69.     for(new badword; badword < sizeof(badwords); badword++)
  70.     {
  71.         new result = strfind(text, badwords[badword], false);
  72.  
  73.         while(result != -1)
  74.         {
  75.             new length = strlen(badwords[badword]);
  76.  
  77.             for(new i; i < length; i++)
  78.             {
  79.                 text[result+i] = goodwords[badword][i];
  80.             }
  81.  
  82.             result = strfind(text, badwords[badword], false, result + length);
  83.         }
  84.     }
  85.     return 1;
  86. }
  87.  
  88. public OnPlayerCommandText(playerid, cmdtext[])
  89. {
  90.     if (strcmp("/wfilter", cmdtext, true, 8) == 0)
  91.     {
  92.         if(FilterState[playerid] == 1)
  93.         {
  94.             FilterState[playerid] = 0;
  95.             SendClientMessage(playerid, 0xFF0000FF, "Word Filter Disabled!");
  96.         }else
  97.         {
  98.             FilterState[playerid] = 1;
  99.             SendClientMessage(playerid, 0x00FF00FF, "Word Filter Enabled!");
  100.         }
  101.         return 1;
  102.     }
  103.     return 0;
  104. }
  105. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  106. {
  107.     return 1;
  108. }
  109.  
  110. public OnPlayerExitVehicle(playerid, vehicleid)
  111. {
  112.     return 1;
  113. }
  114.  
  115. public OnPlayerStateChange(playerid, newstate, oldstate)
  116. {
  117.     return 1;
  118. }
  119.  
  120. public OnPlayerEnterCheckpoint(playerid)
  121. {
  122.     return 1;
  123. }
  124.  
  125. public OnPlayerLeaveCheckpoint(playerid)
  126. {
  127.     return 1;
  128. }
  129.  
  130. public OnPlayerEnterRaceCheckpoint(playerid)
  131. {
  132.     return 1;
  133. }
  134.  
  135. public OnPlayerLeaveRaceCheckpoint(playerid)
  136. {
  137.     return 1;
  138. }
  139.  
  140. public OnRconCommand(cmd[])
  141. {
  142.     return 1;
  143. }
  144.  
  145. public OnPlayerRequestSpawn(playerid)
  146. {
  147.     return 1;
  148. }
  149.  
  150. public OnObjectMoved(objectid)
  151. {
  152.     return 1;
  153. }
  154.  
  155. public OnPlayerObjectMoved(playerid, objectid)
  156. {
  157.     return 1;
  158. }
  159.  
  160. public OnPlayerPickUpPickup(playerid, pickupid)
  161. {
  162.     return 1;
  163. }
  164.  
  165. public OnVehicleMod(playerid, vehicleid, componentid)
  166. {
  167.     return 1;
  168. }
  169.  
  170. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  171. {
  172.     return 1;
  173. }
  174.  
  175. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  176. {
  177.     return 1;
  178. }
  179.  
  180. public OnPlayerSelectedMenuRow(playerid, row)
  181. {
  182.     return 1;
  183. }
  184.  
  185. public OnPlayerExitedMenu(playerid)
  186. {
  187.     return 1;
  188. }
  189.  
  190. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  191. {
  192.     return 1;
  193. }
  194.  
  195. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  196. {
  197.     return 1;
  198. }
  199.  
  200. public OnRconLoginAttempt(ip[], password[], success)
  201. {
  202.     return 1;
  203. }
  204.  
  205. public OnPlayerUpdate(playerid)
  206. {
  207.     return 1;
  208. }
  209.  
  210. public OnPlayerStreamIn(playerid, forplayerid)
  211. {
  212.     return 1;
  213. }
  214.  
  215. public OnPlayerStreamOut(playerid, forplayerid)
  216. {
  217.     return 1;
  218. }
  219.  
  220. public OnVehicleStreamIn(vehicleid, forplayerid)
  221. {
  222.     return 1;
  223. }
  224.  
  225. public OnVehicleStreamOut(vehicleid, forplayerid)
  226. {
  227.     return 1;
  228. }
  229.  
  230. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  231. {
  232.     return 1;
  233. }
  234.  
  235. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  236. {
  237.     return 1;
  238. }
Advertisement
Add Comment
Please, Sign In to add comment