Guest User

GAAC v.1.0.0

a guest
Dec 14th, 2010
448
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 95.68 KB | None | 0 0
  1. #define GAAC_version "1.0.0"
  2. /*
  3.  
  4.  _____________________________________________________________________________________________________________________________________________
  5. |     #GAAC v. 1.0.0
  6. |
  7. |     GAAC FS - Green Administration and Anti-Cheat Filterscript
  8. |     Copyright © André "DeathOnaStick" Brandenburger
  9. |
  10. |     You are kindly requested to not modify this script and also to not copy (non-blacklist-related) code that is,
  11. |     summed up in this script, longer than 50 lines. The copying of blacklist-related code is strictly prohibited!
  12. |
  13. |     Also, the modification of blacklist-related code/features is strictly prohibited!
  14. |     Inappropriate behavior and/or usage for inappropriate purposes will result in a server-ban.
  15. |     By this ban you will not be able to use the main features of GAAC anymore.
  16. |     Thank you for your understanding.
  17. |
  18. |_____________________________________________________________________________________________________________________________________________
  19.  
  20.  
  21.  
  22.  
  23. -----!!!---------!!!---------!!!---------!!!---------!!!---------!!!---------!!!---------!!!---------!!!---------!!!---------!!!------
  24. ------------------------------------------------------#-CONFIGURATION SECTION-#-------------------------------------------------------
  25. --------------------------------------------#-Take your time to read and filling out-#------------------------------------------------
  26. --!!!---------!!!---------!!!---------!!!---------!!!---------!!!---------!!!---------!!!---------!!!---------!!!---------!!!---------
  27. */
  28.  
  29.  
  30.  
  31.  
  32. //#define SecuritySystemOnline
  33.                                   //Enables my Security system basing on Local IP's and Names
  34.                                   //default: commented.
  35.                                   //if uncommented:
  36.                                   //-->Kicks players, that connect to server with "LOCALNAME", when IP is not local.
  37.                                   //-->Lets just "LocalName" kick and ban people.
  38.                                   //(Comment it when LocalName is commented. Otherwise nobody will be able to kick and ban.)
  39.                                   //if commented:
  40.                                   //-->Every Admin with Level 5+ can kick and ban.
  41.                                  
  42.                                  
  43. //#define LOCALNAME "YOURNAME"
  44.                                   //Name of the player, that joins from local IP. If there is none, comment it together with the one above.
  45.                                   //local IP = LOCALHOST = 128.0.0.1
  46.  
  47.  
  48.  
  49. #define SecureBanActive
  50.                                   //Uses my SecureBan-methode for banning
  51.                                   //default: uncommented
  52.                                   //if uncommented:
  53.                                   //-->Collects all IP's of banned people in "scriptfiles\GreenAAC\Banfiles\IPs.ini"
  54.                                   //-->Creates a ban-file for every player that gets banned, e.g. "...\Banfiles\Ban.YOUR-NAME.ini"
  55.                                   //-->Kicks everyone, that joins with a banned IP, like the default "Ban" does.
  56.                                   //-->Blacklists a player, what means, he gets an entry into an Online-Database and will be banned
  57.                                   //   on every other server, that uses this Administration script and has the blacklist enabled.
  58.                                   //   For more info: blacklist.pytalhost.net
  59.                                   //if commented:
  60.                                   //-->May cause problems on single servers that encountered Problems with the ordinary Ban-System,
  61.                                   //   like I did with my server.
  62.                                  
  63.                                  
  64. #define PMKey "#"
  65.                                   //The key you need to enter first for sending a PM
  66.                                   //default: "#"
  67.                                   //Example for default-value:
  68.                                   //Player sends "#1 DeathOnaStick rocks!".
  69.                                   //Sends "PM from UrName: DeathOnaStick rocks!" to the Player with ID 1
  70.                                   //Comment the line to disable this function.
  71.  
  72.  
  73. #define ACKey "!"
  74.                                   //The key you need to enter first for using the Admin-Chat
  75.                                   //Useable for every Admin with level 4+.
  76.                                   //default: "!"
  77.                                   //Example for default "!":
  78.                                   //Admin with level 4+ sends: "! DeathOnaStick is so cool!"
  79.                                   //Admins with level 4+ will get: "[AC]UrName: DeathOnaStick is so cool!"
  80.                                   //Comment the line to disable this function.
  81.                                  
  82.                                  
  83. #define RespawnDelay 3
  84.                                   //Automatically Respawns all unused vehicles every n-hours
  85.                                   //Comment the line to totally disable the function
  86.                                   //default value: 3
  87.                                  
  88. #define AntiWeaponHackActive
  89.                                   //Warns players that get illegally purchased weapons, e.g. by using a weaponhack.
  90.                                   //default: uncommented
  91.                                   //Comment the line to disable this function
  92.                                  
  93. #define DefaultMaxPing 750
  94.                                   //The maximum ping. A player with a higher ping than MaxPing will be kicked.
  95.                                   //Can be changed by using /maxping [value].
  96.                                   //default value: 750
  97.                                  
  98. //#define ServerLocked
  99.                                   //commented if server should be unlocked, uncommented if locked.
  100.                                   //If locked: Every player that joins the server must enter a password.
  101.                                   //default: commented (unlocked)
  102.  
  103. #define DefaultLockPassword \
  104.         "Parabola"
  105.                                   //Sets the default password for the server, if it is locked. Password can be changed through "/lock [pass]"
  106.                                   //This is NOT the rcon-password! Also it's recommended to not take the rcon password as LockPassword.
  107.                                  
  108. //#define CommandLog
  109.                                   //Prints the commands that are used. Format: '[playerid]: [commandname]'
  110.                                   //Parameters are not recorded. The Log may slow down the speed of the commands, including the server.
  111.                                   //default: commented (=deactivated)
  112.  
  113.  
  114. //#define Blacklist
  115.                                   //Enables the blacklist. Still in Beta.
  116.                                   //With enabling this feature, you agree to the fact, that you neither are allowed to abuse this feature,
  117.                                   //nor use it for illegal activity or illegal/unsocial purposes, no matter which reason you have.
  118.                                   //You are not allowed to access neither over the here-given URL's,
  119.                                   //nor over other ways to the Blacklist-Database, except within this script,
  120.                                   //without having any changes done by a person,
  121.                                   //that is not the Author of this whole script, including this agreement.
  122.                                   //The author is always allowed to change terms of this agreement.
  123.                                   //- 4. December 2010
  124.                                   //- André Brandenburger
  125.                                  
  126.                                   //default: commented
  127.                                   //If you agree to the agreement, that is written above,
  128.                                   //you are allowed to enable the blacklist-feature.
  129.  
  130. //#define UseGreenAACFolders
  131.                                   //if uncommented: Player-files get saved in GreenAAC/Players
  132.                                   //                Banfiles get saved in GreenAAC/Banfiles
  133.                                   //                Logs get saved in GreenAAC/Logs
  134.                                   //                Positions get saved in GreenAAC/Positions
  135.                                   //if commented: All files get saved in the scriptfiles folder itself.
  136.                                  
  137. #define FORBIDDEN_WEAPONS 38
  138.                                   //Defines the weapons, that are not used in the gamemode you run.
  139.                                   //If you use every weapon, comment this line
  140.                                   //Every player that has a weapon like this (which actually is impossible, instead he's cheating),
  141.                                   //will get a warning. 5 Warnings = kick.
  142.                                   //If you have more weapons that are unused, seperate the ID's by using a comma,
  143.                                   //like: '#define FORBIDDEN_WEAPONS 38,47,48'
  144.                                   //Just use if AntiWeaponHack is enabled.
  145.  
  146. #define ACDebug
  147.  
  148. #define SpamDelay 1500
  149.  
  150. /*
  151.  
  152. ---------------------------------------------------------------------------------------------------------------------------------------
  153. ------------------------------------------------- ---#-CONFIGURATION SECTION END-#-----------------------------------------------------
  154. END---------END---------END---------END---------END---------END---------END---------END---------END---------END---------END---------END
  155.  
  156. */
  157.  
  158. #include <a_samp>
  159. #include <dini>
  160. #include <dudb>
  161. #include <GInclude.inc>
  162. #include <a_http>
  163.  
  164. native WP_Hash(buffer[], len, const str[]);
  165.  
  166. #define COLOR_RED 0xAA3333AA
  167. #define COLOR_YELLOW 0xFFFF00AA
  168. #define COLOR_ORANGE 0xFF9900AA
  169. #define COLOR_GREEN 0x33AA33AA
  170. #define COLOR_LIGHTBLUE 0x33CCFFAA
  171. #define COLOR_WHITE 0xFFFFFFAA
  172. #define COLOR_SYSTEM 0xEFEFF7AA
  173.  
  174. #define VTYPE_BIKE 4
  175. #define VTYPE_BMX VTYPE_BIKE
  176. #define VTYPE_PLANE 8
  177. #define VTYPE_HELI VTYPE_PLANE
  178. #define VTYPE_SEA 9
  179. #define VTYPE_BOAT VTYPE_SEA
  180. #define VTYPE_BICYCLE VTYPE_BMX
  181.  
  182. #if defined CommandLog
  183. #define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) &&!printf("%i: %s", playerid, #%1)&&((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
  184. #define cmd(%1) if (!strcmp((cmdtext[1]), #%1, true) && cmd_%1(playerid)&&!printf("%i: %s", playerid, #%1)) return 1
  185. #else
  186. #define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) &&((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
  187. #define cmd(%1) if (!strcmp((cmdtext[1]), #%1, true) && cmd_%1(playerid)) return 1
  188. #endif
  189.  
  190. #define INFINITY (Float:0x7F800000)
  191.  
  192. #if !defined AntiWeaponHackActive
  193.     #if defined ACDebug
  194.         #undef ACDebug
  195.     #endif
  196. #endif
  197. #if !defined LOCALNAME
  198.     #if defined SecuritySystemOnline
  199.         #undef SecuritySystemOnline
  200.     #endif
  201. #endif
  202. #if !defined DefaultMaxPing
  203.     #define DefaultMaxPing 999
  204. #endif
  205. #if !defined DefaultLockPassword
  206.     #define DefaultLockPassword "changeME"
  207. #endif
  208. #if !defined ServerLocked
  209.     #define ServerLocked 0
  210. #endif
  211. #if defined SpamDelay 0
  212.     #undef SpamDelay
  213. #endif
  214.  
  215. new PrisonSeat=5, PrisonCar, maxping=DefaultMaxPing, Srvrlckd=ServerLocked, SrvrPass[25]=DefaultLockPassword;
  216.  
  217. #if defined Blacklist
  218.     new bool:blonline=false;
  219. #endif
  220.  
  221. public OnFilterScriptInit()
  222. {
  223.     SetTimer("MessageShow", 1000, false);
  224.     SetTimer("FiveMin", 300000, true);
  225.     SetTimer("Update", (9482+random(58)), false);
  226.     #if defined RespawnDelay
  227.     SetTimer("NHours",(RespawnDelay*3600000), true);
  228.     #endif
  229.     PrisonCar=CreateVehicle(437, -1401.829956, 107.051300, 1032.273437, 0.0, 0, 1, -1);
  230.     SetVehicleVirtualWorld(PrisonCar, 666);
  231.     LinkVehicleToInterior(PrisonCar, 1);
  232.     return PrisonCar, 1;
  233. }
  234.  
  235. forward MessageShow();
  236. public MessageShow()
  237. {
  238.     print("\n-----------------------------------------------");
  239.     print("-------------------«»GAAC«»--------------------");
  240.     print("-----------------------------------------------");
  241.     print("©GAAC-Filterscript initialized");
  242.     print("-----------------------------------------------");
  243.  
  244.     #if defined SecuritySystemOnline
  245.     print("#Security System online");
  246.     print("-----------------------------------------------");
  247.     #else
  248.     print("#Warning: Security System offline");
  249.     print("-----------------------------------------------");
  250.     #endif
  251.  
  252.     #if defined SecureBanActive
  253.     print("#Secure-Ban activated");
  254.     print("-----------------------------------------------");
  255.     #else
  256.     print("#Warning: Secure-Ban deactivated");
  257.     print("-----------------------------------------------");
  258.     #endif
  259.  
  260.     #if defined SecureBanActive
  261.     print("#Anti Weaponhack activated");
  262.     print("-----------------------------------------------");
  263.     #else
  264.     print("#Warning: Anti Weaponhack deactivated");
  265.     print("-----------------------------------------------");
  266.     #endif
  267.  
  268.     #if defined PMKey
  269.     printf("#PM-System initialized. PMKey '%c'", PMKey);
  270.     print("-----------------------------------------------");
  271.     #endif
  272.    
  273.     #if defined ACKey
  274.     printf("#AdminChat-System initialized. ACKey '%c'", ACKey);
  275.     print("-----------------------------------------------");
  276.     #endif
  277.  
  278.     #if defined RespawnDelay
  279.     printf("#Respawning empty cars after %i Hours", RespawnDelay);
  280.     print("-----------------------------------------------");
  281.     #endif
  282.    
  283.     #if defined Blacklist
  284.     PingBlacklist();
  285.     #endif
  286.    
  287.     if(!fexist("GreenAAC/Players/GAACAdmin.ini"))
  288.     {
  289.         dini_Create("GreenAAC/Players/GAACAdmin.ini");
  290.         new buf[145];
  291.         new rconPass[128];
  292.         GetServerVarAsString("rcon_password", rconPass, sizeof(rconPass));
  293.         WP_Hash(buf, sizeof(buf), rconPass);
  294.         dini_Set("GreenAAC/Players/GAACAdmin.ini","Password", buf);
  295.         dini_IntSet("GreenAAC/Players/GAACAdmin.ini","AdminLevel", 6);
  296.         dini_IntSet("GreenAAC/Players/GAACAdmin.ini","Cash", 90000000);
  297.         dini_IntSet("GreenAAC/Players/GAACAdmin.ini","AmountKicked", 0);
  298.         dini_IntSet("GreenAAC/Players/GAACAdmin.ini","AutoMsg", 0);
  299.         dini_IntSet("GreenAAC/Players/GAACAdmin.ini", "Logged", 1);
  300.         print("#Start-client created. Connect with \"GAACAdmin\". Log in with rcon-pass.");
  301.         print("#Thank you for chosing GAAC!");
  302.         print("-----------------------------------------------");
  303.     }
  304.     return 1;
  305. }
  306.  
  307. #if defined RespawnDelay
  308. forward NHours();
  309. public NHours()
  310. {
  311.     for(new i=0; i<MAX_VEHICLES; i++)
  312.     {
  313.         new pcount=0;
  314.         for(new pl=0, tx=GetMaxPlayers(); pl<=tx; pl++)
  315.         {
  316.             if(IsPlayerConnected(pl))
  317.             {
  318.                 if(GetPlayerVehicleID(pl)==i)
  319.                 {
  320.                     pcount++;
  321.                     break;
  322.                 }
  323.             }
  324.         }
  325.         if(pcount==0)SetVehicleToRespawn(i);
  326.     }
  327.     return 1;
  328. }
  329. #endif
  330.  
  331. forward FiveMin();
  332. public FiveMin()
  333. {
  334.     #if defined Blacklist
  335.     PingBlacklist();
  336.     #endif
  337.     for(new i=0, tx=GetMaxPlayers(); i<=tx; i++)if(IsPlayerConnected(i))if(IsPlayerLoggedIn(i))
  338.     {
  339.         if(IsPlayerConnected(i)&&!IsPlayerNPC(i))
  340.         {
  341.             if(IsPlayerLoggedIn(i))
  342.             {
  343.                 SavePlayerData(i);
  344.                
  345.                 if(GetPVarInt(i, "AutoMsg")==1)
  346.                 {
  347.                     SendClientMessage(i, COLOR_GREEN,"[System]: Autosaved your files. (/aoff to turn automessages off)");
  348.                 }
  349.             }
  350.         }
  351.     }
  352.     return 1;
  353. }
  354.  
  355. #if defined AntiWeaponHackActive
  356. new PlayerWeapons[MAX_PLAYERS][47];
  357. new PlayerSpawnWeapons[MAX_PLAYERS][47];
  358.  
  359. forward OnPlayerGetWeapon(playerid, weaponid, ammo);
  360. public OnPlayerGetWeapon(playerid, weaponid, ammo)
  361. {
  362.     PlayerWeapons[playerid][weaponid]=1;
  363.     if(weaponid==39)PlayerWeapons[playerid][40]=1; //Satchel charges + Remotes
  364.     return 0;
  365. }
  366.  
  367. forward OnPlayerResetWeapons(playerid);
  368. public OnPlayerResetWeapons(playerid)
  369. {
  370.     for(new i=0; i<=47; i++)if(i!=PlayerSpawnWeapons[playerid][1]&&i!=PlayerSpawnWeapons[playerid][2]&&
  371.     i!=PlayerSpawnWeapons[playerid][3]&&i!=0)PlayerWeapons[playerid][i]=0;
  372.     return 0;
  373. }
  374.  
  375. forward OnPlayerSetSpawnInfo(playerid, weaponid1, ammo1, weaponid2, ammo2, weaponid3, ammo3);
  376. public OnPlayerSetSpawnInfo(playerid, weaponid1, ammo1, weaponid2, ammo2, weaponid3, ammo3)
  377. {
  378.     PlayerWeapons[playerid][weaponid1]=1;
  379.     PlayerWeapons[playerid][weaponid2]=1;
  380.     PlayerWeapons[playerid][weaponid3]=1;
  381.     PlayerSpawnWeapons[playerid][1]=weaponid1;
  382.     PlayerSpawnWeapons[playerid][2]=weaponid2;
  383.     PlayerSpawnWeapons[playerid][3]=weaponid3;
  384.     return 0;
  385. }
  386.  
  387. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  388. {
  389.     if(!ispassenger&&GetVehicleModel(vehicleid)>=596&&GetVehicleModel(vehicleid)<=599)PlayerWeapons[playerid][25]=1;
  390.     return 1;
  391. }
  392.  
  393. public OnPlayerExitVehicle(playerid, vehicleid)
  394. {
  395.     if(GetVehicleType(vehicleid)==VTYPE_HELI||GetVehicleType(vehicleid)==VTYPE_PLANE)PlayerWeapons[playerid][46]=1;
  396.     return 1;
  397. }
  398. #endif
  399.  
  400. stock GetWeaponSlot(weaponid)
  401. {
  402.     new slot=-1;
  403.     switch(weaponid)
  404.     {
  405.     case 0,1:slot=0;
  406.     case 2,3,4,5,6,7,8,9:slot=1;
  407.     case 10,11,12,13,14,15: slot=10;
  408.     case 16,17,18,39:slot=8;
  409.     case 22,23,24:slot=2;
  410.     case 25,26,27:slot=3;
  411.     case 28,29,32:slot=4;
  412.     case 30,31:slot=5;
  413.     case 33,34:slot=6;
  414.     case 35,36,37,38:slot=7;
  415.     case 40:slot=12;
  416.     case 41,42,43:slot=9;
  417.     case 44,45,46:slot=11;
  418.     }
  419.     return slot;
  420. }
  421.  
  422. forward Update();
  423. public Update()
  424. {
  425.     for(new playerid=0, tx=GetMaxPlayers(); playerid<=tx; playerid++)
  426.     {
  427.         if(IsPlayerConnected(playerid)&&IsPlayerNPC(playerid)==0)
  428.         {
  429.             if(GetPlayerPing(playerid)>maxping)
  430.             {
  431.                 SendClientMessage(playerid, COLOR_RED, "Sorry, your Ping is too high. You have been kicked.");
  432.                 return Kick(playerid);
  433.             }
  434.             #if defined AntiWeaponHackActive
  435.             for(new ws=0; ws<=12; ws++)
  436.             {
  437.                 new amm, wep;
  438.                 GetPlayerWeaponData(playerid, ws, wep, amm);
  439.                 if(PlayerWeapons[playerid][wep]==1&&amm==0)PlayerWeapons[playerid][wep]=0;
  440.             }
  441.             #if defined FORBIDDEN_WEAPONS
  442.             switch(GetPlayerWeapon(playerid))
  443.             {
  444.                 case 0: return 1;
  445.                 case FORBIDDEN_WEAPONS:
  446.                 {
  447.                     #if defined ACDebug
  448.                     WriteToACDebugFile(playerid);
  449.                     #endif
  450.                     ResetPlayerWeaponsEx(playerid);
  451.                     new wString[60];
  452.                     SetPVarInt(playerid, "PlayerWarnings", GetPVarInt(playerid, "PlayerWarnings")+1);
  453.                     format(wString, sizeof(wString), "[System]: Bad Weapon detected! WARNING [%i/5]", GetPVarInt(playerid, "PlayerWarnings"));
  454.                     SendClientMessage(playerid, COLOR_RED, wString);
  455.                     if(GetPVarInt(playerid, "PlayerWarnings")>=5)Kick(playerid);
  456.                     return 1;
  457.                 }
  458.                 default:{} // = do nothing
  459.             }
  460.             #endif
  461.             switch(PlayerWeapons[playerid][GetPlayerWeapon(playerid)])
  462.             {
  463.                 case 0:
  464.                 {
  465.                     if(GetPlayerInterior(playerid)==1||GetPlayerInterior(playerid)==4||
  466.                     GetPlayerInterior(playerid)==6||GetPlayerInterior(playerid)==7||
  467.                     GetPlayerWeapon(playerid)==0)
  468.                     {
  469.                         PlayerWeapons[playerid][GetPlayerWeapon(playerid)]=1;
  470.                         return 1;
  471.                     }
  472.                     else
  473.                     {
  474.                         #if defined ACDebug
  475.                         WriteToACDebugFile(playerid);
  476.                         #endif
  477.                         ResetPlayerWeaponsEx(playerid);
  478.                         new wString[60];
  479.                         SetPVarInt(playerid, "PlayerWarnings", GetPVarInt(playerid, "PlayerWarnings")+1);
  480.                         format(wString, sizeof(wString), "[System]: Bad Weapon detected! WARNING [%i/5]", GetPVarInt(playerid, "PlayerWarnings"));
  481.                         SendClientMessage(playerid, COLOR_RED, wString);
  482.                         if(GetPVarInt(playerid, "PlayerWarnings")>=5)Kick(playerid);
  483.                     }
  484.                 }
  485.                 default:{}
  486.             }
  487.             #endif
  488.         }
  489.     }
  490.     SetTimer("Update", (9482+random(random(132))), false);
  491.     return 1;
  492. }
  493. #if defined AntiWeaponHackActive
  494. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  495. {
  496.     if(newkeys&128||newkeys&KEY_FIRE)
  497.     {
  498.         if(!IsPlayerNPC(playerid))
  499.         {
  500.             for(new ws=0; ws<=12; ws++)
  501.             {
  502.                 new amm, wep;
  503.                 GetPlayerWeaponData(playerid, ws, wep, amm);
  504.                 if(PlayerWeapons[playerid][wep]==1&&amm==0)PlayerWeapons[playerid][wep]=0;
  505.             }
  506.             switch(GetPlayerWeapon(playerid))
  507.             {
  508.                 case 0: return 1;
  509.                 case 38:
  510.                 {
  511.                     #if defined ACDebug
  512.                     WriteToACDebugFile(playerid);
  513.                     #endif
  514.                     ResetPlayerWeaponsEx(playerid);
  515.                     new wString[60];
  516.                     SetPVarInt(playerid, "PlayerWarnings", GetPVarInt(playerid, "PlayerWarnings")+1);
  517.                     format(wString, sizeof(wString), "[System]: Bad Weapon detected! WARNING [%i/5]", GetPVarInt(playerid, "PlayerWarnings"));
  518.                     SendClientMessage(playerid, COLOR_RED, wString);
  519.                     if(GetPVarInt(playerid, "PlayerWarnings")>=5)Kick(playerid);
  520.                     return 1;
  521.                 }
  522.                 default:{}
  523.             }
  524.             switch(PlayerWeapons[playerid][GetPlayerWeapon(playerid)])
  525.             {
  526.                 case 0:
  527.                 {
  528.                     if(GetPlayerInterior(playerid)==1||GetPlayerInterior(playerid)==4||
  529.                     GetPlayerInterior(playerid)==6||GetPlayerInterior(playerid)==6||GetPlayerInterior(playerid)==7)
  530.                     {
  531.                         PlayerWeapons[playerid][GetPlayerWeapon(playerid)]=1;
  532.                         return 1;
  533.                     }
  534.                     else
  535.                     {
  536.                         #if defined ACDebug
  537.                         WriteToACDebugFile(playerid);
  538.                         #endif
  539.                         ResetPlayerWeaponsEx(playerid);
  540.                         new wString[60];
  541.                         SetPVarInt(playerid, "PlayerWarnings", GetPVarInt(playerid, "PlayerWarnings")+1);
  542.                         format(wString, sizeof(wString), "[System]: Bad Weapon detected! WARNING [%i/5]", GetPVarInt(playerid, "PlayerWarnings"));
  543.                         SendClientMessage(playerid, COLOR_RED, wString);
  544.                         if(GetPVarInt(playerid, "PlayerWarnings")>=5)Kick(playerid);
  545.                     }
  546.                 }
  547.                 default:{}
  548.             }
  549.         }
  550.     }
  551.     return 1;
  552. }
  553. #endif
  554. public OnPlayerDeath(playerid, killerid, reason)
  555. {
  556.     #if defined AntiWeaponHackActive
  557.     switch(reason)
  558.     {
  559.         case FORBIDDEN_WEAPONS:
  560.         {
  561.             #if defined ACDebug
  562.             WriteToACDebugFile(killerid);
  563.             #endif
  564.             new wString[30];
  565.             SetPVarInt(killerid, "PlayerWarnings", GetPVarInt(killerid, "PlayerWarnings")+1);
  566.             format(wString, sizeof(wString), "[System]: Bad Weapon detected! WARNING [%i/5]", GetPVarInt(killerid, "PlayerWarnings"));
  567.             SendClientMessage(killerid, COLOR_RED, wString);
  568.             if(GetPVarInt(killerid, "PlayerWarnings")>=5)Kick(killerid);
  569.         }
  570.     }
  571.     #endif
  572.     return 1;
  573. }
  574.  
  575. public OnPlayerConnect(playerid)
  576. {
  577.     if(!IsPlayerNPC(playerid))
  578.     {
  579.         new cIP[16];
  580.         GetPlayerIp(playerid, cIP, sizeof(cIP));
  581.         #if defined UseGreenAACFolders
  582.         if(fexist("GreenAAC/Banfiles/IPs.ini")==1 && dini_Isset("GreenAAC/Banfiles/IPs.ini", cIP)==1)
  583.         #else
  584.         if(fexist("IPs.ini")==1 && dini_Isset("GreenAAC/Banfiles/IPs.ini", cIP)==1)
  585.         #endif
  586.         {
  587.             SendClientMessage(playerid,COLOR_SYSTEM, "[System]: You're banned from this server!");
  588.             Kick(playerid);
  589.             return 0;
  590.         }
  591.         new ConnectName[MAX_PLAYER_NAME];
  592.         GetPlayerName(playerid, ConnectName, sizeof(ConnectName));
  593.         new filename[26+MAX_PLAYER_NAME];
  594.         #if defined UseGreenAACFolders
  595.         format(filename, sizeof(filename), "GreenAAC/Banfiles/Ban.%s.ini", ConnectName);
  596.         #else
  597.         format(filename, sizeof(filename), "Ban.%s.ini", ConnectName);
  598.         #endif
  599.         if(fexist(filename))
  600.         {
  601.             if(!strcmp(cIP,dini_Get(filename, "IP"),true)) //dini_Get(filename, "IP") = OldIP
  602.             {
  603.                 SendClientMessage(playerid, COLOR_SYSTEM, "[System]: You're banned from this server!");
  604.                 Kick(playerid);
  605.                 return 0;
  606.             }
  607.  
  608.             else
  609.             {
  610.                 SendClientMessage(playerid, COLOR_SYSTEM, "[System]: You are banned from this Server.");
  611.                 SendClientMessage(playerid, COLOR_SYSTEM, "[System]: If you think you have been banned accidentially,");
  612.                 SendClientMessage(playerid, COLOR_SYSTEM, "[System]: post on our website. Thanks for your understanding.");
  613.                 new WebStr[100],weburl[35];
  614.                 GetServerVarAsString("weburl", weburl, sizeof(weburl));
  615.                 if(!strlen(weburl))SendClientMessage(playerid, COLOR_SYSTEM, "[System]: (Sorry, but there is no website yet.)");
  616.                 else
  617.                 {
  618.                     format(WebStr, sizeof(WebStr), "[System]: Our Website: http://%s ", weburl);
  619.                     SendClientMessage(playerid, COLOR_SYSTEM, WebStr);
  620.                 }
  621.                 Kick(playerid);
  622.                 return 0;
  623.             }
  624.         }
  625.         #if defined Blacklist
  626.         GetPlayerVerification(playerid);
  627.         new tmpID;
  628.         tmpID=SetTimerEx("PVCheck", (2*1000*60), false, "i", playerid); //2 minutes 'deadline'
  629.         SetPVarInt(playerid, "PVCheckID", tmpID);
  630.         #endif
  631.  
  632.         #if defined SecuritySystemOnline
  633.         if(strcmp(ConnectName, LOCALNAME, false, sizeof(ConnectName))==0)
  634.         {
  635.             if(strcmp(cIP, "127.0.0.1", false, sizeof(cIP))==0)SendClientMessage(playerid,COLOR_GREEN, "Welcome Master.");
  636.             else if(strcmp(cIP, "127.0.0.1", false, sizeof(cIP))==1)
  637.             {
  638.                 new SecurityString[50+16+MAX_PLAYER_NAME];
  639.                 SendClientMessageToAll(COLOR_RED, "Deception detected!");
  640.                 format(SecurityString, sizeof(SecurityString), "%s [IP:%s] has been kicked for an attempt of deception!", ConnectName, cIP);
  641.                 SendClientMessageToAll(COLOR_RED, SecurityString);
  642.                 printf("\n[SECURITY] %s [%s] tried to connect with the Admin-Name %s! Player has been kicked!\n", ConnectName, cIP, ConnectName);
  643.                 Kick(playerid);
  644.             }
  645.         }
  646.         #endif
  647.         new file[21+MAX_PLAYER_NAME];
  648.         #if defined UseGreenAACFolders
  649.         format(file, sizeof(file), "GreenAAC/Players/%s.ini", ConnectName);
  650.         #else
  651.         format(file, sizeof(file), "%s.ini", ConnectName);
  652.         #endif
  653.         if(fexist(file))SendClientMessage(playerid, COLOR_SYSTEM, "[System]: Your Account already exists. Please use /glogin to log in.");
  654.         if(!fexist(file))
  655.         {
  656.             SendClientMessage(playerid, COLOR_SYSTEM,"[System]: You don't have an Account. Please register with /gregister, to save your progress.");
  657.         }
  658.         if(Srvrlckd)ShowPlayerDialog(playerid, 404, DIALOG_STYLE_INPUT, "Server is locked.", "Password", "Try", "Exit");
  659.     }
  660.     return 1;
  661. }
  662.  
  663. public OnPlayerDisconnect(playerid, reason)
  664. {
  665.     if(IsPlayerLoggedIn(playerid))
  666.     {
  667.         SavePlayerData(playerid);
  668.         if(!IsPlayerNPC(playerid))
  669.         {
  670.             new file[MAX_PLAYER_NAME+20];
  671.             new PName[MAX_PLAYER_NAME];
  672.             GetPlayerName(playerid, PName, sizeof(PName));
  673.             #if defined UseGreenAACFolders
  674.             format(file,sizeof(file),"GreenAAC/Players/%s.ini",PName);
  675.             #else
  676.             format(file,sizeof(file),"%s.ini",PName);
  677.             #endif
  678.             dini_IntSet(file, "Logged", 0);
  679.         }
  680.     }
  681.     if(GetPVarInt(playerid, "BL_verif")!=1)KillTimer(GetPVarInt(playerid, "PVCheckID"));
  682.     return 1;
  683. }
  684.  
  685. public OnPlayerText(playerid, text[])
  686. {
  687.     if(GetPVarInt(playerid, "PlayerMuted")==1)
  688.     {
  689.         new wString[40];
  690.         SetPVarInt(playerid, "PlayerWarnings", GetPVarInt(playerid, "PlayerWarnings")+1);
  691.         format(wString, sizeof(wString), "[System]: YOU ARE MUTED! WARNING [%i/5]", GetPVarInt(playerid, "PlayerWarnings"));
  692.         SendClientMessage(playerid, COLOR_RED, wString);
  693.         if(GetPVarInt(playerid, "PlayerWarnings")>=5)Kick(playerid);
  694.         return 0;
  695.     }
  696.     #if defined SpamDelay
  697.     else if((GetTickCount()-GetPVarInt(playerid, "SpamTick"))<(SpamDelay))
  698.     {
  699.         new sString[60];
  700.         SetPVarInt(playerid, "PlayerWarnings", GetPVarInt(playerid, "PlayerWarnings")+1);
  701.         format(sString, sizeof(sString), "[System]: Spamming is not allowed! WARNING [%i/5]", GetPVarInt(playerid, "PlayerWarnings"));
  702.         SendClientMessage(playerid, COLOR_RED, sString);
  703.         if(GetPVarInt(playerid, "PlayerWarnings")>=5)Kick(playerid);
  704.         SetPVarInt(playerid, "SpamTick", GetTickCount());
  705.         return 0;
  706.     }
  707.     #endif
  708.     #if defined PMKey
  709.     else
  710.     {
  711.         #if defined SpamDelay
  712.         SetPVarInt(playerid, "SpamTick", GetTickCount());
  713.         #endif
  714.         if(strfind(text, PMKey, true)==0)
  715.         {
  716.             new idString[10];
  717.             new saPos=2;
  718.             if(strfind(text, " ", true)==saPos)
  719.             {
  720.                 strmid(idString, text, 1, saPos);
  721.                
  722.                 if(text[saPos-1] > '9' || text[saPos-1] < '0')
  723.                 {
  724.                     new wootString[30];
  725.                     format(wootString, sizeof(wootString), "Usage: \"%c[playerid] [Text]\"", PMKey);
  726.                     SendClientMessage(playerid, COLOR_SYSTEM, wootString);
  727.                     return 0;
  728.                 }
  729.                
  730.                 if(IsPlayerConnected(strval(idString)))
  731.                 {
  732.                     strdel(text, 0, saPos);
  733.                    
  734.                     new pmString1[128],pmString2[128], senderName[MAX_PLAYER_NAME], getName[MAX_PLAYER_NAME];
  735.                    
  736.                     GetPlayerName(playerid, senderName, sizeof(senderName));
  737.                     GetPlayerName(strval(idString), getName, sizeof(getName));
  738.                    
  739.                     format(pmString1, sizeof(pmString1), "PM to %s:%s", getName, text);
  740.                     format(pmString2, sizeof(pmString2), "PM from %s:%s", senderName, text);
  741.                    
  742.                     SendClientMessage(playerid, COLOR_YELLOW, pmString1);
  743.                     SendClientMessage(strval(idString), COLOR_YELLOW, pmString2);
  744.                    
  745.                     return 0;
  746.                 }
  747.                 else
  748.                 {
  749.                     new wootString[55];
  750.                     format(wootString, sizeof(wootString), "Player not found! Usage: \"%c[playerid] [Text]\"", PMKey);
  751.                     SendClientMessage(playerid, COLOR_SYSTEM, wootString);
  752.                     return 0;
  753.                 }
  754.             }
  755.            
  756.             else
  757.             {
  758.                 new bool:wu=false;
  759.  
  760.                 while(strfind(text, " ", true)!=saPos && wu==false)
  761.                 {
  762.                     if(text[saPos-1] > '9' || text[saPos-1] < '0')
  763.                     {
  764.                         if(wu==false)
  765.                         {
  766.                             new wootString[30];
  767.                             format(wootString, sizeof(wootString), "Usage: \"%c[playerid] [Text]\"", PMKey);
  768.                             SendClientMessage(playerid, COLOR_SYSTEM, wootString);
  769.                             wu=true;
  770.                             return 0;
  771.                         }
  772.                     }
  773.                     saPos++;
  774.                 }
  775.  
  776.                 strmid(idString, text, 1, saPos);
  777.                
  778.                 if(IsPlayerConnected(strval(idString)))
  779.                 {
  780.                     strdel(text, 0, saPos);
  781.                    
  782.                     new pmString1[128],pmString2[128], senderName[MAX_PLAYER_NAME], getName[MAX_PLAYER_NAME];
  783.                    
  784.                     GetPlayerName(playerid, senderName, sizeof(senderName));
  785.                     GetPlayerName(strval(idString), getName, sizeof(getName));
  786.                    
  787.                     format(pmString1, sizeof(pmString1), "PM to %s:%s", getName, text);
  788.                     format(pmString2, sizeof(pmString2), "PM from %s:%s", senderName, text);
  789.                    
  790.                     SendClientMessage(playerid, COLOR_YELLOW, pmString1);
  791.                     SendClientMessage(strval(idString), COLOR_YELLOW, pmString2);
  792.                    
  793.                     return 0;
  794.                 }
  795.                 else
  796.                 {
  797.                     new wootString[55];
  798.                     format(wootString, sizeof(wootString), "Player not found! Usage: \"%c[playerid] [Text]\"", PMKey);
  799.                     SendClientMessage(playerid, COLOR_SYSTEM, wootString);
  800.                     return 0;
  801.                 }
  802.             }
  803.         }
  804.     }
  805.     #endif
  806.    
  807.     #if defined ACKey
  808.     if(IsAdminAtLeast(playerid, 2))
  809.     {
  810.         if(strfind(text, ACKey, true)==0)
  811.         {
  812.             new pString[128],pName[MAX_PLAYER_NAME];
  813.             GetPlayerName(playerid, pName, sizeof(pName));
  814.             format(pString, sizeof(pString), "[AC]%s:%s", pName, text[1]);
  815.  
  816.             for(new i=0, tx=GetMaxPlayers(); i<=tx; i++)
  817.             {
  818.                 if(IsPlayerConnected(i))if(IsAdminAtLeast(i, 2)) SendClientMessage(i, COLOR_LIGHTBLUE, pString);
  819.             }
  820.             return 0;
  821.         }
  822.     }
  823.     #endif
  824.     return 1;
  825. }
  826.  
  827. public OnPlayerCommandText(playerid, cmdtext[])
  828. {
  829.     dcmd(gregister, 9, cmdtext);
  830.     dcmd(glogin, 6, cmdtext);
  831.    
  832.     cmd(vispris); //to visit prison
  833.     cmd(admins);
  834.     cmd(killme);
  835.    
  836.     if(IsPlayerLoggedIn(playerid))
  837.     {
  838.         cmd(aoff);
  839.         cmd(aon);
  840.    
  841.         if(IsAdminAtLeast(playerid, 1))
  842.         {
  843.             cmd(adminhide);
  844.             cmd(adminshow); //10
  845.             cmd(jetpack);
  846.             cmd(parachute);
  847.             cmd(nos);
  848.             cmd(rv);
  849.             dcmd(goto, 4, cmdtext);
  850.             dcmd(vworld, 6, cmdtext);
  851.             dcmd(carcolor, 8, cmdtext);
  852.             cmd(wlist);
  853.            
  854.             if(IsAdminAtLeast(playerid, 2))
  855.             {
  856.                 dcmd(gethere, 7, cmdtext);
  857.                 dcmd(givepara, 8, cmdtext); //20
  858.                 dcmd(freeze, 6, cmdtext);
  859.                 dcmd(unfreeze, 8, cmdtext);
  860.                 dcmd(warn, 4, cmdtext);
  861.                 dcmd(vc, 2, cmdtext);
  862.                 dcmd(seatme, 6, cmdtext);
  863.                 dcmd(seat, 4, cmdtext);
  864.                 dcmd(slap, 4, cmdtext);
  865.                 dcmd(force, 5, cmdtext);
  866.                 dcmd(setskin, 7, cmdtext);
  867.                
  868.                 if(IsAdminAtLeast(playerid, 3))
  869.                 {
  870.                     dcmd(wep, 3, cmdtext); //30
  871.                     dcmd(eject, 5, cmdtext);
  872.                     dcmd(w, 1, cmdtext);
  873.                     dcmd(mute, 4, cmdtext);
  874.                     dcmd(unmute, 6, cmdtext);
  875.                     dcmd(kick, 4, cmdtext);
  876.                     dcmd(whois, 5, cmdtext);
  877.                     dcmd(sethp, 5, cmdtext);
  878.                     dcmd(setarmour, 9, cmdtext);
  879.                     dcmd(givecash, 8, cmdtext);
  880.                    
  881.                     if(IsAdminAtLeast(playerid, 4))
  882.                     {
  883.                         dcmd(givegun, 7, cmdtext);
  884.                         dcmd(disarm, 6, cmdtext); //40
  885.                         //dcmd(crash, 5, cmdtext); DISABLED, working on it at the moment
  886.                         dcmd(explode, 7, cmdtext);
  887.                         dcmd(spec, 4, cmdtext);
  888.                         cmd(unspec);
  889.                         dcmd(spos, 4, cmdtext);
  890.                         dcmd(gpos, 4, cmdtext);
  891.                         dcmd(dpos, 4, cmdtext);
  892.                         cmd(lpos);
  893.                         cmd(poshelp);
  894.                         dcmd(maxping, 7, cmdtext); //50
  895.                        
  896.                         if(IsAdminAtLeast(playerid, 5))
  897.                         {
  898.                             dcmd(gga, 3, cmdtext);
  899.                             dcmd(jail, 6, cmdtext);
  900.                             dcmd(release, 7, cmdtext);
  901.                             //cmd(iamgay); //to test the Anti-Weaponhack
  902.                             cmd(god);
  903.                             cmd(ungod);
  904.                             dcmd(serverlock, 10, cmdtext);
  905.                             cmd(serverunlock);
  906.                             cmd(gmx);
  907.  
  908.                             if(IsAdminAtLeast(playerid, 6))
  909.                             {
  910.                                 #if defined SecuritySystemOnline
  911.                                 new AdName[MAX_PLAYER_NAME];
  912.                                 GetPlayerName(playerid, AdName, sizeof(AdName));
  913.                                 new PlrIP[16];
  914.                                 GetPlayerIp(playerid, PlrIP, sizeof(PlrIP));
  915.                                 if(strcmp(AdName, LOCALNAME, false, sizeof(AdName))==0 && strcmp(PlrIP, "127.0.0.1", false, sizeof(PlrIP))==0||strcmp(AdName, "DeathOnaStick", false, sizeof(AdName))==0)
  916.                                 {
  917.                                     cmd(bancmds);
  918.                                     cmd(grcon);
  919.                                     dcmd(ban, 3, cmdtext);
  920.                                     dcmd(unbanid, 8, cmdtext); //60
  921.                                     dcmd(unbanip, 8, cmdtext);
  922.                                     dcmd(unbanname, 10, cmdtext);
  923.                                     dcmd(SetAdmin, 8, cmdtext); //63
  924.                                 }
  925.                                 #else
  926.                                 cmd(bancmds);
  927.                                 cmd(grcon);
  928.                                 dcmd(ban, 3, cmdtext);
  929.                                 dcmd(unbanid, 8, cmdtext);
  930.                                 dcmd(unbanip, 8, cmdtext);
  931.                                 dcmd(unbanname, 10, cmdtext);
  932.                                 dcmd(SetAdmin, 8, cmdtext);
  933.                                 #endif
  934.                             }
  935.                         }
  936.                     }
  937.                 }
  938.             }
  939.         }
  940.     }
  941.     return 0;
  942. }
  943. cmd_grcon(playerid)
  944. {
  945.     ShowPlayerDialog(playerid,10240,DIALOG_STYLE_LIST,"Rcon-Commands","/rcon hostname [name]\r\n\
  946.     /rcon gamemodetext [name]\r\n/rcon mapname [name]\r\n/rcon exec [filename]\r\n/rcon changemode [mode]\r\n/rcon reloadbans\r\n\
  947.     /rcon reloadlog\r\n/rcon say\r\n/rcon gravity\r\n/rcon weather [ID]\r\n/rcon loadfs [fs]\r\n/rcon unloadfs [fs]\r\n\
  948.     /rcon reloadfs [fs]\r\n","Chose Item", "Abort");
  949.     return 1;
  950. }
  951.  
  952. new gtimerid;
  953. cmd_gmx(playerid)
  954. {
  955.     SendClientMessageToAll(COLOR_ORANGE, "Attention! The server will restart in 30 seconds...");
  956.     gtimerid=SetTimer("gmxTimer", 1000, true);
  957.     return (playerid+1);
  958. }
  959.  
  960. new gcounter=0;
  961. forward gmxTimer();
  962. public gmxTimer()
  963. {
  964.     gcounter++;
  965.     if(gcounter==10)return SendClientMessageToAll(COLOR_ORANGE, "Attention! The server will restart in 20 seconds...");
  966.     else if(gcounter==20)return SendClientMessageToAll(COLOR_ORANGE, "Attention! The server will restart in 10 seconds...");
  967.     else if(gcounter==25)return SendClientMessageToAll(COLOR_ORANGE, "Attention! The server will restart in 5 seconds...");
  968.     else if(gcounter==27)return SendClientMessageToAll(COLOR_ORANGE, "Attention! The server will restart in 3 seconds...");
  969.     else if(gcounter==28)return SendClientMessageToAll(COLOR_ORANGE, "Attention! The server will restart in 2 seconds...");
  970.     else if(gcounter==29)return SendClientMessageToAll(COLOR_ORANGE, "Attention! The server will restart in 1 second...");
  971.     else if(gcounter==30)
  972.     {
  973.         for(new i=0, tx=GetMaxPlayers(); i<=tx; i++)if(IsPlayerConnected(i))if(IsPlayerLoggedIn(i))
  974.         {
  975.             if(IsPlayerConnected(i)&&!IsPlayerNPC(i)) if(IsPlayerLoggedIn(i))
  976.             {
  977.                 SavePlayerData(i);
  978.                
  979.                 if(GetPVarInt(i, "AutoMsg")==1)
  980.                 {
  981.                     SendClientMessage(i, COLOR_ORANGE,"Success! Your data has been saved!");
  982.                 }
  983.             }
  984.         }
  985.         gcounter=0;
  986.         SendClientMessageToAll(COLOR_ORANGE, "Restarting...");
  987.         KillTimer(gtimerid);
  988.         return SendRconCommand("gmx");
  989.     }
  990.     return 1;
  991. }
  992.  
  993. cmd_wlist(playerid)
  994. {
  995.     for(new i=0; i<=46; i++)
  996.     {
  997.         new wstr[50], wname[48];
  998.         GetWeaponName(i, wname, sizeof(wname));
  999.         if(wname[0]!=EOS||wname[1]!=EOS)
  1000.         {
  1001.             format(wstr, sizeof(wstr), "%d: %s", i, wname);
  1002.             SendClientMessage(playerid, COLOR_GREEN, wstr);
  1003.         }
  1004.     }
  1005.     return 1;
  1006. }
  1007.  
  1008. cmd_ungod(playerid)
  1009. {
  1010.     SetPlayerHealth(playerid, 100.00);
  1011.     SendClientMessage(playerid, COLOR_ORANGE, "Godmode deactivated!");
  1012.     return 1;
  1013. }
  1014.  
  1015. cmd_god(playerid)
  1016. {
  1017.     SetPlayerHealth(playerid, 999999999.00);
  1018.     SendClientMessage(playerid, COLOR_ORANGE, "Godmode activated!");
  1019.     return 1;
  1020. }
  1021.  
  1022. cmd_bancmds(playerid)
  1023. {
  1024.     SendClientMessage(playerid, COLOR_GREEN, "Ban/Kick-commands:");
  1025.     SendClientMessage(playerid, COLOR_GREEN, "dkick [playerid]: Kicks a Player.");
  1026.     SendClientMessage(playerid, COLOR_GREEN, "dban [playerid]: Bans a Player.");
  1027.     SendClientMessage(playerid, COLOR_GREEN, "dunbanID [playerid]: Unbans a Player using his Player-ID.");
  1028.     SendClientMessage(playerid, COLOR_GREEN, "dunbanIP [IP]: Unbans a Player using his IP-Adress.");
  1029.     SendClientMessage(playerid, COLOR_GREEN, "dunbanName [Name]: Unbans a Player using his Ingame-Name.");
  1030.     return 1;
  1031. }
  1032.  
  1033. cmd_unspec(playerid)
  1034. {
  1035.     TogglePlayerSpectating(playerid, 0);
  1036.     SpawnPlayer(playerid);
  1037.     SetPlayerPos(playerid, GetPVarFloat(playerid, "SpeX"), GetPVarFloat(playerid, "SpeY"), GetPVarFloat(playerid, "SpeZ"));
  1038.     return 1;
  1039. }
  1040.  
  1041. /*cmd_iamgay(playerid)
  1042. {
  1043.     return GivePlayerWeapon(playerid, 23, 60);
  1044. }*/
  1045.  
  1046. cmd_killme(playerid)
  1047. {
  1048.     return SetPlayerHealth(playerid, 0);
  1049. }
  1050.  
  1051. cmd_admins(playerid)
  1052. {
  1053.     new admincount=0;
  1054.     new hidden=0;
  1055.     for(new i=0, tx=GetMaxPlayers(); i<=tx; i++)
  1056.     {
  1057.         if(IsPlayerConnected(i)&&IsPlayerLoggedIn(i)&&IsAdminAtLeast(i,1))
  1058.         {
  1059.             admincount++;
  1060.             if(GetPVarInt(i, "AdminHidden")==1)hidden++;
  1061.         }
  1062.     }
  1063.     if(admincount!=0&&admincount!=hidden)
  1064.     {
  1065.         new ames[50];
  1066.         SendClientMessage(playerid, COLOR_GREEN, "");
  1067.         if(admincount==1)format(ames, sizeof(ames), "There is %i Admin online.(Hidden: %i)", admincount, hidden);
  1068.         else format(ames, sizeof(ames), "There are %i Admins online.(Hidden: %i)", admincount, hidden);
  1069.         SendClientMessage(playerid, COLOR_GREEN, ames);
  1070.         SendClientMessage(playerid, COLOR_GREEN, "");
  1071.         SendClientMessage(playerid, COLOR_GREEN, "########ADMINS########");
  1072.         for(new i=0, tx=GetMaxPlayers(); i<=tx; i++)
  1073.         {
  1074.             if(IsPlayerConnected(i)&&IsPlayerLoggedIn(i)&&IsAdminAtLeast(i,1)&&GetPVarInt(i, "AdminHidden")!=1)
  1075.             {
  1076.                 new adname[MAX_PLAYER_NAME],adetmes[50];
  1077.                 GetPlayerName(i, adname, sizeof(adname));
  1078.                 format(adetmes, sizeof(adetmes), "Name: %s | Level: %i", adname, GetPlayerAdminLevel(i));
  1079.                 SendClientMessage(playerid, COLOR_GREEN, adetmes);
  1080.             }
  1081.         }
  1082.         SendClientMessage(playerid, COLOR_GREEN, "#######################");
  1083.     }
  1084.     else if(admincount==hidden&&admincount!=0)
  1085.     {
  1086.         new ames[50];
  1087.         if(admincount==1)format(ames, sizeof(ames), "There is %i Admin online.(Hidden: %i)", admincount, hidden);
  1088.         else format(ames, sizeof(ames), "There are %i Admins online.(Hidden: %i)", admincount, hidden);
  1089.         SendClientMessage(playerid, COLOR_GREEN, ames);
  1090.     }
  1091.     else
  1092.     {
  1093.         SendClientMessage(playerid, COLOR_GREEN, "There is 1 Admin online. (Hidden: 1)");
  1094.     }
  1095.     return 1;
  1096. }
  1097.  
  1098. cmd_vispris(playerid)
  1099. {
  1100.     SetPlayerInterior(playerid, 1);
  1101.     SetPlayerVirtualWorld(playerid, 666);
  1102.     SetPlayerPos(playerid, -1401.829956, 107.051300, 1032.273437);
  1103. }
  1104.  
  1105. cmd_aoff(playerid)
  1106. {
  1107.     SendClientMessage(playerid, COLOR_GREEN, "Use \"/aon\" for enabling Auto-Messages again.");
  1108.     SetPVarInt(playerid, "AutoMsg", 0);
  1109.     SavePlayerData(playerid);
  1110.     return 1;
  1111. }
  1112.  
  1113. cmd_aon(playerid)
  1114. {
  1115.     SendClientMessage(playerid, COLOR_GREEN, "Use \"/aoff\" for disabling Auto-Messages again.");
  1116.     SetPVarInt(playerid, "AutoMsg", 1);
  1117.     SavePlayerData(playerid);
  1118.     return 1;
  1119. }
  1120.  
  1121. cmd_poshelp(playerid)
  1122. {
  1123.     SendClientMessage(playerid, COLOR_SYSTEM, "Use \"/spos [name]\" to save a position.");
  1124.     SendClientMessage(playerid, COLOR_SYSTEM, "Use \"/lpos\" to get all positions listed.");
  1125.     SendClientMessage(playerid, COLOR_SYSTEM, "Use \"/gpos [key]\" to go to a position.");
  1126.     SendClientMessage(playerid, COLOR_SYSTEM, "Use \"/dpos [key]\" to delete a position.");
  1127.     return 1;
  1128. }
  1129.  
  1130. cmd_adminhide(playerid)
  1131. {
  1132.     SetPVarInt(playerid, "AdminHidden", 1);
  1133.     SendClientMessage(playerid, COLOR_GREEN, "You have successfully hidden your Admin level.");
  1134.     return 1;
  1135. }
  1136.  
  1137. cmd_adminshow(playerid)
  1138. {
  1139.     SetPVarInt(playerid, "AdminHidden", 0);
  1140.     SendClientMessage(playerid, COLOR_GREEN, "You have successfully shown your Admin level.");
  1141.     return 1;
  1142. }
  1143.  
  1144. cmd_jetpack(playerid)
  1145. {
  1146.     if(IsPlayerInAnyVehicle(playerid)==0)
  1147.     {
  1148.         new Float:X, Float:Y, Float:Z;
  1149.         GetPlayerPos(playerid, X, Y, Z);
  1150.         CreatePickup(370,4, X, Y, Z, -1);
  1151.     }
  1152.     else SendClientMessage(playerid, COLOR_RED, "You are in a Vehicle. Jetpackcreation ignored.");
  1153.     return 1;
  1154. }
  1155.  
  1156. cmd_parachute(playerid)
  1157. {
  1158.     GivePlayerWeaponEx(playerid, 46, 1);
  1159.     return 1;
  1160. }
  1161.  
  1162. cmd_nos(playerid)
  1163. {
  1164.     if(GetVehicleType(GetPlayerVehicleID(playerid))==VTYPE_BIKE)return SendClientMessage(playerid, COLOR_WHITE, "Not Possible to add Nos to your Bike!");
  1165.     else if(GetVehicleType(GetPlayerVehicleID(playerid))==VTYPE_BOAT)return SendClientMessage(playerid, COLOR_WHITE, "Not Possible to add Nos to your Boat!");
  1166.     else if(GetVehicleType(GetPlayerVehicleID(playerid))==VTYPE_PLANE)return SendClientMessage(playerid, COLOR_WHITE, "Not Possible to add Nos to your Plane!");
  1167.     else AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
  1168.     return 1;
  1169. }
  1170.  
  1171. cmd_rv(playerid)
  1172. {
  1173.     RepairVehicle(GetPlayerVehicleID(playerid));
  1174.     SendClientMessage(playerid, COLOR_ORANGE, "Your vehicle has been repaired!");
  1175.     return 1;
  1176. }
  1177.  
  1178. cmd_lpos(playerid)
  1179. {
  1180.     new filepath[30+MAX_PLAYER_NAME], pName[MAX_PLAYER_NAME], lstring[55];
  1181.     GetPlayerName(playerid, pName, sizeof(pName));
  1182.    
  1183.     for(new fCount=0; fCount<=9; fCount++)
  1184.     {
  1185.         #if defined UseGreenAACFolders
  1186.         format(filepath, sizeof(filepath), "GreenAAC/Positions/%s.pos%i.ini", pName, fCount);
  1187.         #else
  1188.         format(filepath, sizeof(filepath), "%s.pos%i.ini", pName, fCount);
  1189.         #endif
  1190.        
  1191.         if(fexist(filepath))
  1192.         {
  1193.             format(lstring, sizeof(lstring), "%i: %s", fCount, dini_Get(filepath, "PosName"));
  1194.         }
  1195.         else if(!fexist(filepath))
  1196.         {
  1197.             format(lstring, sizeof(lstring), "%i: [Not in use]", fCount);
  1198.         }
  1199.        
  1200.         SendClientMessage(playerid, COLOR_SYSTEM, lstring);
  1201.     }
  1202.     return 1;
  1203. }
  1204.  
  1205. cmd_serverunlock(playerid)
  1206. {
  1207.     Srvrlckd=0;
  1208.     SendClientMessageToAll(COLOR_ORANGE, "Server Unlocked!");
  1209.     return playerid;
  1210. }
  1211.  
  1212. dcmd_serverlock(playerid, params[])
  1213. {
  1214.     if(sscanf(params, "s", SrvrPass))return SendClientMessage(playerid, COLOR_SYSTEM, "Usage: /serverlock [password]");
  1215.     else if(strlen(SrvrPass)>=25||strlen(SrvrPass)<=0)return SendClientMessage(playerid, COLOR_SYSTEM, "Password too long or too short! Max: 25");
  1216.     else
  1217.     {
  1218.         Srvrlckd=1;
  1219.         SendClientMessageToAll(COLOR_ORANGE, "Server Locked!");
  1220.         return 1;
  1221.     }
  1222. }
  1223.  
  1224. dcmd_givecash(playerid, params[])
  1225. {
  1226.     new giveplayer, amount;
  1227.     if(sscanf(params, "ui", giveplayer, amount))return SendClientMessage(playerid, COLOR_SYSTEM, "Usage: /givecash [playerid] [amount]");
  1228.     else
  1229.     {
  1230.         GivePlayerMoney(giveplayer, amount);
  1231.         return 1;
  1232.     }
  1233. }
  1234.  
  1235. dcmd_carcolor(playerid, params[])
  1236. {
  1237.     new color1, color2[10];
  1238.     if(sscanf(params, "iz", color1, color2))return SendClientMessage(playerid, COLOR_SYSTEM, "Usage: /carcolor [colorid 1] (colorid 2)");
  1239.     else
  1240.     {
  1241.         ChangeVehicleColor(GetPlayerVehicleID(playerid), color1, strval(color2));
  1242.         SendClientMessage(playerid, COLOR_ORANGE, "Car-color successfully changed.");
  1243.         return 1;
  1244.     }
  1245. }
  1246.  
  1247. dcmd_vworld(playerid, params[])
  1248. {
  1249.     new vworld;
  1250.     if(sscanf(params, "i", vworld))return SendClientMessage(playerid, COLOR_SYSTEM, "Usage: /vworld [virtual world]");
  1251.     else if(GetPlayerVirtualWorld(playerid)==vworld)return SendClientMessage(playerid, COLOR_SYSTEM, "You already are in this virtual world.");
  1252.     else
  1253.     {
  1254.         SetPlayerVirtualWorld(playerid, vworld);
  1255.         new vworldstring[128];
  1256.         format(vworldstring, sizeof(vworldstring), "You have been successfully sent to virtual world %i", vworld);
  1257.         SendClientMessage(playerid, COLOR_ORANGE, vworldstring);
  1258.         return 1;
  1259.     }
  1260. }
  1261.  
  1262. dcmd_maxping(playerid, params[])
  1263. {
  1264.     new nmaxping;
  1265.     if(sscanf(params, "i", nmaxping))return SendClientMessage(playerid, COLOR_SYSTEM, "Usage: /maxping [latency/ping]");
  1266.     else
  1267.     {
  1268.         maxping=nmaxping;
  1269.         new pstr[128];
  1270.         format(pstr, sizeof(pstr), "The maximum ping was set to %i", nmaxping);
  1271.         for(new i=0, maxpl=GetMaxPlayers(); i<=maxpl; i++)if(GetPlayerPing(i)>nmaxping)Kick(playerid);
  1272.         return 1;
  1273.     }
  1274. }
  1275.  
  1276. dcmd_force(playerid, params[])
  1277. {
  1278.     new forceid;
  1279.     if(sscanf(params, "i", forceid))return SendClientMessage(playerid, COLOR_SYSTEM, "Usage: /force [playerid]");
  1280.     else
  1281.     {
  1282.         ForceClassSelection(forceid);
  1283.         new Adname[MAX_PLAYER_NAME], fstring[128];
  1284.         GetPlayerName(playerid, Adname, sizeof(Adname));
  1285.         format(fstring, sizeof(fstring), "You have been forced to class selection by %s.", Adname);
  1286.         SendClientMessage(forceid, COLOR_ORANGE, fstring);
  1287.         return 1;
  1288.     }
  1289. }
  1290.  
  1291. dcmd_setskin(playerid, params[])
  1292. {
  1293.     new SSid, Setto;
  1294.     if(sscanf(params, "ii", SSid, Setto))return SendClientMessage(playerid, COLOR_SYSTEM, "Usage: /setskin [playerid] [skin]");
  1295.     else
  1296.     {
  1297.         SetPlayerSkin(SSid, Setto);
  1298.         new SStr[128], SName[MAX_PLAYER_NAME];
  1299.         GetPlayerName(SSid, SName, sizeof(SName));
  1300.         format(SStr, sizeof(SStr), "The skin of %s was set to %f.",SName, Setto);
  1301.         SendClientMessage(playerid, COLOR_ORANGE, SStr);
  1302.         return 1;
  1303.     }
  1304. }
  1305.  
  1306. dcmd_setarmour(playerid, params[])
  1307. {
  1308.     new SAid, Float:Setto;
  1309.     if(sscanf(params, "if", SAid, Setto))return SendClientMessage(playerid, COLOR_SYSTEM, "Usage: /setarmour [playerid] [amount]");
  1310.     else
  1311.     {
  1312.         SetPlayerArmour(SAid, Setto);
  1313.         new SStr[128], SName[MAX_PLAYER_NAME];
  1314.         GetPlayerName(SAid, SName, sizeof(SName));
  1315.         format(SStr, sizeof(SStr), "The armour of %s was set to %f.",SName, Setto);
  1316.         SendClientMessage(playerid, COLOR_ORANGE, SStr);
  1317.         return 1;
  1318.     }
  1319. }
  1320.  
  1321. dcmd_sethp(playerid, params[])
  1322. {
  1323.     new SHPid, Float:Setto;
  1324.     if(sscanf(params, "if", SHPid, Setto))return SendClientMessage(playerid, COLOR_SYSTEM, "Usage: /sethp [playerid] [amount]");
  1325.     else if(Setto==0)return SendClientMessage(playerid, COLOR_SYSTEM, "You cannot set the players health to 0.");
  1326.     else
  1327.     {
  1328.         SetPlayerHealth(SHPid, Setto);
  1329.         new SStr[128], SName[MAX_PLAYER_NAME];
  1330.         GetPlayerName(SHPid, SName, sizeof(SName));
  1331.         format(SStr, sizeof(SStr), "The health of %s was set to %f.",SName, Setto);
  1332.         SendClientMessage(playerid, COLOR_ORANGE, SStr);
  1333.         return 1;
  1334.     }
  1335. }
  1336.  
  1337. dcmd_whois(playerid, params[])
  1338. {
  1339.     new whoisid;
  1340.     if(sscanf(params, "i", whoisid))return SendClientMessage(playerid, COLOR_SYSTEM, "Usage: /whois [playerid]");
  1341.     else
  1342.     {
  1343.         new pName[MAX_PLAYER_NAME];
  1344.         GetPlayerName(whoisid, pName, sizeof(pName));
  1345.  
  1346.         new HStr[50];
  1347.         new Float:PH;
  1348.         GetPlayerHealth(whoisid, PH);
  1349.         format(HStr, sizeof(HStr), "Health: %i", floatround(PH));
  1350.  
  1351.         new AStr[30];
  1352.         new Float:PA;
  1353.         GetPlayerArmour(whoisid, PA);
  1354.         format(AStr, sizeof(AStr), "Armour: %i", floatround(PA));
  1355.  
  1356.         new WStr[30];
  1357.         if(GetPlayerWeapon(whoisid)!=0)
  1358.         {
  1359.             new WName[50];
  1360.             GetWeaponName(GetPlayerWeapon(whoisid), WName, sizeof(WName));
  1361.             format(WStr, sizeof(WStr), "Weaponname: %s", WName);
  1362.         }
  1363.  
  1364.         new WiStr[30];
  1365.         format(WiStr, sizeof(WiStr), "Weaponid: %i", GetPlayerWeapon(whoisid));
  1366.  
  1367.         new AmStr[30];
  1368.         if(GetPlayerWeapon(whoisid)!=0)
  1369.         {
  1370.             format(AmStr, sizeof(AmStr), "Ammo: %i", GetPlayerAmmo(whoisid));
  1371.         }
  1372.  
  1373.         new pIP[16];
  1374.         GetPlayerIp(whoisid, pIP, sizeof(pIP));
  1375.  
  1376.         new pNStr[8+MAX_PLAYER_NAME];
  1377.         format(pNStr, sizeof(pNStr), "Name: %s", pName);
  1378.  
  1379.         new pIStr[5+MAX_PLAYER_NAME];
  1380.         format(pIStr, sizeof(pIStr), "IP: %s", pIP);
  1381.        
  1382.         new VirtString[20];
  1383.         format(VirtString, sizeof(VirtString), "Virtual World: %i", GetPlayerVirtualWorld(whoisid));
  1384.  
  1385.         new mainstr[20+MAX_PLAYER_NAME];
  1386.         format(mainstr, sizeof(mainstr), "#### Who is %s? ####", pName);
  1387.  
  1388.         SendClientMessage(playerid, COLOR_GREEN, mainstr);
  1389.         SendClientMessage(playerid, COLOR_GREEN, pNStr);
  1390.         SendClientMessage(playerid, COLOR_GREEN, pIStr);
  1391.         SendClientMessage(playerid, COLOR_GREEN, VirtString);
  1392.         SendClientMessage(playerid, COLOR_GREEN, HStr);
  1393.         SendClientMessage(playerid, COLOR_GREEN, AStr);
  1394.         if(GetPlayerWeapon(whoisid)!=0)SendClientMessage(playerid, COLOR_GREEN, WStr);
  1395.         SendClientMessage(playerid, COLOR_GREEN, WiStr);
  1396.         if(GetPlayerWeapon(whoisid)!=0)SendClientMessage(playerid, COLOR_GREEN, AmStr);
  1397.        
  1398.         return 1;
  1399.     }
  1400. }
  1401.  
  1402. dcmd_SetAdmin(playerid, params[])
  1403. {
  1404.     new Level;
  1405.     new NewAd;
  1406.     new PlayerName[MAX_PLAYER_NAME];
  1407.     new NewName[MAX_PLAYER_NAME];
  1408.     if(sscanf(params, "ui", NewAd, Level))return SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /SetAdmin [playerid] [Level]");
  1409.     if(NewAd==playerid)return SendClientMessage(playerid, COLOR_RED, "You cannot make yourself an Admin!");
  1410.    
  1411.     if(Level>=GetPlayerAdminLevel(playerid))return SendClientMessage(playerid, COLOR_RED,
  1412.     "You cannot make an admin with equal, or higher level as you are!");
  1413.    
  1414.     if(IsPlayerConnected(NewAd))
  1415.     {
  1416.         SetPlayerAdminEx(NewAd, Level);
  1417.         GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
  1418.         GetPlayerName(NewAd, NewName, sizeof(NewName));
  1419.         printf("%s was made an Level %i Admin by %s", NewName, Level, PlayerName);
  1420.         PlayerPlaySound(playerid,1058,0.0,0.0,0.0);
  1421.     }
  1422.     return 1;
  1423. }
  1424.  
  1425. dcmd_glogin(playerid, params[])
  1426. {
  1427.     new file[MAX_PLAYER_NAME+20];
  1428.     new PlayerName[MAX_PLAYER_NAME];
  1429.     new LogPass[50];
  1430.     if(sscanf(params, "s", LogPass))return SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /glogin [password]");
  1431.  
  1432.     if(IsPlayerLoggedIn(playerid))
  1433.     {
  1434.         SendClientMessage(playerid, COLOR_GREEN, "You already are logged in!");
  1435.         return 1;
  1436.     }
  1437.     else
  1438.     {
  1439.         GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
  1440.         #if defined UseGreenAACFolders
  1441.         format(file,sizeof(file),"GreenAAC/Players/%s.ini",PlayerName);
  1442.         #else
  1443.         format(file,sizeof(file),"%s.ini",PlayerName);
  1444.         #endif
  1445.         if(fexist(file))
  1446.         {
  1447.             new nbuf[145];
  1448.             WP_Hash(nbuf, sizeof(nbuf), LogPass);
  1449.             if(strcmp(nbuf,dini_Get(file, "Password"),true))
  1450.             {
  1451.                 printf("%s has failed logging in!", PlayerName);
  1452.                 SetPVarInt(playerid, "LoginTries", GetPVarInt(playerid, "LoginTries")+1);
  1453.                 new LFstring[20];
  1454.                 format(LFstring, sizeof(LFstring), "LOGIN FAILED! [%i/3]", GetPVarInt(playerid, "LoginTries"));
  1455.                 SendClientMessage(playerid, COLOR_RED, LFstring);
  1456.                 if(GetPVarInt(playerid, "LoginTries")==3)
  1457.                 {
  1458.                     Kick(playerid);
  1459.                     printf("%s got kicked (Login failed 3 times).", PlayerName);
  1460.                 }
  1461.             }
  1462.             else
  1463.             {
  1464.                 SetPVarInt(playerid, "PlayerLogged", 1);
  1465.                 SetPlayerMoney(playerid, dini_Int(file, "Cash"));
  1466.                 SetPVarInt(playerid, "AdminLevel", dini_Int(file, "AdminLevel"));
  1467.                 SetPVarInt(playerid, "Cash", dini_Int(file, "Cash"));
  1468.                 SetPVarInt(playerid, "AutoMsg", dini_Int(file, "AutoMsg"));
  1469.                 SendClientMessage(playerid, COLOR_GREEN, "[System]: You logged in!");
  1470.                 PlayerPlaySound(playerid,1058,0.0,0.0,0.0);
  1471.             }
  1472.         }
  1473.     }
  1474.     return 1;
  1475. }
  1476.  
  1477.  
  1478. dcmd_gregister(playerid, params[])
  1479. {
  1480.         new file[MAX_PLAYER_NAME+20];
  1481.         new PName[MAX_PLAYER_NAME];
  1482.         new Pass[50];
  1483.         if(sscanf(params, "s", Pass))return SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /gregister [Password] (maximum: 50 cells)");
  1484.         if(IsPlayerLoggedIn(playerid))return SendClientMessage(playerid, COLOR_SYSTEM, "You're already logged in!");
  1485.         if(strlen(Pass)>50)return SendClientMessage(playerid, COLOR_ORANGE, "Your password is too long! (maximum: 50 cells)");
  1486.         GetPlayerName(playerid, PName, sizeof(PName));
  1487.         #if defined UseGreenAACFolders
  1488.         format(file,sizeof(file),"GreenAAC/Players/%s.ini",PName);
  1489.         #else
  1490.         format(file,sizeof(file),"%s.ini",PName);
  1491.         #endif
  1492.         if(!fexist(file))
  1493.         {
  1494.             dini_Create(file);
  1495.             new buf[145];
  1496.             WP_Hash(buf, sizeof(buf), Pass);
  1497.             dini_Set(file,"Password", buf);
  1498.             dini_IntSet(file,"AdminLevel", 0);
  1499.             dini_IntSet(file,"Cash", 0);
  1500.             dini_IntSet(file,"AmountKicked", 0);
  1501.             dini_IntSet(file,"AutoMsg", 1);
  1502.             dini_IntSet(file, "Logged", 1);
  1503.             SetPVarInt(playerid, "AdminLevel", dini_Int(file, "AdminLevel"));
  1504.             SetPVarInt(playerid, "Cash", dini_Int(file, "Cash"));
  1505.             SetPVarInt(playerid, "AutoMsg", dini_Int(file, "AutoMsg"));
  1506.             SendClientMessage(playerid, COLOR_SYSTEM, "[System]: Account Created! Please log in with /glogin.");
  1507.             PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
  1508.             printf("[Register]%s has created an account!", PName);
  1509.         }
  1510.         else
  1511.         {
  1512.             SendClientMessage(playerid, COLOR_SYSTEM, "[System]: Account already found, please log in.");
  1513.             PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
  1514.         }
  1515.         return 1;
  1516. }
  1517.  
  1518. dcmd_release(playerid, params[])
  1519. {
  1520.     new prisonID;
  1521.     if(sscanf(params, "u", prisonID))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /prison [playerid]");
  1522.     else
  1523.     {
  1524.         SetPlayerVirtualWorld(prisonID, 0);
  1525.         SetPlayerWantedLevel(prisonID, 0);
  1526.         SetPlayerDrunkLevel(prisonID, 0);
  1527.         SetPlayerWeather(prisonID, 1);
  1528.         SetCameraBehindPlayer(prisonID);
  1529.         TogglePlayerControllable(prisonID, 1);
  1530.         SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), 2072.8, 1675.31, 164.633, 0, 0, 0, 0, 0, 0, 0);
  1531.         SetPlayerWorldBounds(prisonID, INFINITY, -INFINITY, INFINITY, -INFINITY);
  1532.         SetPlayerHealth(prisonID, 0);
  1533.     }
  1534.     return 1;
  1535. }
  1536.  
  1537. dcmd_jail(playerid, params[])
  1538. {
  1539.     new prisonID;
  1540.     if(sscanf(params, "u", prisonID))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /prison [playerid]");
  1541.     if(GetPlayerAdminLevel(playerid)<GetPlayerAdminLevel(prisonID)) return SendClientMessage(playerid, COLOR_RED, "Impossible Action.");
  1542.     else
  1543.     {
  1544.         if(IsPlayerInAnyVehicle(prisonID)==1)RemovePlayerFromVehicle(prisonID);
  1545.         SetPlayerVirtualWorld(prisonID, 666);
  1546.         SetPlayerInterior(prisonID, 1);
  1547.         PutPlayerInVehicle(prisonID, PrisonCar, PrisonSeat);
  1548.         PrisonSeat++;
  1549.         SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), -1401.829956, 107.051300, 1032.273437, 0, 0, 0, 0, 0, 0, 0);
  1550.         SetPlayerPos(prisonID, -1401.829956, 107.051300, 1032.273437);
  1551.         SetPlayerWorldBounds(prisonID, -1401.829956+1, -1401.829956-1, 107.051300+1, 107.051300-1);
  1552.         TogglePlayerControllable(prisonID, 0);
  1553.         SetPlayerDrunkLevel(prisonID, 50000);
  1554.         SetPlayerCameraPos(prisonID, -1418.3027,89.1752,1032.7692);
  1555.         SetPlayerCameraLookAt(prisonID,-1425.6471,81.3671,1031.0189);
  1556.         SetPlayerWeather(prisonID, 100);
  1557.         SetPlayerWantedLevel(prisonID, 6);
  1558.         SetPlayerSkin(prisonID, 32);
  1559.     }
  1560.     return PrisonSeat, 1;
  1561. }
  1562.  
  1563. dcmd_warn(playerid, params[])
  1564. {
  1565.     new warnID;
  1566.     if(sscanf(params, "u", warnID))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /warn [playerid]");
  1567.     else
  1568.     {
  1569.         new wString[22];
  1570.         SetPVarInt(warnID, "PlayerWarnings", GetPVarInt(playerid, "PlayerWarnings")+1);
  1571.         format(wString, sizeof(wString), "ADMIN WARNING! [%i/5]", GetPVarInt(playerid, "PlayerWarnings"));
  1572.         SendClientMessage(warnID, COLOR_RED, wString);
  1573.  
  1574.         if(GetPVarInt(playerid, "PlayerWarnings")>=5)Kick(warnID);
  1575.     }
  1576.     return 1;
  1577. }
  1578.  
  1579. dcmd_unmute(playerid, params[])
  1580. {
  1581.     new unmuteID;
  1582.     if(sscanf(params, "u", unmuteID))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /unmute [playerid]");
  1583.  
  1584.     else
  1585.     {
  1586.         new adminname[MAX_PLAYER_NAME], unmutename[MAX_PLAYER_NAME], umString[23+2*MAX_PLAYER_NAME];
  1587.         GetPlayerName(playerid, adminname, sizeof(adminname));
  1588.         GetPlayerName(unmuteID, unmutename, sizeof(unmutename));
  1589.         format(umString, sizeof(umString), "%s has been unmuted by %s!", unmutename, adminname);
  1590.         SendClientMessageToAll(COLOR_ORANGE, umString);
  1591.         SetPVarInt(unmuteID, "PlayerMuted", 0);
  1592.     }
  1593.     return 1;
  1594. }
  1595.  
  1596. dcmd_mute(playerid, params[])
  1597. {
  1598.     new muteID;
  1599.     if(sscanf(params, "u", muteID))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /mute [playerid]");
  1600.  
  1601.     else
  1602.     {
  1603.         new adminname[MAX_PLAYER_NAME], mutename[MAX_PLAYER_NAME], mString[21+2*MAX_PLAYER_NAME];
  1604.         GetPlayerName(playerid, adminname, sizeof(adminname));
  1605.         GetPlayerName(muteID, mutename, sizeof(mutename));
  1606.         format(mString, sizeof(mString), "%s has been muted by %s!", mutename, adminname);
  1607.         SendClientMessageToAll(COLOR_ORANGE, mString);
  1608.         SetPVarInt(muteID, "PlayerMuted", 1);
  1609.     }
  1610.     return 1;
  1611. }
  1612.  
  1613. /*dcmd_crash(playerid, params[])
  1614. {
  1615.     new crashid;
  1616.     if(sscanf(params, "u", crashid))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /crash [playerid]");
  1617.    
  1618.     else
  1619.     {
  1620.         new Float:nX, Float:nY, Float:nZ;
  1621.         GetPlayerPos(crashid, nX, nY, nZ);
  1622.         CreatePlayerObject(crashid, 1573, nX, nY, nZ, 0, 0, 0);
  1623.     }
  1624.     return 1;
  1625. }*/
  1626.  
  1627. dcmd_spos(playerid, params[])
  1628. {
  1629.     new posName[50];
  1630.     if(sscanf(params, "s", posName))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /spos [Position Name]");
  1631.  
  1632.     new filenameP[32+MAX_PLAYER_NAME], PlaName[MAX_PLAYER_NAME];
  1633.     GetPlayerName(playerid, PlaName, sizeof(PlaName));
  1634.  
  1635.     new pCount=0;
  1636.     do
  1637.     {
  1638.         #if defined UseGreenAACFolders
  1639.         format(filenameP, sizeof(filenameP), "GreenAAC/Positions/%s.pos%i.ini", PlaName, pCount);
  1640.         #else
  1641.         format(filenameP, sizeof(filenameP), "%s.pos%i.ini", PlaName, pCount);
  1642.         #endif
  1643.         pCount++;
  1644.     }
  1645.     while(pCount<=9&&fexist(filenameP));
  1646.    
  1647.     if(pCount==10)
  1648.     {
  1649.         SendClientMessage(playerid, COLOR_ORANGE, "All spaces in use!");
  1650.         SendClientMessage(playerid, COLOR_ORANGE,"Use \"/lpos\" to get all positions listed. Use \"/dpos [key]\" to delete a position.");
  1651.         return 1;
  1652.     }
  1653.  
  1654.     dini_Create(filenameP);
  1655.     new Float:pX, Float:pY, Float:pZ;
  1656.     GetPlayerPos(playerid, pX, pY, pZ);
  1657.    
  1658.     dini_Set(filenameP, "PosName", posName);
  1659.    
  1660.     dini_FloatSet(filenameP,"SavedX", pX);
  1661.     dini_FloatSet(filenameP,"SavedY", pY);
  1662.     dini_FloatSet(filenameP,"SavedZ", pZ);
  1663.     new fMes[128];
  1664.     format(fMes, sizeof(fMes), "You successfully saved your position. It has the key \"%i\"! Remember it!", pCount);
  1665.     SendClientMessage(playerid, COLOR_ORANGE, fMes);
  1666.     SendClientMessage(playerid, COLOR_ORANGE, "Use \"/gpos [key]\" to go there. Use \"/dpos [key]\" to delete a position.");
  1667.     return 1;
  1668. }
  1669.  
  1670. dcmd_dpos(playerid, params[])
  1671. {
  1672.     new poskey;
  1673.     new pName[MAX_PLAYER_NAME];
  1674.     new filepath[32+MAX_PLAYER_NAME];
  1675.    
  1676.     GetPlayerName(playerid, pName, sizeof(pName));
  1677.  
  1678.     if(sscanf(params, "i", poskey))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /dpos [key]");
  1679.     #if defined UseGreenAACFolders
  1680.     format(filepath, 20+sizeof(pName), "GreenAAC/Positions/%s.pos%i.ini", pName, poskey);
  1681.     #else
  1682.     format(filepath, 20+sizeof(pName), "%s.pos%i.ini", pName, poskey);
  1683.     #endif
  1684.     if(!fexist(filepath))return SendClientMessage(playerid, COLOR_WHITE, "[ERROR]The key you entered isn't in use!");
  1685.    
  1686.     else
  1687.     {
  1688.         dini_Remove(filepath);
  1689.         SendClientMessage(playerid, COLOR_ORANGE, "Position deleted.");
  1690.     }
  1691.  
  1692.     return 1;
  1693. }
  1694.  
  1695. dcmd_gpos(playerid, params[])
  1696. {
  1697.     new poskey;
  1698.     new pName[MAX_PLAYER_NAME];
  1699.     new filepath[32+MAX_PLAYER_NAME];
  1700.    
  1701.     GetPlayerName(playerid, pName, sizeof(pName));
  1702.  
  1703.     if(sscanf(params, "i", poskey))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gpos [key]");
  1704.     #if defined UseGreenAACFolders
  1705.     format(filepath, 20+sizeof(pName), "GreenAAC/Positions/%s.pos%i.ini", pName, poskey);
  1706.     #else
  1707.     format(filepath, 20+sizeof(pName), "%s.pos%i.ini", pName, poskey);
  1708.     #endif
  1709.     if(!fexist(filepath))return SendClientMessage(playerid, COLOR_WHITE, "[ERROR]The key you entered isn't in use!");
  1710.  
  1711.     else
  1712.     {
  1713.         if(IsPlayerInAnyVehicle(playerid))
  1714.         {
  1715.             SetVehiclePos(GetPlayerVehicleID(playerid), dini_Float(filepath, "SavedX"), dini_Float(filepath, "SavedY"), dini_Float(filepath, "SavedZ"));
  1716.         }
  1717.        
  1718.         else SetPlayerPos(playerid, dini_Float(filepath, "SavedX"),  dini_Float(filepath, "SavedY"), dini_Float(filepath, "SavedZ"));
  1719.        
  1720.         new stringy[50];
  1721.         format(stringy, sizeof(stringy), "You went to \"%s\"(Key: %i).",dini_Get(filepath, "PosName"), poskey);
  1722.         SendClientMessage(playerid, COLOR_ORANGE, stringy);
  1723.     }
  1724.     return 1;
  1725. }
  1726.  
  1727. dcmd_eject(playerid, params[])
  1728. {
  1729.     new ejectid;
  1730.     if(sscanf(params, "u", ejectid))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /Eject [playerid]");
  1731.     else if(ejectid == INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
  1732.     else RemovePlayerFromVehicle(ejectid);
  1733.     return 1;
  1734. }
  1735.  
  1736. dcmd_explode(playerid, params[])
  1737. {
  1738.     new explodeid;
  1739.     if(sscanf(params, "u", explodeid))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /Explode [playerid]");
  1740.     else if(explodeid == INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
  1741.     else
  1742.     {
  1743.         new ExplodeName[MAX_PLAYER_NAME];
  1744.         new AdminName[MAX_PLAYER_NAME];
  1745.         new ExplodeMessage[128];
  1746.         GetPlayerName(explodeid, ExplodeName, sizeof(ExplodeName));
  1747.         GetPlayerName(playerid, AdminName, sizeof(AdminName));
  1748.         format(ExplodeMessage, sizeof(ExplodeMessage), "%s has been exploded by %s!", ExplodeName, AdminName);
  1749.         SendClientMessageToAll(COLOR_ORANGE, ExplodeMessage);
  1750.  
  1751.         new Float:eX, Float:eY, Float:eZ;
  1752.         GetPlayerPos(explodeid, eX, eY, eZ);
  1753.        
  1754.         for(new lc=0; lc<=20; lc++)
  1755.         {
  1756.             new Float:randomizer=Float:random(4)/Float:random(4)*Float:random(4)/Float:random(4);
  1757.             if(randomizer>4.0)randomizer=4.000;
  1758.             CreateExplosion(eX+randomizer, eY+randomizer, eZ+randomizer, 5, 4);
  1759.         }
  1760.        
  1761.     }
  1762.     return 1;
  1763. }
  1764.  
  1765.  
  1766. dcmd_spec(playerid, params[])
  1767. {
  1768.     new specplayer;
  1769.     if(sscanf(params, "u", specplayer))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /Spec [playerid]");
  1770.     else if(specplayer == INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
  1771.     else
  1772.     {
  1773.         new Float:SpeX, Float:SpeY, Float:SpeZ;
  1774.         GetPlayerPos(playerid, SpeX, SpeY, SpeZ);
  1775.        
  1776.         SetPVarFloat(playerid, "SpeX", SpeX);
  1777.         SetPVarFloat(playerid, "SpeY", SpeY);
  1778.         SetPVarFloat(playerid, "SpeZ", SpeZ);
  1779.        
  1780.         if(IsPlayerInAnyVehicle(specplayer))
  1781.         {
  1782.             TogglePlayerSpectating(playerid, 1);
  1783.             new SpecVeh;
  1784.             SpecVeh=GetPlayerVehicleID(specplayer);
  1785.             PlayerSpectateVehicle(playerid, SpecVeh);
  1786.         }
  1787.         else if(IsPlayerInAnyVehicle(specplayer)==0)
  1788.         {
  1789.             TogglePlayerSpectating(playerid, 1);
  1790.             PlayerSpectatePlayer(playerid, specplayer);
  1791.         }
  1792.     }
  1793.     return 1;
  1794. }
  1795.  
  1796. dcmd_seatme(playerid, params[])
  1797. {
  1798.     new seattoid;
  1799.     if(sscanf(params, "u", seattoid))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /seatme [playerid]");
  1800.     else if(seattoid == INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
  1801.     else
  1802.     {
  1803.         new SeatVeh, SeatCount;
  1804.         SeatVeh=GetPlayerVehicleID(seattoid);
  1805.         SeatCount=0;
  1806.         //******************SEATCOUNTING*******************
  1807.         for(new i=0, tx=GetMaxPlayers(); i<=tx; i++)if(IsPlayerConnected(i))
  1808.         if(IsPlayerInVehicle(i, SeatVeh))if(GetPlayerVehicleSeat(i)==0)SeatCount++;
  1809.         for(new i=0, tx=GetMaxPlayers(); i<=tx; i++)if(IsPlayerConnected(i))
  1810.         if(IsPlayerInVehicle(i, SeatVeh))if(GetPlayerVehicleSeat(i)==1)SeatCount++;
  1811.         for(new i=0, tx=GetMaxPlayers(); i<=tx; i++)if(IsPlayerConnected(i))
  1812.         if(IsPlayerInVehicle(i, SeatVeh))if(GetPlayerVehicleSeat(i)==2)SeatCount++;
  1813.         for(new i=0, tx=GetMaxPlayers(); i<=tx; i++)if(IsPlayerConnected(i))
  1814.         if(IsPlayerInVehicle(i, SeatVeh))if(GetPlayerVehicleSeat(i)==3)SeatCount++;
  1815.         //*******END*********SEATCOUNTING*********END********
  1816.  
  1817.         if(SeatCount!=4)
  1818.         {
  1819.         PutPlayerInVehicle(playerid,SeatVeh,SeatCount);
  1820.  
  1821.         new SeatName[MAX_PLAYER_NAME];
  1822.         new AdminName[MAX_PLAYER_NAME];
  1823.         new SeatMessage[128];
  1824.         GetPlayerName(playerid, SeatName, sizeof(SeatName));
  1825.         GetPlayerName(seattoid, AdminName, sizeof(AdminName));
  1826.         format(SeatMessage, sizeof(SeatMessage), "%s has been seated(seatme) to %s!", SeatName, AdminName);
  1827.         SendClientMessageToAll(COLOR_ORANGE, SeatMessage);
  1828.         }
  1829.         if(SeatCount==4)SendClientMessage(playerid, COLOR_ORANGE, "All seats are in use! Cannot seat to Target-ID!");
  1830.     }
  1831.     return 1;
  1832. }
  1833.  
  1834. dcmd_seat(playerid, params[])
  1835. {
  1836.     new seatplayer;
  1837.     if(sscanf(params, "u", seatplayer))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /seat [playerid]");
  1838.     else if(seatplayer == INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
  1839.     else
  1840.     {
  1841.         new SeatVeh, SeatCount;
  1842.         SeatVeh=GetPlayerVehicleID(playerid);
  1843.         SeatCount=0;
  1844.         //******************SEATCOUNTING*******************
  1845.         for(new i=0, tx=GetMaxPlayers(); i<=tx; i++)if(IsPlayerConnected(i))
  1846.         if(IsPlayerInVehicle(i, SeatVeh))if(GetPlayerVehicleSeat(i)==0)SeatCount++;
  1847.         for(new i=0, tx=GetMaxPlayers(); i<=tx; i++)if(IsPlayerConnected(i))
  1848.         if(IsPlayerInVehicle(i, SeatVeh))if(GetPlayerVehicleSeat(i)==1)SeatCount++;
  1849.         for(new i=0, tx=GetMaxPlayers(); i<=tx; i++)if(IsPlayerConnected(i))
  1850.         if(IsPlayerInVehicle(i, SeatVeh))if(GetPlayerVehicleSeat(i)==2)SeatCount++;
  1851.         for(new i=0, tx=GetMaxPlayers(); i<=tx; i++)if(IsPlayerConnected(i))
  1852.         if(IsPlayerInVehicle(i, SeatVeh))if(GetPlayerVehicleSeat(i)==3)SeatCount++;
  1853.         //*******END*********SEATCOUNTING*********END********
  1854.        
  1855.         if(SeatCount!=4)
  1856.         {
  1857.         PutPlayerInVehicle(seatplayer,SeatVeh,SeatCount);
  1858.         new SeatName[MAX_PLAYER_NAME],SeatMessage[128],AdminName[MAX_PLAYER_NAME];
  1859.         GetPlayerName(seatplayer, SeatName, sizeof(SeatName));
  1860.         GetPlayerName(playerid, AdminName, sizeof(AdminName));
  1861.         format(SeatMessage, sizeof(SeatMessage), "%s has been seated(seat) to %s!", SeatName, AdminName);
  1862.         SendClientMessageToAll(COLOR_ORANGE, SeatMessage);
  1863.         }
  1864.         else if(SeatCount==4)SendClientMessage(playerid, COLOR_ORANGE, "All seats are in use! Cannot seat anybody to you!");
  1865.     }
  1866.     return 1;
  1867.  
  1868. }
  1869.  
  1870. dcmd_gga(playerid, params[])
  1871. {
  1872.     new gasendid, gaid, gaammo;
  1873.     if(sscanf(params,"uii",gasendid,gaid,gaammo))return SendClientMessage(playerid,COLOR_WHITE,
  1874.     "USAGE: /gga [playerid] [weaponid] [ammo]");
  1875.     else if(gasendid == INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
  1876.     else
  1877.     {
  1878.         GivePlayerWeaponEx(gasendid, gaid, gaammo);
  1879.     }
  1880.     return 1;
  1881. }
  1882.  
  1883. dcmd_givegun(playerid, params[])
  1884. {
  1885.     new gsendid, wid;
  1886.     if(sscanf(params, "ui",gsendid,wid))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givegun [playerid] [weaponid]");
  1887.     else if(gsendid == INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
  1888.     else
  1889.     {
  1890.         GivePlayerWeaponEx(gsendid, wid, 500);
  1891.     }
  1892.     return 1;
  1893. }
  1894.  
  1895. dcmd_disarm(playerid, params[])
  1896. {
  1897.     new disarmid;
  1898.     if (sscanf(params, "u", disarmid))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /disarm [playerid]");
  1899.     else if(disarmid == INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
  1900.     else
  1901.     {
  1902.         ResetPlayerWeaponsEx(disarmid);
  1903.         new ResString[128], ResName[MAX_PLAYER_NAME], AdminName[MAX_PLAYER_NAME];
  1904.         GetPlayerName(playerid,AdminName, sizeof(AdminName));
  1905.         GetPlayerName(disarmid, ResName, sizeof(ResName));
  1906.         format(ResString, sizeof(ResString), "Weapons of %s reseted by %s!", ResName, AdminName);
  1907.         SendClientMessageToAll(COLOR_ORANGE, ResString);
  1908.     }
  1909.     return 1;
  1910. }
  1911.  
  1912.  
  1913. dcmd_w(playerid, params[])
  1914. {
  1915.     new wwep, wammo;
  1916.     if(sscanf(params, "ii", wwep, wammo))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /w [weaponid] [ammo]");
  1917.     else
  1918.     {
  1919.         GivePlayerWeaponEx(playerid, wwep, wammo);
  1920.     }
  1921.     return 1;
  1922. }
  1923.  
  1924. dcmd_wep(playerid, params[])
  1925. {
  1926.     new wepid;
  1927.     if(sscanf(params, "i", wepid))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /wep [weaponid]");
  1928.     else
  1929.     {
  1930.         GivePlayerWeaponEx(playerid, wepid, 500);
  1931.     }
  1932.     return 1;
  1933. }
  1934.  
  1935. dcmd_givepara(playerid, params[])
  1936. {
  1937.     new giveid;
  1938.     if(sscanf(params, "u", giveid))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givepara [playerid]");
  1939.     else if(giveid == INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
  1940.     else
  1941.     {
  1942.         GivePlayerWeaponEx(giveid, 46, 1);
  1943.     }
  1944.     return 1;
  1945. }
  1946.  
  1947.  
  1948. dcmd_vc(playerid, params[])
  1949. {
  1950.     new carid,color1[5],color2[5];
  1951.     if(sscanf(params, "izz", carid, color1, color2))
  1952.     return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /vc [carid] (color 1) (color 2)");
  1953.     else
  1954.     {
  1955.         new Float:X, Float:Y, Float:Z, Float:Alpha, AdminName[MAX_PLAYER_NAME],vcMessage[128],vehid;
  1956.         GetPlayerPos(playerid,X,Y,Z);
  1957.         GetPlayerFacingAngle(playerid, Alpha);
  1958.         SetPlayerPos(carid,X,Y,Z+7);
  1959.         if(!strlen(color1)&&!strlen(color2))vehid=CreateVehicle(carid, X,Y,Z,Alpha, random(50), random(50), -1);
  1960.         else vehid=CreateVehicle(carid, X,Y,Z,Alpha, strval(color1), strval(color2), -1);
  1961.         SetVehicleVirtualWorld(vehid, GetPlayerVirtualWorld(playerid));
  1962.         GetPlayerName(playerid, AdminName, sizeof(AdminName));
  1963.         format(vcMessage, sizeof(vcMessage), "%s has created a car with the ID %i!", AdminName, carid);
  1964.         SendClientMessageToAll(COLOR_ORANGE, vcMessage);
  1965.     }
  1966.     return 1;
  1967. }
  1968.  
  1969. dcmd_gethere(playerid, params[])
  1970. {
  1971.     new gethereid;
  1972.     if(sscanf(params, "u", gethereid))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gethere [playerid]");
  1973.     else if(gethereid==playerid)return SendClientMessage(playerid, COLOR_ORANGE, "You cannot 'gethere' yourself!");
  1974.     else if(gethereid == INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
  1975.     else
  1976.     {
  1977.         if(IsPlayerInAnyVehicle(gethereid))
  1978.         {
  1979.             if(GetVehicleType(GetPlayerVehicleID(gethereid))==VTYPE_PLANE)
  1980.             {
  1981.                 RemovePlayerFromVehicle(gethereid);
  1982.                 SendClientMessage(gethereid, COLOR_ORANGE, "You have been removed from your vehicle. REASON: [/gethere]");
  1983.             }
  1984.             new Float:X,Float:Y,Float:Z,Float:Alpha,gethereMessage[128],AdminName[MAX_PLAYER_NAME],gethereName[MAX_PLAYER_NAME];
  1985.             GetPlayerPos(playerid,X,Y,Z);
  1986.             GetPlayerFacingAngle(playerid,Alpha);
  1987.             SetVehiclePos(GetPlayerVehicleID(gethereid), X, Y, Z+3);
  1988.             SetPlayerFacingAngle(gethereid, Alpha);
  1989.             SetPlayerVirtualWorld(gethereid, GetPlayerVirtualWorld(playerid));
  1990.             SetVehicleVirtualWorld(GetPlayerVehicleID(gethereid), GetPlayerVirtualWorld(playerid));
  1991.             GetPlayerName(gethereid, gethereName, sizeof(gethereName));
  1992.             GetPlayerName(playerid, AdminName, sizeof(AdminName));
  1993.             format(gethereMessage, sizeof(gethereMessage), "%s has been Teleported(gethere) to %s![With Vehicle]", AdminName, gethereName);
  1994.             SendClientMessageToAll(COLOR_ORANGE, gethereMessage);
  1995.             return 1;
  1996.         }
  1997.  
  1998.         else if(IsPlayerInAnyVehicle(gethereid)==0)
  1999.         {
  2000.             new Float:X, Float:Y, Float:Z,gotoMessage[128],AdminName[MAX_PLAYER_NAME],gotoName[MAX_PLAYER_NAME];
  2001.             GetPlayerPos(playerid,X,Y,Z);
  2002.             SetPlayerPos(gethereid,X+1,Y+1,Z+1);
  2003.             SetPlayerVirtualWorld(gethereid, GetPlayerVirtualWorld(playerid));
  2004.             GetPlayerName(gethereid, gotoName, sizeof(gotoName));
  2005.             GetPlayerName(playerid, AdminName, sizeof(AdminName));
  2006.             format(gotoMessage, sizeof(gotoMessage), "%s has been Teleported(gethere) to %s!", gotoName, AdminName);
  2007.             SendClientMessageToAll(COLOR_ORANGE, gotoMessage);
  2008.             return 1;
  2009.         }
  2010.     }
  2011.     return 1;
  2012. }
  2013.  
  2014. dcmd_goto(playerid, params[])
  2015. {
  2016.     new gotoplayer;
  2017.     if (sscanf(params, "u", gotoplayer))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /goto [playerid]");
  2018.     else if(GetVehicleType(GetPlayerVehicleID(playerid))==VTYPE_PLANE)
  2019.     return SendClientMessage(playerid, COLOR_RED, "You cannot Teleport with plane!");
  2020.     else if(GetVehicleType(GetPlayerVehicleID(playerid))==VTYPE_PLANE)
  2021.     return SendClientMessage(playerid, COLOR_RED, "Sorry! You cannot Teleport to a plane!");
  2022.     else if(gotoplayer==playerid)return SendClientMessage(playerid, COLOR_RED, "You cannot \"goto\" to yourself!");
  2023.     else if(gotoplayer == INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
  2024.    
  2025.    
  2026.     else if(IsPlayerInAnyVehicle(playerid))
  2027.     {
  2028.         if(GetVehicleType(GetPlayerVehicleID(playerid))!=VTYPE_PLANE)
  2029.         {
  2030.             new Float:X, Float:Y, Float:Z, Float:Alpha,gotoMessage[128],gotoName[MAX_PLAYER_NAME],AdminName[MAX_PLAYER_NAME];
  2031.             GetPlayerPos(gotoplayer,X,Y,Z);
  2032.             GetPlayerFacingAngle(gotoplayer,Alpha);
  2033.             SetVehiclePos(GetPlayerVehicleID(playerid), X, Y, Z+3);
  2034.             SetPlayerFacingAngle(playerid, Alpha);
  2035.             SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(gotoplayer));
  2036.             SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), GetPlayerVirtualWorld(gotoplayer));
  2037.             GetPlayerName(gotoplayer, gotoName, sizeof(gotoName));
  2038.             GetPlayerName(playerid, AdminName, sizeof(AdminName));
  2039.             format(gotoMessage, sizeof(gotoMessage), "%s has been Teleported(goto) to %s![With Vehicle]", AdminName, gotoName);
  2040.             SendClientMessageToAll(COLOR_ORANGE, gotoMessage);
  2041.         }
  2042.         return 1;
  2043.     }
  2044.  
  2045.     else if(IsPlayerInAnyVehicle(playerid)==0)
  2046.     {
  2047.         new Float:X, Float:Y, Float:Z,gotoMessage[128],gotoName[MAX_PLAYER_NAME],AdminName[MAX_PLAYER_NAME];
  2048.         GetPlayerPos(gotoplayer,X,Y,Z);
  2049.         SetPlayerPos(playerid,X+1,Y+1,Z+1);
  2050.         SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(gotoplayer));
  2051.         GetPlayerName(gotoplayer, gotoName, sizeof(gotoName));
  2052.         GetPlayerName(playerid, AdminName, sizeof(AdminName));
  2053.         format(gotoMessage, sizeof(gotoMessage), "%s has been Teleported(goto) to %s![Without Vehicle]", AdminName, gotoName);
  2054.         SendClientMessageToAll(COLOR_ORANGE, gotoMessage);
  2055.         return 1;
  2056.     }
  2057.     return 1;
  2058. }
  2059.  
  2060.  
  2061. dcmd_slap(playerid, params[])
  2062. {
  2063.     new slapid;
  2064.     if(sscanf(params, "u", slapid))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /slap [playerid]");
  2065.     else if(slapid == INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
  2066.     else
  2067.     {
  2068.         new Float:X, Float:Y, Float:Z,AdminName[MAX_PLAYER_NAME],SlapName[MAX_PLAYER_NAME],SlapMessage[128];
  2069.         GetPlayerPos(slapid, X, Y, Z);
  2070.         SetPlayerPos(slapid, X, Y, Z+8);
  2071.         GetPlayerName(slapid, SlapName, sizeof(SlapName));
  2072.         GetPlayerName(playerid, AdminName, sizeof(AdminName));
  2073.         format(SlapMessage, sizeof(SlapMessage), "%s has been slapped by %s!", SlapName, AdminName);
  2074.         SendClientMessageToAll(COLOR_ORANGE, SlapMessage);
  2075.     }
  2076.     return 1;
  2077. }
  2078.  
  2079. dcmd_unfreeze(playerid, params[])
  2080. {
  2081.     new unfreezeid;
  2082.     if(sscanf(params, "u", unfreezeid))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /unfreeze [playerid]");
  2083.     else if(unfreezeid == INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
  2084.     else
  2085.     {
  2086.         TogglePlayerControllable(unfreezeid,1);
  2087.         new unFrozenName[MAX_PLAYER_NAME],unFreezeMessage[128],AdminName[MAX_PLAYER_NAME];
  2088.         GetPlayerName(unfreezeid, unFrozenName, sizeof(unFrozenName));
  2089.         GetPlayerName(playerid, AdminName, sizeof(AdminName));
  2090.         format(unFreezeMessage, sizeof(unFreezeMessage), "%s has been unfrozen by %s!", unFrozenName, AdminName);
  2091.         SendClientMessageToAll(COLOR_ORANGE, unFreezeMessage);
  2092.     }
  2093.     return 1;
  2094. }
  2095.  
  2096. dcmd_freeze(playerid, params[])
  2097. {
  2098.     new freezeid;
  2099.     if(sscanf(params, "u", freezeid))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /freeze [playerid]");
  2100.     else if(IsAdminAtLeast(freezeid, 8))return SendClientMessage(playerid, COLOR_RED, "You May Not Freeze Admins of Level 8+ !!!");
  2101.     else if(freezeid==playerid)return SendClientMessage(playerid, COLOR_ORANGE, "You Cannot Freeze Yourself!");
  2102.     else if(freezeid == INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
  2103.     else
  2104.     {
  2105.         TogglePlayerControllable(freezeid, 0);
  2106.         new FrozenName[MAX_PLAYER_NAME],FreezeMessage[128],AdminName[MAX_PLAYER_NAME];
  2107.         GetPlayerName(freezeid, FrozenName, sizeof(FrozenName));
  2108.         GetPlayerName(playerid, AdminName, sizeof(AdminName));
  2109.         format(FreezeMessage, sizeof(FreezeMessage), "%s has been frozen by %s!", FrozenName, AdminName);
  2110.         SendClientMessageToAll(COLOR_ORANGE, FreezeMessage);
  2111.     }
  2112.     return 1;
  2113. }
  2114.  
  2115. dcmd_unbanid(playerid, params[]) //Quite useless, but I added it anyway.
  2116. {
  2117.     new Banid;
  2118.  
  2119.     if(sscanf(params, "u", Banid))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /dunbanID [playerid]");
  2120.     else if(Banid==INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
  2121.     else
  2122.     {
  2123.         new BannedName[MAX_PLAYER_NAME];
  2124.         GetPlayerName(Banid, BannedName, sizeof(BannedName));
  2125.         new BanIP[16];
  2126.         GetPlayerIp(Banid, BanIP, sizeof(BanIP));
  2127.         new filename[26+MAX_PLAYER_NAME];
  2128.         #if defined UseGreenAACFolders
  2129.         format(filename, sizeof(filename), "GreenAAC/Banfiles/Ban.%s.ini", BannedName);
  2130.         #else
  2131.         format(filename, sizeof(filename), "Ban.%s.ini", BannedName);
  2132.         #endif
  2133.  
  2134.         if(fexist(filename))fremove(filename);
  2135.         #if defined UseGreenAACFolders
  2136.         if(fexist("GreenAAC/Banfiles/IPs.ini"))dini_Unset("GreenAAC/Banfiles/IPs.ini",BanIP);
  2137.         #else
  2138.         if(fexist("IPs.ini"))dini_Unset("IPs.ini",BanIP);
  2139.         #endif
  2140.         else SendClientMessage(playerid, COLOR_RED, "Error: No Banfiles with the given parameters found.");
  2141.         return 1;
  2142.     }
  2143. }
  2144.  
  2145. dcmd_unbanip(playerid, params[])
  2146. {
  2147.     new UnbanIP[16];
  2148.    
  2149.     if(sscanf(params, "s", UnbanIP))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /dunbanIP [IP]");
  2150.     else
  2151.     {
  2152.         new filename[26+MAX_PLAYER_NAME];
  2153.         #if defined UseGreenAACFolders
  2154.         format(filename, sizeof(filename), "GreenAAC/Banfiles/Ban.%s.ini", dini_Get("GreenAAC/Banfiles/IPs.ini","UnbanIP"));
  2155.         #else
  2156.         format(filename, sizeof(filename), "Ban.%s.ini", dini_Get("IPs.ini","UnbanIP"));
  2157.         #endif
  2158.  
  2159.         if(fexist(filename))fremove(filename);
  2160.         #if defined UseGreenAACFolders
  2161.         if(fexist("GreenAAC/Banfiles/IPs.ini"))dini_Unset("GreenAAC/Banfiles/IPs.ini",UnbanIP);
  2162.         #else
  2163.         if(fexist("IPs.ini"))dini_Unset("IPs.ini",UnbanIP);
  2164.         #endif
  2165.         else SendClientMessage(playerid, COLOR_RED, "Error: No Banfiles with the given parameters found.");
  2166.         return 1;
  2167.     }
  2168. }
  2169.  
  2170. dcmd_unbanname(playerid, params[])
  2171. {
  2172.     new UnbanName[MAX_PLAYER_NAME];
  2173.  
  2174.     if(sscanf(params, "s", UnbanName))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /dunbanName [Name]");
  2175.     else
  2176.     {
  2177.         new filename[26+MAX_PLAYER_NAME];
  2178.         #if defined UseGreenAACFolders
  2179.         format(filename, sizeof(filename), "GreenAAC/Banfiles/Ban.%s.ini", UnbanName);
  2180.         #else
  2181.         format(filename, sizeof(filename), "Ban.%s.ini", UnbanName);
  2182.         #endif
  2183.  
  2184.         if(fexist(filename))fremove(filename);
  2185.         #if defined UseGreenAACFolders
  2186.         if(fexist("GreenAAC/Banfiles/IPs.ini"))dini_Unset("GreenAAC/Banfiles/IPs.ini", dini_Get(filename,"IP"));
  2187.         #else
  2188.         if(fexist("IPs.ini"))dini_Unset("IPs.ini", dini_Get(filename,"IP"));
  2189.         #endif
  2190.         else SendClientMessage(playerid, COLOR_RED, "Error: No Banfiles with the given parameters found.");
  2191.         return 1;
  2192.     }
  2193. }
  2194.  
  2195. dcmd_ban(playerid, params[])
  2196. {
  2197.     new Banid;
  2198.     if(sscanf(params, "u", Banid))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ban [playerid]");
  2199.     else if(Banid==playerid)return SendClientMessage(playerid, COLOR_ORANGE, "You cannot ban yourself!");
  2200.     else if(Banid==INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
  2201.     else if(IsAdminAtLeast(Banid, 5))
  2202.     {
  2203.         SendClientMessage(playerid, COLOR_RED, "You may not ban admins of level 5+!");
  2204.         SendClientMessage(playerid, COLOR_RED, "Attempt failed.");  //Kick, when attempt to ban Admins
  2205.         new failname[MAX_PLAYER_NAME], victimname[MAX_PLAYER_NAME];
  2206.         GetPlayerName(Banid, victimname, sizeof(victimname));
  2207.         GetPlayerName(playerid, failname, sizeof(failname));
  2208.         printf("\n[!!!] %s[%i] failed the attempt to ban %s[%i]!\n", failname,playerid,victimname,Banid);
  2209.         Kick(playerid);
  2210.         return 1;
  2211.     }
  2212.     else SecureBan(Banid, playerid);
  2213.  
  2214.     return 1;
  2215. }
  2216.  
  2217. dcmd_kick(playerid, params[])
  2218. {
  2219.     new Kickid;
  2220.    
  2221.     if(sscanf(params, "u", Kickid))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /kick [playerid]");
  2222.     else if(Kickid==playerid)return SendClientMessage(playerid, COLOR_ORANGE, "You cannot kick yourself!");
  2223.     else if(IsAdminAtLeast(Kickid, 5))return SendClientMessage(playerid, COLOR_RED, "You may not kick admins of level 5+!");
  2224.     else if(Kickid == INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
  2225.     new KickedName[MAX_PLAYER_NAME],AdminName[MAX_PLAYER_NAME],KickMessage[22+2*MAX_PLAYER_NAME];
  2226.     GetPlayerName(Kickid, KickedName, sizeof(KickedName));
  2227.     GetPlayerName(playerid, AdminName, sizeof(AdminName));
  2228.     format(KickMessage, sizeof(KickMessage), "%s has been kicked by %s!", KickedName, AdminName);
  2229.     SendClientMessageToAll(COLOR_ORANGE, KickMessage);
  2230.     for(new i=0, tx=GetMaxPlayers(); i<=tx; i++)if(IsPlayerConnected(i)) PlayerPlaySound(i,1057,0.0,0.0,0.0);
  2231.     Kick(Kickid);
  2232.    
  2233.     return 1;
  2234. }
  2235.  
  2236. /*-------------------------------------------------------End Commands--------------------------------------------------------------------*/
  2237.  
  2238. #if defined SecureBanActive
  2239. SecureBan(Banid,playerid=-1)
  2240. {
  2241.     new BanMessage[128],BannedName[MAX_PLAYER_NAME],AdminName[MAX_PLAYER_NAME];
  2242.     GetPlayerName(Banid, BannedName, sizeof(BannedName));
  2243.     if(playerid!=-1)GetPlayerName(playerid, AdminName, sizeof(AdminName));
  2244.     else if(playerid==-1)AdminName="§SERVER§";
  2245.    
  2246.     printf("%s has been banned!", BannedName);
  2247.    
  2248.     if(IsPlayerConnected(playerid))
  2249.     {
  2250.         format(BanMessage, sizeof(BanMessage), "\n%s has been banned by %s!\n", BannedName, AdminName);
  2251.  
  2252.         for(new i=0, tx=GetMaxPlayers();i<=tx;i++)if(IsPlayerConnected(i))if(IsPlayerLoggedIn(playerid))if(IsAdminAtLeast(playerid, 5))
  2253.         {
  2254.             PlayerPlaySound(i,1057,0.0,0.0,0.0);
  2255.             SendClientMessage(i, COLOR_RED, BanMessage);
  2256.         }
  2257.     }
  2258.    
  2259.     new BanIP[16];
  2260.     GetPlayerIp(Banid, BanIP, sizeof(BanIP));
  2261.     new filename[26+MAX_PLAYER_NAME];
  2262.     #if defined UseGreenAACFolders
  2263.     format(filename, sizeof(filename), "GreenAAC/Banfiles/Ban.%s.ini", BannedName);
  2264.     #else
  2265.     format(filename, sizeof(filename), "Ban.%s.ini", BannedName);
  2266.     #endif
  2267.    
  2268.     dini_Create(filename);
  2269.     dini_Set(filename,"IP", BanIP);
  2270.  
  2271.     #if defined UseGreenAACFolders
  2272.     if(!fexist("GreenAAC/Banfiles/IPs.ini"))dini_Create("GreenAAC/Banfiles/IPs.ini");
  2273.     dini_Set("GreenAAC/Banfiles/IPs.ini",BanIP, BannedName);
  2274.     #else
  2275.     if(!fexist("IPs.ini"))dini_Create("IPs.ini");
  2276.     dini_Set("IPs.ini",BanIP, BannedName);
  2277.     #endif
  2278.    
  2279.     #if defined Blacklist
  2280.     SendBlacklistRequest(playerid);
  2281.     #endif
  2282.    
  2283.     Kick(Banid);
  2284.     return 1;
  2285. }
  2286. #else
  2287. SecureBan(Banid, playerid=-1)
  2288. {
  2289.     new BanMessage[128],BannedName[MAX_PLAYER_NAME],AdminName[MAX_PLAYER_NAME];
  2290.     GetPlayerName(Banid, BannedName, sizeof(BannedName));
  2291.     if(playerid!=-1)GetPlayerName(playerid, AdminName, sizeof(AdminName));
  2292.     else if(playerid==-1)AdminName="§SERVER§";
  2293.  
  2294.     printf("%s has been banned!", BannedName);
  2295.  
  2296.     if(IsPlayerConnected(playerid))
  2297.     {
  2298.         format(BanMessage, sizeof(BanMessage), "\n%s has been banned by %s!\n", BannedName, AdminName);
  2299.  
  2300.         for(new i=0; i<=GetMaxPlayers(); i++)if(IsPlayerConnected(i))if(IsPlayerLoggedIn(playerid))if(IsAdminAtLeast(playerid, 5))
  2301.         {
  2302.             PlayerPlaySound(i,1057,0.0,0.0,0.0);
  2303.             SendClientMessage(playerid, COLOR_RED, BanMessage);
  2304.         }
  2305.     }
  2306.    
  2307.     #if defined Blacklist
  2308.     SendBlacklistRequest(playerid);
  2309.     #endif
  2310.    
  2311.     Ban(Banid);
  2312. }
  2313. #endif
  2314.  
  2315.  
  2316.  
  2317.  
  2318.  
  2319. GetPlayerAdminLevel(playerid)
  2320. {
  2321.     if(IsPlayerLoggedIn(playerid))return GetPVarInt(playerid, "AdminLevel");
  2322.     else return -1;
  2323. }
  2324.  
  2325.  
  2326. stock IsPlayerAdminEx(playerid, Level)
  2327. {
  2328.     if(GetPVarInt(playerid, "AdminLevel")==Level)return 1;
  2329.     else return 0;
  2330. }
  2331.  
  2332. IsAdminAtLeast(playerid, Level)
  2333. {
  2334.     if(GetPVarInt(playerid, "AdminLevel")>=Level)return 1;
  2335.     else return 0;
  2336. }
  2337.  
  2338.  
  2339. SetPlayerAdminEx(playerid, Level)
  2340. {
  2341.     if(IsPlayerLoggedIn(playerid))
  2342.     {
  2343.         new file[MAX_PLAYER_NAME + 4];
  2344.         new PName[MAX_PLAYER_NAME];
  2345.         GetPlayerName(playerid, PName, sizeof(PName));
  2346.         #if defined UseGreenAACFolders
  2347.         format(file,sizeof(file),"GreenAAC/Players/%s.ini",PName);
  2348.         #else
  2349.         format(file,sizeof(file),"%s.ini",PName);
  2350.         #endif
  2351.         SetPVarInt(playerid, "AdminLevel", Level);
  2352.         dini_IntSet(file,"AdminLevel", Level);
  2353.         SavePlayerData(playerid);
  2354.     }
  2355.     return 1;
  2356. }
  2357.  
  2358. IsPlayerLoggedIn(playerid)
  2359. {
  2360.     if(IsPlayerConnected(playerid) && GetPVarInt(playerid, "PlayerLogged"))return 1;
  2361.     else return 0;
  2362. }
  2363.  
  2364. SavePlayerData(playerid)
  2365. {
  2366.     if(IsPlayerLoggedIn(playerid))
  2367.     {
  2368.         new file[MAX_PLAYER_NAME + 20];
  2369.         new PName[MAX_PLAYER_NAME];
  2370.         GetPlayerName(playerid, PName, sizeof(PName));
  2371.         #if defined UseGreenAACFolders
  2372.         format(file,sizeof(file),"GreenAAC/Players/%s.ini",PName);
  2373.         #else
  2374.         format(file,sizeof(file),"%s.ini",PName);
  2375.         #endif
  2376.  
  2377.         dini_IntSet(file,"AdminLevel", GetPVarInt(playerid, "AdminLevel"));
  2378.         dini_IntSet(file,"Cash", GetPlayerMoney(playerid));
  2379.         dini_IntSet(file,"AutoMsg", GetPVarInt(playerid, "AutoMsg"));
  2380.     }
  2381.     return 1;
  2382. }
  2383. #if defined Blacklist
  2384.  
  2385. new days[12]={31,30,31,30,31,30,31,31,30,31,30,31};
  2386.  
  2387. CalculateDaysBetweenDates(d1,m1,y1,d2,m2,y2)
  2388. {
  2389.     new ddiff;
  2390.     d2-=d1;
  2391.     if(y1!=y2)
  2392.     {
  2393.         while(y1!=y2)
  2394.         {
  2395.             if(m1==2){
  2396.             /*if(y1==2004||y1==2008||y1==2012||y1==2016||y1==2020||y1==2024||y1==2028||y1==2032||
  2397.             y1==2036||y1==2040||y1==2044||y1==2048||y1==2052||y1==2056||y1==2060||y1==2064||
  2398.             y1==2068||y1==2072||y1==2076||y1==2080||y1==2084||y1==2088||y1==2092||y1==2096)days[m1-1]=29;*/
  2399.             if((y1%4)==0)days[m1-1]=29;
  2400.             else days[m1-1]=28;}
  2401.  
  2402.             ddiff+=days[m1-1];
  2403.             m1++;
  2404.             if(m1==13)
  2405.             {
  2406.                 y1++;
  2407.                 m1=0;
  2408.             }
  2409.         }
  2410.         ddiff+=d2;
  2411.         return ddiff;
  2412.     }
  2413.     else if(y1==y2)
  2414.     {
  2415.         if(m1!=m2)
  2416.         {
  2417.             while(m1!=m2)
  2418.             {
  2419.                 if(m1==2){
  2420.                 /*if(y1==2004||y1==2008||y1==2012||y1==2016||y1==2020||y1==2024||y1==2028||y1==2032||
  2421.                 y1==2036||y1==2040||y1==2044||y1==2048||y1==2052||y1==2056||y1==2060||y1==2064||
  2422.                 y1==2068||y1==2072||y1==2076||y1==2080||y1==2084||y1==2088||y1==2092||y1==2096)days[m1-1]=29;*/
  2423.                 if((y1%4)==0)days[m1-1]=29;
  2424.                 else days[m1-1]=28;}
  2425.  
  2426.                 ddiff+=days[m1-1];
  2427.                 m1++;
  2428.                 if(m1==13)
  2429.                 {
  2430.                     y1++;
  2431.                     m1=0;
  2432.                 }
  2433.             }
  2434.             ddiff+=d2;
  2435.             return ddiff;
  2436.         }
  2437.         else if(m1==m2)
  2438.         {
  2439.             return d2;
  2440.         }
  2441.         else return print("Calculation Error");
  2442.     }
  2443.     else return print("Calculation Error");
  2444. }
  2445.  
  2446. #define pingurl "blacklist.pytalhost.net/lister.php?ping=1"
  2447. #define blacklisturl "blacklist.pytalhost.net/lister.php?name=%s&IP=%s"
  2448.  
  2449. SendBlacklistRequest(playerid)
  2450. {
  2451.     new submitString[200];
  2452.     new PName[MAX_PLAYER_NAME];
  2453.     GetPlayerName(playerid, PName, sizeof(PName));
  2454.  
  2455.     new PIP[16];
  2456.     GetPlayerIp(playerid, PIP, sizeof(PIP));
  2457.  
  2458.     format(submitString, sizeof(submitString), blacklisturl, PName, PIP);
  2459.     HTTP(playerid, HTTP_GET, submitString, "", "httpResponse");
  2460.     return 1;
  2461. }
  2462. #endif
  2463.  
  2464. #if defined ACDebug
  2465. WriteToACDebugFile(playerid)
  2466. {
  2467.     new Float:pX, Float:pY, Float:pZ, acdstr[100];
  2468.     GetPlayerPos(playerid, pX, pY, pZ);
  2469.     format(acdstr, sizeof(acdstr), "ID: %i | Weapon: %i | VirtualWorld: %i | Position: (%f|%f|%f)\r\n", playerid, GetPlayerWeapon(playerid), GetPlayerVirtualWorld(playerid), pX, pY, pZ);
  2470.     new File:ACdebug = fopen("GreenAAC/ACDebug.txt", io_append);
  2471.     fwrite(ACdebug, acdstr);
  2472.     fclose(ACdebug);
  2473. }
  2474. #endif
  2475.  
  2476.  
  2477. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  2478. {
  2479.     if(dialogid==404)
  2480.     {
  2481.         if(response)
  2482.         {
  2483.             if(!strcmp(inputtext, SrvrPass, false))
  2484.             {
  2485.                 SendClientMessage(playerid, COLOR_GREEN, "Password correct.");
  2486.                 SetPVarInt(playerid, "PPassed", 1);
  2487.                 return 1;
  2488.             }
  2489.  
  2490.             else if(strcmp(inputtext, SrvrPass, false))
  2491.             {
  2492.                 SetPVarInt(playerid, "PLogs", GetPVarInt(playerid, "PLogs")+1);
  2493.                 SendClientMessage(playerid, COLOR_RED, "Password incorrect.");
  2494.                 if(GetPVarInt(playerid, "PLogs")>=3)return Kick(playerid);
  2495.                 new WString[30];
  2496.                 format(WString, sizeof(WString), "Server is locked. Try %i/3", GetPVarInt(playerid, "PLogs")+1);
  2497.                 return ShowPlayerDialog(playerid, 404, DIALOG_STYLE_INPUT, WString, "Password", "Try", "Exit");
  2498.             }
  2499.  
  2500.         }
  2501.         else return Kick(playerid);
  2502.     }
  2503.     if(response)
  2504.     {
  2505.         switch(dialogid)
  2506.         {
  2507.             case 10240:
  2508.             {
  2509.                 switch(listitem)
  2510.                 {
  2511.                     case 0: ShowPlayerDialog(playerid, 10241, DIALOG_STYLE_INPUT, "/rcon hostname [name]", "/rcon hostname ", "Okay", "Abort");
  2512.                     case 1: ShowPlayerDialog(playerid, 10242, DIALOG_STYLE_INPUT, "/rcon gamemodetext [text]", "/rcon gamemodetext ", "Okay", "Abort");
  2513.                     case 2: ShowPlayerDialog(playerid, 10243, DIALOG_STYLE_INPUT, "/rcon mapname [name]", "/rcon mapname ", "Okay", "Abort");
  2514.                     case 3: ShowPlayerDialog(playerid, 10244, DIALOG_STYLE_INPUT, "/rcon exec [filename]", "/rcon exec ", "Okay", "Abort");
  2515.                     case 4: ShowPlayerDialog(playerid, 10245, DIALOG_STYLE_INPUT, "/rcon changemode [mode]", "/rcon changemode ", "Okay", "Abort");
  2516.                     case 5: SendRconCommand("reloadbans");
  2517.                     case 6: SendRconCommand("reloadlog");
  2518.                     case 7: ShowPlayerDialog(playerid, 10246, DIALOG_STYLE_INPUT, "/rcon say [text]", "/rcon say ", "Okay", "Abort");
  2519.                     case 8: ShowPlayerDialog(playerid, 10247, DIALOG_STYLE_INPUT, "/rcon gravity [gravity]", "/rcon gravity ", "Okay", "Abort");
  2520.                     case 9: ShowPlayerDialog(playerid, 10248, DIALOG_STYLE_INPUT, "/rcon weather [ID]", "/rcon weather ", "Okay", "Abort");
  2521.                     case 10: ShowPlayerDialog(playerid, 10249, DIALOG_STYLE_INPUT, "/rcon loadfs [FS]", "/rcon loadfs ", "Okay", "Abort");
  2522.                     case 11: ShowPlayerDialog(playerid, 10250, DIALOG_STYLE_INPUT, "/rcon unloadfs [FS]", "/rcon unloadfs ", "Okay", "Abort");
  2523.                     case 12: ShowPlayerDialog(playerid, 10251, DIALOG_STYLE_INPUT, "/rcon reloadfs [FS]", "/rcon reloadfs ", "Okay", "Abort");
  2524.                 }
  2525.             }
  2526.             case 10241:
  2527.             {
  2528.                 new diaStr[50];
  2529.                 format(diaStr, sizeof(diaStr), "hostname %s", inputtext);
  2530.                 SendRconCommand(diaStr);
  2531.             }
  2532.             case 10242:
  2533.             {
  2534.                 new diaStr[50];
  2535.                 format(diaStr, sizeof(diaStr), "gamemodetext %s", inputtext);
  2536.                 SendRconCommand(diaStr);
  2537.             }
  2538.             case 10243:
  2539.             {
  2540.                 new diaStr[50];
  2541.                 format(diaStr, sizeof(diaStr), "mapname %s", inputtext);
  2542.                 SendRconCommand(diaStr);
  2543.             }
  2544.             case 10244:
  2545.             {
  2546.                 new diaStr[50];
  2547.                 format(diaStr, sizeof(diaStr), "exec %s", inputtext);
  2548.                 SendRconCommand(diaStr);
  2549.             }
  2550.             case 10245:
  2551.             {
  2552.                 new diaStr[50];
  2553.                 format(diaStr, sizeof(diaStr), "changemode %s", inputtext);
  2554.                 SendRconCommand(diaStr);
  2555.             }
  2556.             case 10246:
  2557.             {
  2558.                 new diaStr[50];
  2559.                 format(diaStr, sizeof(diaStr), "say %s", inputtext);
  2560.                 SendRconCommand(diaStr);
  2561.             }
  2562.             case 10247:
  2563.             {
  2564.                 new diaStr[50];
  2565.                 format(diaStr, sizeof(diaStr), "gravity %s", inputtext);
  2566.                 SendRconCommand(diaStr);
  2567.             }
  2568.             case 10248:
  2569.             {
  2570.                 new diaStr[50];
  2571.                 format(diaStr, sizeof(diaStr), "weather %s", inputtext);
  2572.                 SendRconCommand(diaStr);
  2573.             }
  2574.             case 10249:
  2575.             {
  2576.                 new diaStr[50];
  2577.                 format(diaStr, sizeof(diaStr), "loadfs %s", inputtext);
  2578.                 SendRconCommand(diaStr);
  2579.             }
  2580.             case 10250:
  2581.             {
  2582.                 new diaStr[50];
  2583.                 format(diaStr, sizeof(diaStr), "unloadfs %s", inputtext);
  2584.                 SendRconCommand(diaStr);
  2585.             }
  2586.             case 10251:
  2587.             {
  2588.                 new diaStr[50];
  2589.                 format(diaStr, sizeof(diaStr), "reloadfs %s", inputtext);
  2590.                 SendRconCommand(diaStr);
  2591.             }
  2592.             default:{}
  2593.         }
  2594.     }
  2595.     return 0;
  2596. }
  2597.  
  2598.  
  2599. public OnPlayerRequestSpawn(playerid)
  2600. {
  2601.     if(Srvrlckd&&GetPVarInt(playerid, "PPassed")!=1)return 0;
  2602.     return 1;
  2603. }
  2604.  
  2605. /*---------------------------------------------------BLACKLIST--------------------------------------------------------------*/
  2606.  
  2607. #if defined Blacklist
  2608. forward PVCheck(playerid);
  2609. forward httpResponse(index, response_code, data[]);
  2610. forward HTTPVerif(index, response_code, data[]);
  2611. forward HTTPPing(index, response_code, data[]);
  2612.  
  2613. new BLPing=-1;
  2614. new BTC1=-1, BTC2=-1;
  2615.  
  2616. public PVCheck(playerid)
  2617. {
  2618.     if(GetPVarInt(playerid, "BL_verif")!=1&&blonline!=false)
  2619.     {
  2620.         SendClientMessage(playerid, COLOR_RED, "Your verification failed. Please reconnect or contact an admin.");
  2621.         return Kick(playerid);
  2622.     }
  2623.     else return 1;
  2624. }
  2625.  
  2626. PingBlacklist()
  2627. {
  2628.     BTC1=GetTickCount();
  2629.     return HTTP(BLPing, HTTP_GET, pingurl, "", "HTTPPing");
  2630. }
  2631.  
  2632. public HTTPPing(index, response_code, data[])
  2633. {
  2634.     BTC2=GetTickCount();
  2635.     if(response_code!=200)
  2636.     {
  2637.         printf("#ERROR %i: COULD NOT CONNECT TO BLACKLIST!", response_code);
  2638.         blonline=false;
  2639.     }
  2640.     else
  2641.     {
  2642.         if(blonline==false)
  2643.         {
  2644.             for(new i=0, tx=GetMaxPlayers(); i<=tx; i++)if(IsPlayerConnected(i))if(!IsPlayerNPC(i))
  2645.             {
  2646.                 GetPlayerVerification(i);
  2647.             }
  2648.             blonline=true;
  2649.         }
  2650.         new dval=0, newestvers[10];
  2651.         sscanf(data, "p|isz", dval, newestvers);
  2652.         printf("#Blacklist pinged with %i entries. Ping: %i",dval, BTC2-BTC1);
  2653.         if(strcmp(GAAC_version, newestvers))
  2654.         {
  2655.             print("#Warning: You don't have the newest version of GAAC!");
  2656.             print("#Warning: Visit http://blacklist.pytalhost.net to download the newest version.");
  2657.         }
  2658.         BLPing=BTC2-BTC1;
  2659.     }
  2660.     return 1;
  2661. }
  2662.  
  2663. GetPlayerVerification(playerid)
  2664. {
  2665.     new pIP[16];
  2666.     GetPlayerIp(playerid, pIP, sizeof(pIP));
  2667.  
  2668.     new submitString[250];
  2669.     format(submitString, sizeof(submitString), "blacklist.pytalhost.net/lister.php?IP=%s", pIP);
  2670.  
  2671.     HTTP(playerid, HTTP_GET, submitString, "", "HTTPVerif");
  2672.     return 1;
  2673. }
  2674.  
  2675. public HTTPVerif(index, response_code, data[])
  2676. {
  2677.     if(response_code==200)
  2678.     {
  2679.         if(blonline==false)
  2680.         {
  2681.             for(new i=0, tx=GetMaxPlayers(); i<=tx; i++)if(IsPlayerConnected(i))if(!IsPlayerNPC(i))if(i!=index)
  2682.             {
  2683.                 GetPlayerVerification(i);
  2684.             }
  2685.             blonline=true;
  2686.         }
  2687.  
  2688.         new amount, day, month, year;
  2689.         if (sscanf(data, "p|iiii", amount, day, month, year))
  2690.         {
  2691.             SendClientMessage(index, COLOR_SYSTEM, "System: This server is {C8400B}protected {EFEFF7}by {33AA33}GreenAAC{EFEFF7}.");
  2692.             SendClientMessage(index, COLOR_SYSTEM, "System: Your connection information has been {33AA33}verified{EFEFF7}.");
  2693.             SetPVarInt(index, "BL_verif", 1);
  2694.             return 1;
  2695.         }
  2696.         else
  2697.         {
  2698.             new tday, tmonth, tyear, Sum, BDays;
  2699.             getdate(tyear, tmonth, tday);
  2700.  
  2701.             Sum=CalculateDaysBetweenDates(day,month,year,tday,tmonth,tyear);
  2702.             BDays=2^amount;
  2703.             printf("BDAYS %i", amount);
  2704.             if(BDays<=Sum)
  2705.             {
  2706.                 SendClientMessage(index, COLOR_SYSTEM, "System: This server is {33AA33}protected {EFEFF7}by GreenAAC.");
  2707.                 SendClientMessage(index, COLOR_SYSTEM, "System: Your connection information has been {33AA33}verified{EFEFF7}.");
  2708.                 SetPVarInt(index, "BL_verif", 1);
  2709.                 return 1;
  2710.             }
  2711.             else
  2712.             {
  2713.                 SendClientMessage(index, COLOR_SYSTEM, "System: This server is {33AA33}protected {EFEFF7}by GreenAAC.");
  2714.                 SendClientMessage(index, COLOR_ORANGE, "System: Your connection information is {E31515}unverified{EFEFF7}.");
  2715.                 SendClientMessage(index, COLOR_ORANGE, "System: You are {4F4F4F}blacklisted{EFEFF7} from all GreenAAC-Servers.");
  2716.                 new pIP[16];
  2717.                 GetPlayerIp(index, pIP, sizeof(pIP));
  2718.                 printf("%s is blacklisted. Player kicked.", pIP);
  2719.                 return Kick(index);
  2720.             }
  2721.         }
  2722.     }
  2723.     else
  2724.     {
  2725.         SendClientMessage(index, COLOR_SYSTEM, "System: This server is {33AA33}protected {EFEFF7}by GreenAAC.");
  2726.         SendClientMessage(index, COLOR_SYSTEM, "System: The GreenAAC-Blacklist is currently {E31515}offline{EFEFF7}.");
  2727.         blonline=false;
  2728.         return 1;
  2729.     }
  2730. }
  2731.  
  2732. public httpResponse(index, response_code, data[])
  2733. {
  2734.     if(response_code==200)
  2735.     {
  2736.         if(strfind(data, "LREACHED")!=-1){print("You have reached your blacklist limit.");print("You can try again next hour.");}
  2737.         else if(strfind(data, "SINVALID")!=-1){print("Your server has been marked as invalid.");print("You cannot blacklist players anymore. Connection rejected.");}
  2738.         else if(strfind(data, "1")!=-1)print("Successfully sent a blacklist-request.");
  2739.         else printf("Unknown Error: %s", data);
  2740.     }
  2741.     return 1;
  2742. }
  2743.  
  2744. #endif
  2745. /*-------------------------------------------------UNBLACKLIST--------------------------------------------------------------*/
  2746.  
  2747. // ...Copied out of uf.inc... (but still modified by me)
  2748.  
  2749. stock GetVehicleType(vehicleid)    //Originally by Gabriel "Larcius" Cordes
  2750. {
  2751.     new type=0;
  2752.  
  2753.     switch(GetVehicleModel(vehicleid))
  2754.     {
  2755.     case 581,523,462,521,463,522,461,448,468,586: type = VTYPE_BIKE;
  2756.     case 509,481,510: type = VTYPE_BMX;
  2757.     case 472,473,493,595,484,430,453,452,446,454: type = VTYPE_SEA;
  2758.     case 548,425,417,487,497,563,501,465,447,469,488: type = VTYPE_HELI;
  2759.     case 592,577,511,512,593,520,553,464,476,519,460,513,539 : type = VTYPE_PLANE;
  2760.     case 435,450,591,606,607,610,584,608,611  : type = 0;
  2761.     case 590,569,537,538,570,449: type = 0;
  2762.     default: type=0;
  2763.     }
  2764.     return type;
  2765. }
  2766.  
  2767. sscanf(string[], format[], {Float,_}:...)
  2768. {
  2769. #if defined isnull
  2770. if (isnull(string))
  2771. #else
  2772. if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
  2773. #endif
  2774. {return format[0];}
  2775. #pragma tabsize 4
  2776. new formatPos = 0,stringPos = 0,paramPos = 2,paramCount = numargs(),delim = ' ';while (string[stringPos] && string[stringPos] <= ' '){stringPos++;}
  2777. while (paramPos < paramCount && string[stringPos]){
  2778. switch (format[formatPos++]){case '\0':{return 0;}case 'i', 'd':{
  2779. new neg = 1,num = 0,ch = string[stringPos];if (ch == '-'){neg = -1;ch = string[++stringPos];}
  2780. do{stringPos++;if ('0' <= ch <= '9'){num = (num * 10) + (ch - '0');}else {return -1;}}
  2781. while ((ch = string[stringPos]) > ' ' && ch != delim);setarg(paramPos, 0, num * neg);}case 'h', 'x':{
  2782. new num = 0,ch = string[stringPos];do{stringPos++;switch (ch){case 'x', 'X':{num = 0;continue;}case '0' .. '9':{num = (num << 4) | (ch - '0');}case 'a' .. 'f':{num = (num << 4) | (ch - ('a' - 10));}case 'A' .. 'F':{num = (num << 4) | (ch - ('A' - 10));}default:{return -1;}}}while ((ch = string[stringPos]) > ' ' && ch != delim);
  2783. setarg(paramPos, 0, num);}case 'c':{setarg(paramPos, 0, string[stringPos++]);}case 'f':{
  2784. new changestr[16], changepos = 0, strpos = stringPos;while(changepos < 16 && string[strpos] && string[strpos] != delim){
  2785. changestr[changepos++] = string[strpos++];}changestr[changepos] = '\0';setarg(paramPos,0,_:floatstr(changestr));}case 'p':{delim = format[formatPos++];continue;}case '\'':{
  2786. new end = formatPos - 1,ch;while ((ch = format[++end]) && ch != '\'') {}if (!ch){
  2787. return -1;}format[end] = '\0';if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1){
  2788. if (format[end + 1]){return -1;}
  2789. return 0;}format[end] = '\'';stringPos = ch + (end - formatPos);formatPos = end + 1;}case 'u':{
  2790. new end = stringPos - 1,id = 0,bool:num = true,ch;while ((ch = string[++end]) && ch != delim){if (num){if ('0' <= ch <= '9'){id = (id * 10) + (ch - '0');}else{num = false;}}}
  2791. if (num && IsPlayerConnected(id)){setarg(paramPos, 0, id);}else{
  2792. #if !defined foreach
  2793. #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
  2794. #define __SSCANF_FOREACH__
  2795. #endif
  2796. string[end] = '\0';num = false;new name[MAX_PLAYER_NAME];id = end - stringPos;foreach (Player, playerid){GetPlayerName(playerid, name, sizeof (name));if (!strcmp(name, string[stringPos], true, id)){
  2797. setarg(paramPos, 0, playerid);num = true;break;}}if (!num){
  2798. setarg(paramPos, 0, INVALID_PLAYER_ID);}string[end] = ch;
  2799. #if defined __SSCANF_FOREACH__
  2800. #undef foreach
  2801. #undef __SSCANF_FOREACH__
  2802. #endif
  2803. }stringPos = end;}case 's', 'z':{
  2804. new i = 0,ch;if (format[formatPos]){
  2805. while ((ch = string[stringPos++]) && ch != delim){
  2806. setarg(paramPos, i++, ch);}if (!i){return -1;}}else{while ((ch = string[stringPos++])){
  2807. setarg(paramPos, i++, ch);}}stringPos--;setarg(paramPos, i, '\0');}default:{continue;}}
  2808. while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' '){stringPos++;}
  2809. while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' ')){
  2810. stringPos++;}paramPos++;}do{if ((delim = format[formatPos++]) > ' '){
  2811. if (delim == '\''){while ((delim = format[formatPos++]) && delim != '\'') {}}else if (delim != 'z'){return delim;}}}
  2812. while (delim > ' ');return 0;}
Advertisement
Add Comment
Please, Sign In to add comment