Advertisement
zreikmahmoud98

admin gamemode

Jul 17th, 2014
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 28.18 KB | None | 0 0
  1. // This is a comment
  2. // uncomment the line below if you want to write a filterscript
  3. //#define FILTERSCRIPT
  4.  
  5. #include <a_samp>
  6. #include <dini>
  7. #include <dutils>
  8. #include <sscanf>
  9. #pragma unused ret_memcpy
  10.  
  11. #define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
  12. #define COLOR_GREY 0xAFAFAFAA
  13. #define COLOR_ACTIVEBORDER 0xB4B4B4FF
  14. #define COLOR_ACTIVECAPTION 0x99B4D1FF
  15. #define COLOR_ACTIVECAPTIONTEXT 0x000000FF
  16. #define COLOR_ALICEBLUE 0xF0F8FFFF
  17. #define COLOR_ANTIQUEWHITE 0xFAEBD7FF
  18. #define COLOR_APPWORKSPACE 0xABABABFF
  19. #define COLOR_AQUA 0x00FFFFFF
  20. #define COLOR_AQUAMARINE 0x7FFFD4FF
  21. #define COLOR_AZURE 0xF0FFFFFF
  22. #define COLOR_BEIGE 0xF5F5DCFF
  23. #define COLOR_BISQUE 0xFFE4C4FF
  24. #define COLOR_BLACK 0x000000FF
  25. #define COLOR_BLANCHEDALMOND 0xFFEBCDFF
  26. #define COLOR_BLUE 0x0000FFFF
  27. #define COLOR_BLUEVIOLET 0x8A2BE2FF
  28. #define COLOR_BROWN 0xA52A2AFF
  29. #define COLOR_BURLYWOOD 0xDEB887FF
  30. #define COLOR_BUTTONFACE 0xF0F0F0FF
  31. #define COLOR_BUTTONHIGHLIGHT 0xFFFFFFFF
  32. #define COLOR_BUTTONSHADOW 0xA0A0A0FF
  33. #define COLOR_CADETBLUE 0x5F9EA0FF
  34. #define COLOR_CHARTREUSE 0x7FFF00FF
  35. #define COLOR_CHOCOLATE 0xD2691EFF
  36. #define COLOR_CONTROL 0xF0F0F0FF
  37. #define COLOR_CONTROLDARK 0xA0A0A0FF
  38. #define COLOR_CONTROLDARKDARK 0x696969FF
  39. #define COLOR_CONTROLLIGHT 0xE3E3E3FF
  40. #define COLOR_CONTROLLIGHTLIGHT 0xFFFFFFFF
  41. #define COLOR_CONTROLTEXT 0x000000FF
  42. #define COLOR_CORAL 0xFF7F50FF
  43. #define COLOR_CORNFLOWERBLUE 0x6495EDFF
  44. #define COLOR_CORNSILK 0xFFF8DCFF
  45. #define COLOR_CRIMSON 0xDC143CFF
  46. #define COLOR_CYAN 0x00FFFFFF
  47. #define COLOR_DARKBLUE 0x00008BFF
  48. #define COLOR_DARKCYAN 0x008B8BFF
  49. #define COLOR_DARKGOLDENROD 0xB8860BFF
  50. #define COLOR_DARKGRAY 0xA9A9A9FF
  51. #define COLOR_DARKGREEN 0x006400FF
  52. #define COLOR_DARKKHAKI 0xBDB76BFF
  53. #define COLOR_DARKMAGENTA 0x8B008BFF
  54. #define COLOR_DARKOLIVEGREEN 0x556B2FFF
  55. #define COLOR_DARKORANGE 0xFF8C00FF
  56. #define COLOR_DARKORCHID 0x9932CCFF
  57. #define COLOR_DARKRED 0x8B0000FF
  58. #define COLOR_DARKSALMON 0xE9967AFF
  59. #define COLOR_DARKSEAGREEN 0x8FBC8BFF
  60. #define COLOR_DARKSLATEBLUE 0x483D8BFF
  61. #define COLOR_DARKSLATEGRAY 0x2F4F4FFF
  62. #define COLOR_DARKTURQUOISE 0x00CED1FF
  63. #define COLOR_DARKVIOLET 0x9400D3FF
  64. #define COLOR_DEEPPINK 0xFF1493FF
  65. #define COLOR_DEEPSKYBLUE 0x00BFFFFF
  66. #define COLOR_DESKTOP 0x000000FF
  67. #define COLOR_DIMGRAY 0x696969FF
  68. #define COLOR_DODGERBLUE 0x1E90FFFF
  69. #define COLOR_FIREBRICK 0xB22222FF
  70. #define COLOR_FLORALWHITE 0xFFFAF0FF
  71. #define COLOR_FORESTGREEN 0x228B22FF
  72. #define COLOR_FUCHSIA 0xFF00FFFF
  73. #define COLOR_GAINSBORO 0xDCDCDCFF
  74. #define COLOR_GHOSTWHITE 0xF8F8FFFF
  75. #define COLOR_GOLD 0xFFD700FF
  76. #define COLOR_GOLDENROD 0xDAA520FF
  77. #define COLOR_GRADIENTACTIVECAPTION 0xB9D1EAFF
  78. #define COLOR_GRADIENTINACTIVECAPTION 0xD7E4F2FF
  79. #define COLOR_GRAY 0x808080FF
  80. #define COLOR_GRAYTEXT 0x808080FF
  81. #define COLOR_GREEN 0x008000FF
  82. #define COLOR_GREENYELLOW 0xADFF2FFF
  83. #define COLOR_HIGHLIGHT 0x3399FFFF
  84. #define COLOR_HIGHLIGHTTEXT 0xFFFFFFFF
  85. #define COLOR_HONEYDEW 0xF0FFF0FF
  86. #define COLOR_HOTPINK 0xFF69B4FF
  87. #define COLOR_HOTTRACK 0x0066CCFF
  88. #define COLOR_INACTIVEBORDER 0xF4F7FCFF
  89. #define COLOR_INACTIVECAPTION 0xBFCDDBFF
  90. #define COLOR_INACTIVECAPTIONTEXT 0x434E54FF
  91. #define COLOR_INDIANRED 0xCD5C5CFF
  92. #define COLOR_INDIGO 0x4B0082FF
  93. #define COLOR_INFO 0xFFFFE1FF
  94. #define COLOR_INFOTEXT 0x000000FF
  95. #define COLOR_IVORY 0xFFFFF0FF
  96. #define COLOR_KHAKI 0xF0E68CFF
  97. #define COLOR_LAVENDER 0xE6E6FAFF
  98. #define COLOR_LAVENDERBLUSH 0xFFF0F5FF
  99. #define COLOR_LAWNGREEN 0x7CFC00FF
  100. #define COLOR_LEMONCHIFFON 0xFFFACDFF
  101. #define COLOR_LIGHTBLUE 0xADD8E6FF
  102. #define COLOR_LIGHTCORAL 0xF08080FF
  103. #define COLOR_LIGHTCYAN 0xE0FFFFFF
  104. #define COLOR_LIGHTGOLDENRODYELLOW 0xFAFAD2FF
  105. #define COLOR_LIGHTGRAY 0xD3D3D3FF
  106. #define COLOR_LIGHTGREEN 0x90EE90FF
  107. #define COLOR_LIGHTPINK 0xFFB6C1FF
  108. #define COLOR_LIGHTSALMON 0xFFA07AFF
  109. #define COLOR_LIGHTSEAGREEN 0x20B2AAFF
  110. #define COLOR_LIGHTSKYBLUE 0x87CEFAFF
  111. #define COLOR_LIGHTSLATEGRAY 0x778899FF
  112. #define COLOR_LIGHTSTEELBLUE 0xB0C4DEFF
  113. #define COLOR_LIGHTYELLOW 0xFFFFE0FF
  114. #define COLOR_LIME 0x00FF00FF
  115. #define COLOR_LIMEGREEN 0x32CD32FF
  116. #define COLOR_LINEN 0xFAF0E6FF
  117. #define COLOR_MAGENTA 0xFF00FFFF
  118. #define COLOR_MAROON 0x800000FF
  119. #define COLOR_MEDIUMAQUAMARINE 0x66CDAAFF
  120. #define COLOR_MEDIUMBLUE 0x0000CDFF
  121. #define COLOR_MEDIUMORCHID 0xBA55D3FF
  122. #define COLOR_MEDIUMPURPLE 0x9370DBFF
  123. #define COLOR_MEDIUMSEAGREEN 0x3CB371FF
  124. #define COLOR_MEDIUMSLATEBLUE 0x7B68EEFF
  125. #define COLOR_MEDIUMSPRINGGREEN 0x00FA9AFF
  126. #define COLOR_MEDIUMTURQUOISE 0x48D1CCFF
  127. #define COLOR_MEDIUMVIOLETRED 0xC71585FF
  128. #define COLOR_MENU 0xF0F0F0FF
  129. #define COLOR_MENUBAR 0xF0F0F0FF
  130. #define COLOR_MENUHIGHLIGHT 0x3399FFFF
  131. #define COLOR_MENUTEXT 0x000000FF
  132. #define COLOR_MIDNIGHTBLUE 0x191970FF
  133. #define COLOR_MINTCREAM 0xF5FFFAFF
  134. #define COLOR_MISTYROSE 0xFFE4E1FF
  135. #define COLOR_MOCCASIN 0xFFE4B5FF
  136. #define COLOR_NAVAJOWHITE 0xFFDEADFF
  137. #define COLOR_NAVY 0x000080FF
  138. #define COLOR_OLDLACE 0xFDF5E6FF
  139. #define COLOR_OLIVE 0x808000FF
  140. #define COLOR_OLIVEDRAB 0x6B8E23FF
  141. #define COLOR_ORANGE 0xFFA500FF
  142. #define COLOR_ORANGERED 0xFF4500FF
  143. #define COLOR_ORCHID 0xDA70D6FF
  144. #define COLOR_PALEGOLDENROD 0xEEE8AAFF
  145. #define COLOR_PALEGREEN 0x98FB98FF
  146. #define COLOR_PALETURQUOISE 0xAFEEEEFF
  147. #define COLOR_PALEVIOLETRED 0xDB7093FF
  148. #define COLOR_PAPAYAWHIP 0xFFEFD5FF
  149. #define COLOR_PEACHPUFF 0xFFDAB9FF
  150. #define COLOR_PERU 0xCD853FFF
  151. #define COLOR_PINK 0xFFC0CBFF
  152. #define COLOR_PLUM 0xDDA0DDFF
  153. #define COLOR_POWDERBLUE 0xB0E0E6FF
  154. #define COLOR_PURPLE 0x800080FF
  155. #define COLOR_RED 0xFF0000FF
  156. #define COLOR_YELLOW 0xFFFF00FF
  157.  
  158. #define PlayerFile "Admin/Users/%s.ini"
  159. #define CommandFile "Admin/Settings/Commands.ini"
  160.  
  161. enum PLAYER_MAIN {
  162.         PLAYER_NAME[MAX_PLAYER_NAME],
  163.         PLAYER_IP[16],
  164.         PLAYER_REGGED,
  165.         PLAYER_PASS,
  166.         PLAYER_LEVEL,
  167.         PLAYER_MONEY,
  168. }
  169. new gPlayerInfo[MAX_PLAYERS][PLAYER_MAIN];
  170. new gPlayerLogged[MAX_PLAYERS];
  171. new pName[MAX_PLAYER_NAME];
  172.  
  173. enum COMMANDS_MAIN {
  174.     KICK,
  175.     BAN,
  176.     KILL,
  177.     ANN,
  178.     AGIVEARMOUR,
  179.     SETVH,
  180.     EXPLODE,
  181.     FLIP,
  182.     GOTO,
  183.     GET,
  184.     GIVEARMOUR,
  185.     GIVEHEALTH,
  186.     GIVEWEAPON,
  187.     GOD,
  188.     AHEAL,
  189.     IMITATE,
  190.     GETIP,
  191.     MAXAMMO,
  192.     MAXPING,
  193.     MAKEADMIN,
  194.     SETWANTED,
  195.     TBAN,
  196.     SETTIME,
  197.     SETWEATHER
  198. }
  199. new gCommands[COMMANDS_MAIN];
  200.  
  201. new material1;
  202. new material2;
  203. new material3;
  204. new material4;
  205. new material5;
  206. new material6;
  207. new material7;
  208. new material8;
  209. new material9;
  210. new material10;
  211. new material11;
  212. new material12;
  213. new material13;
  214. new material14;
  215. new material15;
  216.  
  217. main()
  218. {
  219.     print("\n----------------------------------");
  220.     print(" Da_Light by Da_Light");
  221.     print("----------------------------------\n");
  222. }
  223.  
  224. public OnGameModeInit()
  225. {
  226.     // Don't use these lines if it's a filterscript
  227.     SetGameModeText("Freeroam");
  228.     AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  229.    
  230.    
  231.     if(!fexist(CommandFile))
  232.     {
  233.         dini_Create(CommandFile);
  234.         dini_IntSet(CommandFile, "Kick", 1);
  235.         dini_IntSet(CommandFile, "Ban", 2);
  236.         dini_IntSet(CommandFile, "Kill", 1);
  237.         dini_IntSet(CommandFile, "Ann", 2);
  238.         dini_IntSet(CommandFile, "Agivearmour", 4);
  239.         dini_IntSet(CommandFile, "Setvh", 3);
  240.         dini_IntSet(CommandFile, "Explode", 1);
  241.         dini_IntSet(CommandFile, "Flip", 1);
  242.         dini_IntSet(CommandFile, "Goto", 3);
  243.         dini_IntSet(CommandFile, "Get", 3);
  244.         dini_IntSet(CommandFile, "Givearmour", 4);
  245.         dini_IntSet(CommandFile, "Givehealth", 4);
  246.         dini_IntSet(CommandFile, "Giveweapon", 4);
  247.         dini_IntSet(CommandFile, "God", 5);
  248.         dini_IntSet(CommandFile, "Aheal", 4);
  249.         dini_IntSet(CommandFile, "Imitate", 3);
  250.         dini_IntSet(CommandFile, "Getip", 1);
  251.         dini_IntSet(CommandFile, "Maxammo", 2);
  252.         dini_IntSet(CommandFile, "Maxping", 2);
  253.         dini_IntSet(CommandFile, "Makeadmin", 5);
  254.         dini_IntSet(CommandFile, "Setwanted", 4);
  255.         dini_IntSet(CommandFile, "Tban", 2);
  256.         dini_IntSet(CommandFile, "Settime", 2);
  257.         dini_IntSet(CommandFile, "Setweather", 2);
  258.     }
  259.  
  260.     gCommands[KICK] = dini_Int(CommandFile, "Kick");
  261.     gCommands[BAN] = dini_Int(CommandFile, "Ban");
  262.     gCommands[KILL] = dini_Int(CommandFile, "Kill");
  263.     gCommands[ANN] = dini_Int(CommandFile, "Ann");
  264.     gCommands[AGIVEARMOUR] = dini_Int(CommandFile, "Agivearmour");
  265.     gCommands[SETVH] = dini_Int(CommandFile, "Setvh");
  266.     gCommands[EXPLODE] = dini_Int(CommandFile, "Explode");
  267.     gCommands[FLIP] = dini_Int(CommandFile, "Flip");
  268.     gCommands[GOTO] = dini_Int(CommandFile, "Goto");
  269.     gCommands[GET] = dini_Int(CommandFile, "Get");
  270.     gCommands[GIVEARMOUR] = dini_Int(CommandFile, "Givearmour");
  271.     gCommands[GIVEHEALTH] = dini_Int(CommandFile, "Givehealth");
  272.     gCommands[GIVEWEAPON] = dini_Int(CommandFile, "Giveweapon");
  273.     gCommands[GOD] = dini_Int(CommandFile, "God");
  274.     gCommands[AHEAL] = dini_Int(CommandFile, "Aheal");
  275.     gCommands[IMITATE] = dini_Int(CommandFile, "Imitate");
  276.     gCommands[GETIP] = dini_Int(CommandFile, "Getip");
  277.     gCommands[MAXAMMO] = dini_Int(CommandFile, "Maxammo");
  278.     gCommands[MAXPING] = dini_Int(CommandFile, "Maxping");
  279.     gCommands[MAKEADMIN] = dini_Int(CommandFile, "Makeadmin");
  280.     gCommands[SETWANTED] = dini_Int(CommandFile, "Setwanted");
  281.     gCommands[TBAN] = dini_Int(CommandFile, "Tban");
  282.     gCommands[SETTIME] = dini_Int(CommandFile, "Settime");
  283.     gCommands[SETWEATHER] = dini_Int(CommandFile, "Setweather");
  284.  
  285.     //OBJECTS
  286.     CreateObject(18225,521.0999800,-2362.1999500,0.0000000,0.0000000,0.0000000,14.0000000); //object(cunt_rockgp2_18) (1)
  287.     CreateObject(18225,489.6992200,-2334.5000000,-10.0000000,0.0000000,0.0000000,0.0000000); //object(cunt_rockgp2_18) (2)
  288.     CreateObject(18225,571.2000100,-2364.1001000,0.0000000,0.0000000,0.0000000,344.0000000); //object(cunt_rockgp2_18) (3)
  289.     CreateObject(18225,608.9000200,-2386.1999500,0.0000000,0.0000000,0.0000000,356.0000000); //object(cunt_rockgp2_18) (4)
  290.     CreateObject(18225,638.0000000,-2386.1999500,26.8000000,0.0000000,0.0000000,0.0000000); //object(cunt_rockgp2_18) (5)
  291.     CreateObject(18225,666.8994100,-2416.6992200,0.0000000,0.0000000,0.0000000,0.0000000); //object(cunt_rockgp2_18) (6)
  292.     CreateObject(18225,601.7000100,-2352.8999000,31.4000000,0.0000000,0.0000000,0.0000000); //object(cunt_rockgp2_18) (7)
  293.     CreateObject(18225,558.5999800,-2335.8000500,33.2000000,0.0000000,0.0000000,0.0000000); //object(cunt_rockgp2_18) (8)
  294.     CreateObject(18225,525.2999900,-2307.3999000,46.1000000,0.0000000,0.0000000,0.0000000); //object(cunt_rockgp2_18) (9)
  295.     CreateObject(18225,488.0000000,-2302.0000000,21.1000000,0.0000000,0.0000000,34.0000000); //object(cunt_rockgp2_18) (10)
  296.     CreateObject(6315,663.2000100,-2430.3000500,0.0000000,0.0000000,0.0000000,0.0000000); //object(bealand01_law2) (2)
  297.     CreateObject(6315,573.0000000,-2380.8994100,0.0000000,0.0000000,0.0000000,0.0000000); //object(bealand01_law2) (3)
  298.     CreateObject(6315,614.5996100,-2454.7998000,-2.8000000,0.0000000,0.0000000,339.9990000); //object(bealand01_law2) (4)
  299.     CreateObject(18225,521.5000000,-2335.0996100,0.0000000,0.0000000,0.0000000,31.9980000); //object(cunt_rockgp2_18) (15)
  300.     CreateObject(6315,507.0000000,-2358.2998000,3.0000000,0.0000000,0.0000000,339.9990000); //object(bealand01_law2) (5)
  301.     CreateObject(6315,589.9000200,-2420.0000000,-4.0000000,0.0000000,0.0000000,0.0000000); //object(bealand01_law2) (6)
  302.     CreateObject(6315,585.0000000,-2428.0000000,-2.8000000,0.0000000,0.0000000,0.0000000); //object(bealand01_law2) (7)
  303.     CreateObject(6315,507.0000000,-2357.0000000,3.0000000,0.0000000,0.0000000,339.9990000); //object(bealand01_law2) (8)
  304.     CreateObject(18225,618.2998000,-2387.0996100,0.0000000,0.0000000,0.0000000,355.9950000); //object(cunt_rockgp2_18) (16)
  305.  
  306.     //Vehicles
  307.     AddStaticVehicleEx(588,-895.9000200,2508.0000000,41.6000000,47.9970000,245,245,15); //Hotdog
  308.     AddStaticVehicleEx(588,-922.2999900,2514.3000000,41.6700000,7.9870000,245,245,15); //Hotdog
  309.     AddStaticVehicleEx(405,1381.1999500,-3366.6001000,50.0000000,206.0000000,32,32,15); //Sentinel
  310.     AddStaticVehicleEx(405,1388.4000200,-3365.3000500,50.0000000,205.9990000,32,32,15); //Sentinel
  311.     AddStaticVehicleEx(405,1373.0000000,-3367.5000000,50.0000000,205.9990000,32,32,15); //Sentinel
  312.     AddStaticVehicleEx(405,1394.9000200,-3364.5000000,50.0000000,205.9990000,32,32,15); //Sentinel
  313.     AddStaticVehicleEx(409,1451.5999800,-3368.3000500,49.9000000,156.0000000,245,245,15); //Stretch
  314.     AddStaticVehicleEx(409,1440.6992200,-3368.5000000,49.9000000,157.9950000,245,245,15); //Stretch
  315.     AddStaticVehicleEx(409,1462.8000500,-3368.5000000,49.9000000,155.9950000,245,245,15); //Stretch
  316.     AddStaticVehicleEx(409,1472.0999800,-3369.1001000,49.9000000,155.9950000,245,245,15); //Stretch
  317.     AddStaticVehicleEx(544,1402.6992200,-3543.7998000,50.4000000,0.0000000,132,4,15); //Firetruck LA
  318.     AddStaticVehicleEx(544,1408.5999800,-3544.0000000,50.4000000,0.0000000,132,4,15); //Firetruck LA
  319.     AddStaticVehicleEx(544,1376.6999500,-3543.8000500,50.4000000,0.0000000,132,4,15); //Firetruck LA
  320.     AddStaticVehicleEx(544,1396.5000000,-3543.0000000,50.4000000,0.0000000,132,4,15); //Firetruck LA
  321.     AddStaticVehicleEx(407,1452.0000000,-3547.3000500,50.4000000,0.0000000,132,4,15); //Firetruck
  322.     AddStaticVehicleEx(407,1444.5999800,-3545.3999000,50.4000000,0.0000000,132,4,15); //Firetruck
  323.     AddStaticVehicleEx(407,1391.0000000,-3543.3000500,50.4000000,0.0000000,132,4,15); //Firetruck
  324.     AddStaticVehicleEx(407,1384.5999800,-3544.0000000,50.4000000,0.0000000,132,4,15); //Firetruck
  325.     AddStaticVehicleEx(541,1423.8000500,-3544.6999500,49.7000000,0.0000000,6,15,15); //Bullet
  326.     AddStaticVehicleEx(541,1419.0999800,-3545.0000000,49.7000000,0.0000000,242,218,15); //Bullet
  327.     AddStaticVehicleEx(529,1428.3000500,-3544.1001000,50.0000000,0.0000000,145,-1,15); //Willard
  328.     AddStaticVehicleEx(529,1439.9000200,-3544.5000000,50.0000000,0.0000000,145,-1,15); //Willard
  329.     AddStaticVehicleEx(506,1393.4000200,-3375.0000000,49.7000000,209.9950000,132,4,15); //Super GT
  330.     AddStaticVehicleEx(506,1387.3994100,-3377.2998000,49.7000000,209.9980000,132,4,15); //Super GT
  331.     AddStaticVehicleEx(480,1446.0999800,-3380.5000000,49.8000000,153.9960000,157,152,15); //Comet
  332.     AddStaticVehicleEx(480,1452.2998000,-3382.1992200,49.8000000,153.9950000,157,152,15); //Comet
  333.     AddStaticVehicleEx(454,-966.0000000,2557.0000000,40.3000000,180.0000000,165,169,15); //Tropic
  334.     AddStaticVehicleEx(454,-957.2998000,2557.0000000,40.3000000,180.0000000,165,169,15); //Tropic
  335.     AddStaticVehicleEx(460,-908.0000000,2314.0000000,42.9000000,180.0000000,115,14,15); //Skimmer
  336.     AddStaticVehicleEx(563,-1003.8000000,2366.1001000,43.1000000,0.0000000,245,245,15); //Raindance
  337.     return 1;
  338. }
  339.  
  340.  
  341. public OnPlayerRequestClass(playerid, classid)
  342. {
  343.     SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  344.     SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  345.     SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  346.     return 1;
  347. }
  348.  
  349. public OnPlayerConnect(playerid)
  350. {
  351.     new file[100], name[MAX_PLAYER_NAME];
  352.     GetPlayerName(playerid, name, sizeof(name));
  353.     format(file, sizeof(file), PlayerFile, name);
  354.     if(!fexist(file))
  355.     {
  356.         ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, "Register", "{FF0000}You're name isn't found to be registered in our database. \n{00FFFF}Please enter a new password to register.", "Register", "Exit");
  357.     }
  358.     else if(fexist(file))
  359.     {
  360.         ShowPlayerDialog(playerid, 2, DIALOG_STYLE_PASSWORD, "Login", "{00FF00}You're name is found to be registered in our database. \n{00FFFF}Please enter your password to login.", "Login", "Exit");
  361.     }
  362.     return 1;
  363. }
  364.  
  365. public OnPlayerDisconnect(playerid, reason)
  366. {
  367.     new file[100];
  368.     format(file, sizeof(file), PlayerFile, gPlayerInfo[playerid][PLAYER_NAME]);
  369.     dini_Set(file, "Name", gPlayerInfo[playerid][PLAYER_NAME]);
  370.     dini_Set(file, "Ip", gPlayerInfo[playerid][PLAYER_IP]);
  371.     dini_IntSet(file, "Registered", gPlayerInfo[playerid][PLAYER_REGGED]);
  372.     dini_IntSet(file, "Password", gPlayerInfo[playerid][PLAYER_PASS]);
  373.     dini_IntSet(file, "Level", gPlayerInfo[playerid][PLAYER_LEVEL]);
  374.     dini_IntSet(file, "Money", GetPlayerMoney(playerid));
  375.     gPlayerLogged[playerid] = 0;
  376.     return 1;
  377. }
  378.  
  379. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  380. {
  381.     if(dialogid == 1)
  382.     {
  383.         if(response)
  384.         {
  385.             new file[100];
  386.             new name[MAX_PLAYER_NAME];
  387.             new ip[30];
  388.             new string[128];
  389.             GetPlayerName(playerid, name, sizeof(name));
  390.             GetPlayerIp(playerid, ip, sizeof(ip));
  391.             format(file, sizeof(file), PlayerFile, name);
  392.             dini_Create(file);
  393.             dini_Set(file, "Name", name);
  394.             dini_Set(file, "Ip", ip);
  395.             dini_IntSet(file, "Registered", 1);
  396.             dini_IntSet(file, "Password", num_hash(inputtext));
  397.             dini_IntSet(file, "Level", 0);
  398.             dini_IntSet(file, "Money", 50);
  399.             format(string, sizeof(string), ">> Success: {FFFFFF}You succesfully registered. Name: {FF0000}%s {FFFFFF}/ Password: {FFFF00}%s", name, inputtext);
  400.             SendClientMessage(playerid, COLOR_GREEN, string);
  401.             strcat(gPlayerInfo[playerid][PLAYER_NAME], dini_Get(file, "Name"));
  402.             strcat(gPlayerInfo[playerid][PLAYER_IP], dini_Get(file, "Ip"));
  403.             gPlayerInfo[playerid][PLAYER_PASS] = dini_Int(file, "Password");
  404.             gPlayerInfo[playerid][PLAYER_LEVEL] = dini_Int(file, "Level");
  405.             GivePlayerMoney(playerid, dini_Int(file, "Money"));
  406.             gPlayerLogged[playerid] = 1;
  407.         }
  408.         else if(!response)
  409.         {
  410.             SendClientMessage(playerid, -1, "~r~>> Error: ~w~You need to register in order to play!");
  411.             PlayerPlaySound(playerid, 1150, 0.0, 0.0, 10.0);
  412.             Kick(playerid);
  413.         }
  414.     }
  415.  
  416.     if(dialogid == 2)
  417.     {
  418.         if(response)
  419.         {
  420.             if(strlen(inputtext))
  421.             {
  422.                 new file[100], name[MAX_PLAYER_NAME], string[128];
  423.                 GetPlayerName(playerid, name, sizeof(name));
  424.                 format(file, sizeof(file), PlayerFile, name);
  425.                 if(num_hash(inputtext) == dini_Int(file, "Password"))
  426.                 {
  427.                     strcat(gPlayerInfo[playerid][PLAYER_NAME], dini_Get(file, "Name"));
  428.                     strcat(gPlayerInfo[playerid][PLAYER_IP], dini_Get(file, "Ip"));
  429.                     gPlayerInfo[playerid][PLAYER_PASS] = dini_Int(file, "Password");
  430.                     gPlayerInfo[playerid][PLAYER_LEVEL] = dini_Int(file, "Level");
  431.                     GivePlayerMoney(playerid, dini_Int(file, "Money"));
  432.                     gPlayerLogged[playerid] = 1;
  433.                     format(string, sizeof(string), "~g~>> Success: ~w~Welcome back, %s", name);
  434.                     SendClientMessage(playerid, -1, string);
  435.                 }
  436.                 else if(num_hash(inputtext) != dini_Int(file, "Password"))
  437.                 {
  438.                     SendClientMessage(playerid, -1, "~r~>> Error: ~w~Wrong password!");
  439.                     PlayerPlaySound(playerid, 1150, 0.0, 0.0, 10.0);
  440.                     ShowPlayerDialog(playerid, 2, DIALOG_STYLE_PASSWORD, "Login", "{00FF00}You're name is found to be registered in our database. \n{00FFFF}Please enter your password to login.", "Login", "Exit");
  441.                 }
  442.             }
  443.             else if(!strlen(inputtext))
  444.             {
  445.                 SendClientMessage(playerid, COLOR_RED, "~r~>> Error: ~w~You must enter your password!");
  446.                 PlayerPlaySound(playerid, 1150, 0.0, 0.0, 10.0);
  447.                 ShowPlayerDialog(playerid, 2, DIALOG_STYLE_PASSWORD, "Login", "{00FF00}You're name is found to be registered in our database. \n{00FFFF}Please enter your password to login.", "Login", "Exit");
  448.             }
  449.         }
  450.         else if(!response)
  451.         {
  452.             SendClientMessage(playerid, COLOR_RED, "~r~>> Error: ~w~You need to logon in order to play!");
  453.             PlayerPlaySound(playerid, 1150, 0.0, 0.0, 10.0);
  454.             Kick(playerid);
  455.         }
  456.     }
  457.     return 1;
  458. }
  459.  
  460. public OnPlayerCommandText(playerid, cmdtext[])
  461. {
  462.     dcmd(kick, 4, cmdtext);
  463.     dcmd(ban, 3, cmdtext);
  464.     dcmd(kill, 4, cmdtext);
  465.     dcmd(ann, 3, cmdtext);
  466.     return 0;
  467. }
  468.  
  469. dcmd_kick(playerid, params[])
  470. {
  471.     if(gPlayerInfo[playerid][PLAYER_LEVEL] < gCommands[KICK])
  472.     {
  473.         new string[128];
  474.         format(string, sizeof(string), ">> Error: {FFFFFF}You are not authorized to do that!", gCommands[KICK]);
  475.         SendClientMessage(playerid, COLOR_RED, string);
  476.     }
  477.     else
  478.     {
  479.         new tmp[256], tmp2[256], index, id;
  480.         tmp = strtok(params, index);
  481.         tmp2 = strtok(params, index);
  482.  
  483.         if(!strlen(tmp))
  484.         {
  485.             SendClientMessage(playerid, COLOR_ORANGE, ">> Kick: {FFFFFF}/kick [ID] [Reason]");
  486.         }
  487.         else if(!strlen(tmp2))
  488.         {
  489.             SendClientMessage(playerid, COLOR_ORANGE, ">> Kick: {FFFFFF}/kick [ID] [Reason]");
  490.         }
  491.         else
  492.         {
  493.             id = strval(tmp);
  494.             if(!IsPlayerConnected(id))
  495.             {
  496.                 SendClientMessage(playerid, COLOR_RED, ">> Error: {FFFFFF}The player is not connected.");
  497.             }
  498.             else if(id == playerid)
  499.             {
  500.                 SendClientMessage(playerid, COLOR_RED, ">> Error: {FFFFFF}You can't kick yourself.");
  501.             }
  502.             else if(gPlayerInfo[id][PLAYER_LEVEL] > gPlayerInfo[playerid][PLAYER_LEVEL])
  503.             {
  504.                 SendClientMessage(playerid, COLOR_RED, ">> Error: {FFFFFF}You are not authorized to kick an admin with a higher level than you!");
  505.             }
  506.             else
  507.             {
  508.                 new string[256], name[MAX_PLAYER_NAME];
  509.                 GetPlayerName(id, name, sizeof(name));
  510.                 GetPlayerName(playerid, pName, sizeof(pName));
  511.                 if(id >= 0 && id <= 9)
  512.                 {
  513.                     GetPlayerName(playerid, pName, sizeof(pName));
  514.                     format(string, sizeof(string), ">> Server: You have been kicked by %s. (Reason: %s.)", pName, params[2]);
  515.                     SendClientMessage(id, COLOR_RED, string);
  516.                     Kick(id);
  517.                     format(string, sizeof(string), ">> Server: %s has kicked %s. (Reason: %s.)", pName, name, params[2]);
  518.                     SendClientMessageToAll(COLOR_RED, string);
  519.                 }
  520.                 else if(id >= 10 && id <= 99)
  521.                 {
  522.                     GetPlayerName(playerid, pName, sizeof(pName));
  523.                     format(string, sizeof(string), ">> Server: You have been kicked by %s. (Reason: %s.)", pName, params[3]);
  524.                     SendClientMessage(id, COLOR_RED, string);
  525.                     Kick(id);
  526.                     format(string, sizeof(string), ">> Server: %s has kicked %s. (Reason: %s.)", pName, name, params[3]);
  527.                     SendClientMessageToAll(COLOR_RED, string);
  528.                 }
  529.             }
  530.         }
  531.     }
  532.     return 1;
  533. }
  534.  
  535. dcmd_ban(playerid, params[])
  536. {
  537.     if(gPlayerInfo[playerid][PLAYER_LEVEL] < gCommands[BAN])
  538.     {
  539.         new string[128];
  540.         format(string, sizeof(string), ">> Error: {FFFFFF}You are not authorized to do that!", gCommands[BAN]);
  541.         SendClientMessage(playerid, COLOR_RED, string);
  542.     }
  543.     else
  544.     {
  545.         new tmp[256], tmp2[256], index, id;
  546.         tmp = strtok(params, index);
  547.         tmp2 = strtok(params, index);
  548.  
  549.         if(!strlen(tmp))
  550.         {
  551.             SendClientMessage(playerid, COLOR_ORANGE, ">> Ban: {FFFFFF}/ban [ID] [Reason]");
  552.         }
  553.         else if(!strlen(tmp2))
  554.         {
  555.             SendClientMessage(playerid, COLOR_ORANGE, ">> Ban: {FFFFFF}/ban [ID] [Reason]");
  556.         }
  557.         else
  558.         {
  559.             id = strval(tmp);
  560.             if(!IsPlayerConnected(id))
  561.             {
  562.                 SendClientMessage(playerid, COLOR_RED, ">> Error: {FFFFFF}The player is not connected.");
  563.             }
  564.             else if(id == playerid)
  565.             {
  566.                 SendClientMessage(playerid, COLOR_RED, ">> Error: {FFFFFF}You can't ban yourself.");
  567.             }
  568.             else if(gPlayerInfo[id][PLAYER_LEVEL] > gPlayerInfo[playerid][PLAYER_LEVEL])
  569.             {
  570.                 SendClientMessage(playerid, COLOR_RED, ">> Error: {FFFFFF}You are not authorized to ban an admin with a higher level than you!");
  571.             }
  572.             else
  573.             {
  574.                 new string[256], name[MAX_PLAYER_NAME];
  575.                 GetPlayerName(id, name, sizeof(name));
  576.                 GetPlayerName(playerid, pName, sizeof(pName));
  577.                 if(id >= 0 && id <= 9)
  578.                 {
  579.                     GetPlayerName(playerid, pName, sizeof(pName));
  580.                     format(string, sizeof(string), ">> Server: You have been banned by %s. (Reason: %s.)", pName, params[2]);
  581.                     SendClientMessage(id, COLOR_RED, string);
  582.                     BanEx(id, params[2]);
  583.                     format(string, sizeof(string), ">> Server: %s has banned %s. (Reason: %s.)", pName, name, params[2]);
  584.                     SendClientMessageToAll(COLOR_RED, string);
  585.                 }
  586.                 else if(id >= 10 && id <= 99)
  587.                 {
  588.                     GetPlayerName(playerid, pName, sizeof(pName));
  589.                     format(string, sizeof(string), ">> Server: You have been banned by %s. (Reason: %s.)", pName, params[3]);
  590.                     SendClientMessage(id, COLOR_RED, string);
  591.                     BanEx(id, params[3]);
  592.                     format(string, sizeof(string), ">> Server: %s has banned %s. (Reason: %s.)", pName, name, params[3]);
  593.                     SendClientMessageToAll(COLOR_RED, string);
  594.                 }
  595.             }
  596.         }
  597.     }
  598.     return 1;
  599. }
  600.  
  601. dcmd_kill(playerid, params[])
  602. {
  603.     if(gPlayerInfo[playerid][PLAYER_LEVEL] < gCommands[KILL])
  604.     {
  605.         new string[128];
  606.         format(string, sizeof(string), ">> Error: {FFFFFF}You are not authorized to do that!", gCommands[KILL]);
  607.         SendClientMessage(playerid, COLOR_RED, string);
  608.     }
  609.     else
  610.     {
  611.         new tmp[256], tmp2[256], index, id;
  612.         tmp = strtok(params, index);
  613.         tmp2 = strtok(params, index);
  614.  
  615.         if(!strlen(tmp))
  616.         {
  617.             SendClientMessage(playerid, COLOR_ORANGE, ">> Kill: {FFFFFF}/kick [ID]");
  618.         }
  619.         else if(!strlen(tmp2))
  620.         {
  621.             SendClientMessage(playerid, COLOR_ORANGE, ">> Kill: {FFFFFF}/kick [ID]");
  622.         }
  623.         else
  624.         {
  625.             id = strval(tmp);
  626.             if(!IsPlayerConnected(id))
  627.             {
  628.                 SendClientMessage(playerid, COLOR_RED, ">> Error: {FFFFFF}The player is not connected.");
  629.             }
  630.             else if(gPlayerInfo[id][PLAYER_LEVEL] > gPlayerInfo[playerid][PLAYER_LEVEL])
  631.             {
  632.                 SendClientMessage(playerid, COLOR_RED, ">> Error: {FFFFFF}You are not authorized to kill an admin with a higher level than you!");
  633.             }
  634.             else
  635.             {
  636.                 new string[256], name[MAX_PLAYER_NAME];
  637.                 GetPlayerName(id, name, sizeof(name));
  638.                 GetPlayerName(playerid, pName, sizeof(pName));
  639.                 if(id >= 0 && id <= 9)
  640.                 {
  641.                     GetPlayerName(playerid, pName, sizeof(pName));
  642.                     format(string, sizeof(string), ">> Server: You have been admin-killed by %s", pName);
  643.                     SendClientMessage(id, COLOR_RED, string);
  644.                     SetPlayerHealth(playerid,0);
  645.                     format(string, sizeof(string), ">> Server: %s has admin-killed %s", pName, name);
  646.                     SendClientMessageToAll(COLOR_RED, string);
  647.                 }
  648.                 else if(id >= 10 && id <= 99)
  649.                 {
  650.                     GetPlayerName(playerid, pName, sizeof(pName));
  651.                     format(string, sizeof(string), ">> Server: You have been admin-killed by %s", pName);
  652.                     SendClientMessage(id, COLOR_RED, string);
  653.                     SetPlayerHealth(playerid,0);
  654.                     format(string, sizeof(string), ">> Server: %s has admin-killed %s", pName, name);
  655.                     SendClientMessageToAll(COLOR_RED, string);
  656.                 }
  657.             }
  658.         }
  659.     }
  660.     return 1;
  661. }
  662.  
  663. dcmd_ann(playerid, params[])
  664. {
  665.     new string[152];
  666.  
  667.     if(gPlayerInfo[playerid][PLAYER_LEVEL] < gCommands[ANN]) return SendClientMessage(playerid, COLOR_RED, ">> Error: {FFFFFF}You are not authorized to do that!");
  668.     if (!strlen(params)) return SendClientMessage(playerid, COLOR_ORANGE,"/ann {FFFFFF}[Message]");
  669.     GetPlayerName(playerid, pName, sizeof(pName));
  670.     format(string, sizeof(string), "%s", params);
  671.     GameTextForAll( string, 5000, 3 );
  672.     return 1;
  673. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement