Guest User

Some Filter Scripts

a guest
Jul 29th, 2012
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 10.08 KB | None | 0 0
  1. //                                  Score Saving by Joker
  2. #define FILTERSCRIPT
  3.  
  4. #include <a_samp>
  5. #include <dini>
  6. #if defined FILTERSCRIPT
  7. #define SERVER_USER_FILE "Users/%s.ini"
  8. #include "../include/gl_common.inc"
  9. enum pInfo
  10. {
  11.     pScore
  12. }
  13. new PlayerInfo[MAX_PLAYERS][pInfo];
  14. new seconds[MAX_PLAYERS];
  15. public OnFilterScriptInit()
  16. {
  17.         print("\n--------------------------------------");
  18.         print(" Score Saving by Joker loaded");
  19.         print("--------------------------------------\n");
  20.         SetTimer("scoretimer", 1000, true);
  21.         return 1;
  22. }
  23.  
  24. public OnFilterScriptExit()
  25. {
  26.     print("\n--------------------------------------");
  27.         print(" Score Saving by Joker unloaded");
  28.         print("--------------------------------------\n");
  29.         return 1;
  30. }
  31. public OnPlayerConnect(playerid)
  32. {
  33.     new name[MAX_PLAYER_NAME], file[256];
  34.     GetPlayerName(playerid, name, sizeof(name));
  35.     format(file, sizeof(file), SERVER_USER_FILE, name);
  36.     SetPlayerScore(playerid,PlayerInfo[playerid][pScore]);
  37.     if (!dini_Exists(file))
  38.     {
  39.         dini_Create(file);
  40.         dini_IntSet(file, "Score",SetPlayerScore(playerid,0));
  41.     }
  42.     if(fexist(file))
  43.     {
  44.         SetPlayerScore(playerid,dini_Int(file, "Score"));
  45.     }
  46.         return 1;
  47. }
  48.  
  49. public OnPlayerDisconnect(playerid, reason)
  50. {
  51.         new name[MAX_PLAYER_NAME], file[256];
  52.     GetPlayerName(playerid, name, sizeof(name));
  53.     format(file, sizeof(file), SERVER_USER_FILE, name);
  54.         dini_IntSet(file, "Score", GetPlayerScore(playerid));
  55.         return 1;
  56. }
  57. forward scoretimer();
  58. public scoretimer()
  59. {
  60.     for(new i; i<MAX_PLAYERS; i++)
  61.     {
  62.         if(!IsPlayerConnected(i)) continue;
  63.         seconds[i] ++;
  64.         if(seconds[i] == 60)
  65.         {
  66.             SetPlayerScore(i, GetPlayerScore(i) + 1);
  67.             seconds[i] = 0;
  68.         }
  69.     }
  70.     return 1;
  71. }
  72. #endif
  73. ------------------------------------------------------------------------------------------------------------
  74. //                              Simple afk system by Joker
  75. #define FILTERSCRIPT
  76.  
  77. #include <a_samp>
  78. #include <zcmd>
  79.  
  80. #if defined FILTERSCRIPT
  81. #define DRED 0xFF00000
  82. #define WHITE 0xFFFFFFFF
  83. new AFK[MAX_PLAYERS];
  84.  
  85. public OnFilterScriptInit()
  86. {
  87.     print("\n--------------------------------------");
  88.     print(" AFK system by Joker loaded");
  89.     print("--------------------------------------\n");
  90.     return 1;
  91. }
  92.  
  93. public OnFilterScriptExit()
  94. {
  95.     print("\n--------------------------------------");
  96.     print(" AFK system by Joker unloaded");
  97.     print("--------------------------------------\n");
  98.     return 1;
  99. }
  100. public OnPlayerConnect(playerid)
  101. {
  102.     AFK[playerid] = 0;
  103.     return 1;
  104. }
  105. CMD:afk(playerid)
  106. {
  107.     if (AFK[playerid] == 1)
  108.     {
  109.         SendClientMessage(playerid,DRED,"You are already AFK!");
  110.     }
  111.     else
  112.     {
  113.         new string[128];
  114.         format(string,sizeof(string)," %s is now Away From Keyboard (AFK)",GetPlayerNameEx(playerid));
  115.         SendClientMessageToAll(WHITE,string);
  116.         TogglePlayerControllable(playerid,0);
  117.         SendClientMessage(playerid,WHITE,"You are now AFK!");
  118.         AFK[playerid] = 1;
  119.     }
  120.     return 1;
  121. }
  122.  
  123. CMD:back(playerid)
  124. {
  125.     if (AFK[playerid] == 0)
  126.     {
  127.         SendClientMessage(playerid,DRED,"You are already back!");
  128.     }
  129.     else
  130.     {
  131.         new string[128];
  132.         format(string,sizeof(string)," %s is now back!",GetPlayerNameEx(playerid));
  133.         SendClientMessageToAll(WHITE,string);
  134.         TogglePlayerControllable(playerid,1);
  135.         SendClientMessage(playerid,WHITE,"Welcome back!");
  136.         AFK[playerid] = 0;
  137.     }
  138.     return 1;
  139. }
  140. stock GetPlayerNameEx(playerid)
  141. {
  142.     new Name[MAX_PLAYER_NAME];
  143.     GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
  144.     return Name;
  145. }
  146. #endif
  147. ------------------------------------------------------------------------------------------------------
  148. //                                      This is Anti flood+Ip limit edit by Audi_Quattrix&Joker
  149. //                                      Original Creator Roperr All credits goes to him
  150. #define FILTERSCRIPT
  151.  
  152. #include <a_samp>
  153. #define GREEN 0x33AA33AA
  154. #define IP_LIMIT 3 // = Max connections from one single IP
  155. #define SAME_IP_CONNECT 3 // = The number of connects from the same IP before banning the flooder
  156. new Same_IP=0,Join_Stamp,ban_s[25],exceed=0;
  157. #define Time_Limit 3500 // = The time span between connects, adjust it to your own specifications
  158.  
  159. #if defined FILTERSCRIPT
  160. public OnFilterScriptInit()
  161. {
  162.     print("\n--------------------------------------");
  163.     print(" Anti flood+ ip limit loaded");
  164.     print("--------------------------------------\n");
  165.     return 1;
  166. }
  167. public OnPlayerConnect(playerid)
  168. {
  169.     new ConnIP[16];
  170.     GetPlayerIp(playerid,ConnIP,16);
  171.     new compare_IP[16];
  172.     new number_IP = 0;
  173.     for(new i=0; i<MAX_PLAYERS; i++) {
  174.         if(IsPlayerConnected(i)) {
  175.             GetPlayerIp(i,compare_IP,16);
  176.             if(!strcmp(compare_IP,ConnIP)) number_IP++;
  177.         }
  178.     }
  179.     if((GetTickCount() - Join_Stamp) < Time_Limit)
  180.         exceed=1;
  181.     else
  182.         exceed=0;
  183.     if(strcmp(ban_s, ConnIP, false) == 0 && exceed == 1 )
  184.     {
  185.         Same_IP++;
  186.         if(Same_IP > SAME_IP_CONNECT)
  187.         {
  188.             new string[128];
  189.             format(string,sizeof(string),"Player %s Has been Banned [Reason: IP limit exceed/Bot attack]",GetPlayerNameEx(playerid));
  190.             SendClientMessageToAll(GREEN,string);
  191.             Ban(playerid);
  192.             Same_IP=0;
  193.         }
  194.     }
  195.     else
  196.     {
  197.         Same_IP=0;
  198.     }
  199.     if(number_IP > IP_LIMIT)
  200.         Kick(playerid);
  201.     GetStampIP(playerid);
  202.     return 1;
  203. }
  204. stock GetPlayerIPEx(playerid)
  205. {
  206.     new IP[15];
  207.     GetPlayerIp(playerid, IP, 15);
  208.     return IP;
  209. }
  210. stock GetStampIP(playerid){
  211.     new S_IP[16];
  212.     Join_Stamp=GetTickCount();
  213.     GetPlayerIp(playerid,S_IP,16);
  214.     format(ban_s, 16, "%s", S_IP);
  215. }
  216. stock GetPlayerNameEx(playerid)
  217. {
  218.     new Name[MAX_PLAYER_NAME];
  219.     GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
  220.     return Name;
  221. }
  222. #endif
  223. ---------------------------------------------------------------------------------------------------------
  224. //                                  Super brake script by Audi_Quattrix
  225. #define FILTERSCRIPT
  226. #include <a_samp>
  227. #include <zcmd>
  228. #if defined FILTERSCRIPT
  229. #define PRESSED(%0) \
  230.     (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
  231. new Handbrake[MAX_PLAYERS];
  232.  
  233. public OnFilterScriptInit()
  234. {
  235.     print("\n--------------------------------------");
  236.     print(" Super brake script by Audi_Quattrix loaded");
  237.     print("--------------------------------------\n");
  238.     return 1;
  239. }
  240.  
  241. public OnFilterScriptExit()
  242. {
  243.     print("\n--------------------------------------");
  244.     print(" Super brake script by Audi_Quattrix unloaded");
  245.     print("--------------------------------------\n");
  246.     return 1;
  247. }
  248. public OnPlayerConnect(playerid)
  249. {
  250.     Handbrake[playerid] = 0;
  251.     return 1;
  252. }
  253. CMD:handbrake(playerid)
  254. {
  255.     if(Handbrake[playerid]== 0)
  256.     {
  257.         Handbrake[playerid]= 1;
  258.         SendClientMessage(playerid,0x00FFFFAA,"Handbrake ON!");
  259.     }
  260.     else if(Handbrake[playerid] == 1)
  261.     {
  262.         Handbrake[playerid] = 0;
  263.         SendClientMessage(playerid,0x00FFFFAA,"Handbrake OFF!");
  264.     }
  265.     return 1;
  266. }
  267. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  268. {
  269.     if (GetPlayerVehicleSeat(playerid) == 0 ||PRESSED(KEY_HANDBRAKE))
  270.     {
  271.         if (Handbrake[playerid] == 0)
  272.         {
  273.        
  274.         }
  275.         else if (Handbrake[playerid] == 1)
  276.         {
  277.             SetVehicleVelocity(GetPlayerVehicleID(playerid),0,0,0);
  278.         }
  279.     }
  280.     return 1;
  281. }
  282. #endif
  283. ---------------------------------------------------------------------------------------------------------
  284. //                      This Filterscript is made by Joker
  285. #define FILTERSCRIPT
  286. #include <a_samp>
  287.  
  288. #if defined FILTERSCRIPT
  289.  
  290. public OnFilterScriptInit()
  291. {
  292.     print("\n--------------------------------------");
  293.     print("Jokers Join and Leave Messages Loaded!");
  294.     print("--------------------------------------\n");
  295.     return 1;
  296. }
  297.  
  298. public OnFilterScriptExit()
  299. {
  300.     print("\n--------------------------------------");
  301.     print("Jokers Join and Leave Messages Unloaded!");
  302.     print("--------------------------------------\n");
  303.     return 1;
  304. }
  305.  
  306. public OnPlayerConnect(playerid)
  307. {
  308.     new pName[30], string[128];
  309.     GetPlayerName(playerid, pName, 30);
  310.     format(string, 256, "{FFFFFF}%s has {00FF22}joined {FFFFFF} the server! ", pName);
  311.     SendClientMessageToAll(0x33AA33AA,string);
  312.     return 1;
  313. }
  314.  
  315. public OnPlayerDisconnect(playerid, reason)
  316. {
  317.     new string[128];
  318.     new name[MAX_PLAYER_NAME];
  319.     GetPlayerName(playerid,name,MAX_PLAYER_NAME);
  320.     switch(reason)
  321.     {
  322.         case 0: format(string,sizeof string,"%s left the server. (Timed out)",name);
  323.         case 1: format(string,sizeof string,"%s left the server. (Leaving)",name);
  324.         case 2: format(string,sizeof string,"%s left the server. (Kicked/Banned)",name);
  325.     }
  326.     SendClientMessageToAll(0xFFFFFFAA,string);
  327.     return 1;
  328. }
  329. #endif
  330. ---------------------------------------------------------------------------------------------------------
  331. //                                  Randommessages by Audi_Quattrix...
  332. #define FILTERSCRIPT
  333.  
  334. #include <a_samp>
  335. #define YELLOW 0xFFFF00AA
  336. #if defined FILTERSCRIPT
  337. forward RandomMessages();
  338.  
  339. public OnFilterScriptInit()
  340. {
  341.     print("\n--------------------------------------");
  342.     print(" Randommessages by Audi_Quattrix loaded");
  343.     print("--------------------------------------\n");
  344.     SetTimer("RandomMessages", 60000, true);
  345.     return 1;
  346. }
  347.  
  348. public OnFilterScriptExit()
  349. {
  350.     print("\n--------------------------------------");
  351.     print(" Randommessages by Audi_Quattrix unloaded");
  352.     print("--------------------------------------\n");
  353.     return 1;
  354. }
  355. //=================================[Random messages]============================
  356. new randomMessages[][] =
  357.     {
  358.         "MESSAGE 1",
  359.         "MESSAGE 2",
  360.         "MESSAGE 3",
  361.         "MESSAGE 4" //Feel free to add more :P
  362.     };
  363. public RandomMessages()
  364. {
  365.     new randomMsg = random(sizeof(randomMessages));
  366.     SendClientMessageToAll(YELLOW, randomMessages[randomMsg]);
  367. }
  368. #endif
  369. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment