Guest User

Untitled

a guest
Jun 24th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 10.49 KB | None | 0 0
  1. #include <a_samp>
  2. #include <dini>
  3. #include <zcmd>
  4.  
  5. #undef MAX_PLAYERS
  6. #define MAX_PLAYERS 10 //Liczba slotów
  7. #define LICENCJA "Afghanistan/License.Dj"
  8. #define CONFIG "Afghanistan/Config.ini"
  9. #define AGU 56 // admin login gui
  10. #define WHITE   0xFFFFFFFF
  11. #define TALIB 0
  12. #define ARMIA 1
  13.  
  14. new bool:adminlogin[MAX_PLAYERS];
  15. new countpos[MAX_PLAYERS];
  16. new timer[MAX_PLAYERS];
  17. new Text3D:laber[MAX_PLAYERS];
  18. new mine[MAX_PLAYERS][2];
  19. new status[MAX_PLAYERS];
  20. new minePickup[MAX_PLAYERS];
  21. static Team[MAX_PLAYERS];
  22. new PlayerClass[MAX_PLAYERS];
  23. new RoundTime = 3600000;
  24.  
  25.  
  26. main()
  27. {
  28.     if(!dini_Exists(CONFIG))
  29.     {
  30.         print("Utwórz plik Config.ini o zawartości taką jaką podano w pliku Czytaj.txt");
  31.     }
  32.     if(dini_Exists(LICENCJA))
  33.     {
  34.         print("Wczytano licencje");
  35.         print("Sprawdzanie poprawności klucza...");
  36.         if(strcmp("2012TEA", dini_Get(LICENCJA, "Klucz"), true) == 0)
  37.         {
  38.             print("Klucz poprawny. Start mapy...");
  39.         }
  40.         else
  41.         {
  42.             print("Klucz zly.Zamkniencie serwera nastąpi za 10 sek.");
  43.             SetTimer("SERVER_OFF", false, 10000);
  44.         }
  45.     }
  46.     else
  47.     {
  48.         print("Brak licencji.Zamkniencie serwera nastąpi za 10 sek.");
  49.         SetTimer("SERVER_OFF", false, 10000);
  50.     }
  51.  
  52.  
  53.     print("\n----------------------------------");
  54.     print("Afghanistan Mod By Dj KaSkIeR");
  55.     print("----------------------------------\n");
  56. }
  57.  
  58. AntiDeAMX()
  59. {
  60.     new a[][] =
  61.     {
  62.         "Unarmed (Fist)",
  63.         "Brass K"
  64.     };
  65.     #pragma unused a
  66. }
  67.  
  68. public OnGameModeInit()
  69. {
  70.     AntiDeAMX();
  71.     SetGameModeText("++Afghanistan++");
  72.     ShowPlayerMarkers(0);
  73.     SetNameTagDrawDistance(dini_Float(CONFIG, "OdlegloscNicki"));
  74.     AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 38, 9999, 0, 0, 0, 0);
  75.     SetTimer("SERVER_GMX", true, RoundTime);
  76.     return 1;
  77. }
  78.  
  79. public OnGameModeExit()
  80. {
  81.     return 1;
  82. }
  83.  
  84. public OnPlayerRequestClass(playerid, classid)
  85. {
  86.     SetPlayerClass(playerid, classid);
  87.     SetupPlayerForClassSelection(playerid);
  88.     PlayerClass[playerid] = classid;
  89.     switch (classid)
  90.     {
  91.         case 0:
  92.         {
  93.             GameTextForPlayer(playerid, "~r~Talibowie", 500, 3);
  94.         }
  95.         case 1:
  96.         {
  97.             GameTextForPlayer(playerid, "~g~Armia", 500, 3);
  98.         }
  99.     }
  100.     return 1;
  101. }
  102. forward SetupPlayerForClassSelection(playerid);
  103. public SetupPlayerForClassSelection(playerid)
  104. {
  105.     SetPlayerInterior(playerid,14);
  106.     SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
  107.     SetPlayerFacingAngle(playerid, 90.0);
  108.     SetPlayerCameraPos(playerid,256.0815,-43.0475,1003.0234);
  109.     SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);
  110. }
  111.  
  112. SetPlayerClass(playerid, classid) {
  113.     if(classid == 0) {
  114.             Team[playerid] = TALIB;
  115.      }
  116.         else if(classid == 1) {
  117.          Team[playerid] = ARMIA;
  118.     }
  119. }
  120.  
  121. public OnPlayerConnect(playerid)
  122. {
  123.     GivePlayerMoney(playerid, 5000);
  124.     return 1;
  125. }
  126.  
  127. public OnPlayerDisconnect(playerid, reason)
  128. {
  129.     if(status[playerid] == 1)
  130.     {
  131.         DestroyPickup(minePickup[playerid]);
  132.         DestroyObject(mine[playerid][0]);
  133.         DestroyObject(mine[playerid][1]);
  134.         status[playerid] = 0;
  135.         KillTimer(timer[playerid]);
  136.         Delete3DTextLabel(laber[playerid]);
  137.     }
  138.     return 1;
  139. }
  140.  
  141. public OnPlayerSpawn(playerid)
  142. {
  143.     return 1;
  144. }
  145.  
  146. public OnPlayerDeath(playerid, killerid, reason)
  147. {
  148.     if(killerid == INVALID_PLAYER_ID)
  149.     {
  150.         SendDeathMessage(INVALID_PLAYER_ID,playerid,reason);
  151.     }
  152.     else
  153.     {
  154.         if(Team[killerid] != Team[playerid])
  155.         {
  156.             // Valid kill
  157.             SendDeathMessage(killerid,playerid,reason);
  158.             SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
  159.             GivePlayerMoney(killerid, 1000);
  160.         }
  161.         else
  162.         {
  163.             //Team Killer!
  164.             new warning[256];
  165.             format(warning, sizeof(warning), "Uważaj.Nie wolno zabijać kolegów z teamu.");
  166.             SendClientMessage(killerid, 0xFFFF00AA, warning);
  167.             SendDeathMessage(killerid,playerid,reason);
  168.             GivePlayerMoney(killerid, -1000);
  169.             SetPlayerScore(killerid, GetPlayerScore(killerid) - 1);
  170.         }
  171.     }
  172.     return 1;
  173. }
  174.  
  175. public OnVehicleSpawn(vehicleid)
  176. {
  177.     return 1;
  178. }
  179.  
  180. public OnVehicleDeath(vehicleid, killerid)
  181. {
  182.     return 1;
  183. }
  184.  
  185. public OnPlayerText(playerid, text[])
  186. {
  187.     return 1;
  188. }
  189.  
  190. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  191. {
  192.     return 1;
  193. }
  194.  
  195. public OnPlayerExitVehicle(playerid, vehicleid)
  196. {
  197.     return 1;
  198. }
  199.  
  200. public OnPlayerStateChange(playerid, newstate, oldstate)
  201. {
  202.     return 1;
  203. }
  204.  
  205. public OnPlayerEnterCheckpoint(playerid)
  206. {
  207.     return 1;
  208. }
  209.  
  210. public OnPlayerLeaveCheckpoint(playerid)
  211. {
  212.     return 1;
  213. }
  214.  
  215. public OnPlayerEnterRaceCheckpoint(playerid)
  216. {
  217.     return 1;
  218. }
  219.  
  220. public OnPlayerLeaveRaceCheckpoint(playerid)
  221. {
  222.     return 1;
  223. }
  224.  
  225. public OnRconCommand(cmd[])
  226. {
  227.     return 1;
  228. }
  229.  
  230. public OnPlayerRequestSpawn(playerid)
  231. {
  232.     return 1;
  233. }
  234.  
  235. public OnObjectMoved(objectid)
  236. {
  237.     return 1;
  238. }
  239.  
  240. public OnPlayerObjectMoved(playerid, objectid)
  241. {
  242.     return 1;
  243. }
  244.  
  245. public OnPlayerPickUpPickup(playerid, pickupid)
  246. {
  247.     for(new i=0; i<MAX_PLAYERS; i++)
  248.     {
  249.         if(!IsPlayerConnected(i)) {continue;}
  250.         if(status[i] == 0) {continue;}
  251.         if(pickupid == minePickup[i])
  252.         {
  253.             new Float:X, Float:Y, Float:Z;
  254.             GetObjectPos(mine[i][0], X, Y, Z);
  255.             CreateExplosion(X, Y, Z, 7, 1000);
  256.             DestroyPickup(minePickup[i]);
  257.             DestroyObject(mine[i][0]);
  258.             DestroyObject(mine[i][1]);
  259.             status[i] = 0;
  260.         }
  261.     }
  262.     return 1;
  263. }
  264.  
  265. public OnVehicleMod(playerid, vehicleid, componentid)
  266. {
  267.     return 1;
  268. }
  269.  
  270. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  271. {
  272.     return 1;
  273. }
  274.  
  275. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  276. {
  277.     return 1;
  278. }
  279.  
  280. public OnPlayerSelectedMenuRow(playerid, row)
  281. {
  282.     return 1;
  283. }
  284.  
  285. public OnPlayerExitedMenu(playerid)
  286. {
  287.     return 1;
  288. }
  289.  
  290. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  291. {
  292.     return 1;
  293. }
  294.  
  295. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  296. {
  297.     return 1;
  298. }
  299.  
  300. public OnRconLoginAttempt(ip[], password[], success)
  301. {
  302.     return 1;
  303. }
  304.  
  305. public OnPlayerUpdate(playerid)
  306. {
  307.     return 1;
  308. }
  309.  
  310. public OnPlayerStreamIn(playerid, forplayerid)
  311. {
  312.     return 1;
  313. }
  314.  
  315. public OnPlayerStreamOut(playerid, forplayerid)
  316. {
  317.     return 1;
  318. }
  319.  
  320. public OnVehicleStreamIn(vehicleid, forplayerid)
  321. {
  322.     return 1;
  323. }
  324.  
  325. public OnVehicleStreamOut(vehicleid, forplayerid)
  326. {
  327.     return 1;
  328. }
  329.  
  330. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  331. {
  332.     if(dialogid == AGU && response)
  333.     {
  334.         if(!strcmp(dini_Get(CONFIG, "AdminPass"), inputtext, true))
  335.         {
  336.             adminlogin[playerid] = true;
  337.             SendClientMessage(playerid, 0xF50A0AAA, "Zalogowano poprawnie na admina");
  338.         }
  339.         else
  340.         {
  341.             SendClientMessage(playerid, 0xF50A0AAA, "Złe hasło");
  342.         }
  343.         return 1;
  344.     }
  345.     return 1;
  346. }
  347.  
  348. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  349. {
  350.     return 1;
  351. }
  352.  
  353. forward SERVER_OFF();
  354. public SERVER_OFF()
  355. {
  356.     SendRconCommand("exit");
  357. }
  358.  
  359. forward SERVER_GMX();
  360. public SERVER_GMX()
  361. {
  362.     SendRconCommand("gmx");
  363. }
  364.  
  365. CMD:alogin(playerid, params[])
  366. {
  367.     ShowPlayerDialog(playerid, AGU, DIALOG_STYLE_PASSWORD, "Logowanie na Admina", "Podaj hasło aby uzyskać uprawnienia Admina.", "Loguj", "Wyjdź");
  368.     return 1;
  369. }
  370.  
  371. CMD:alogout(playerid, params[])
  372. {
  373.     if(adminlogin[playerid] == true)
  374.     {
  375.         adminlogin[playerid] = false;
  376.         SendClientMessage(playerid, 0xF50A0AAA, "Zostałeś poprawnie wylogowany z admina");
  377.     }
  378.     else if(adminlogin[playerid] == false)
  379.     {
  380.         SendClientMessage(playerid, 0xF50A0AAA, "Nie jesteś zalogowany!");
  381.     }
  382.     return 1;
  383. }
  384.  
  385. CMD:mina(playerid, params[])
  386. {
  387.     if(IsPlayerInAnyVehicle(playerid))
  388.     {
  389.         SendClientMessage(playerid, WHITE, "Jesteś w aucie więc nie możesz położyć miny!!");
  390.         return 1;
  391.     }
  392.  
  393.     new Float:X, Float:Y, Float:Z;
  394.     GetPlayerPos(playerid, X, Y, Z);
  395.     mine[playerid][0] = CreateObject(2992, X, Y, Z-0.85, 0.0, 0.0, 0.0);
  396.     mine[playerid][1] = CreateObject(19290, X, Y, Z-0.85, 0.0, 0.0, 0.0);
  397.     status[playerid] = 1;
  398.     countpos[playerid] = 11;
  399.     dtext(playerid);
  400.     return 1;
  401. }
  402.  
  403. forward dtext(playerid);
  404. public dtext(playerid)
  405. {
  406.     timer[playerid] = SetTimerEx("dtext", 1000, 0, "i", playerid);
  407.     new Float:X, Float:Y, Float:Z;
  408.     GetObjectPos(mine[playerid][0], X, Y, Z);
  409.     if(countpos[playerid] == 11)
  410.     {
  411.         laber[playerid] = Create3DTextLabel("Do aktywacji pozostało: \n10 sekund!",0x00F900AA,X,Y,Z+1,40.0,0);
  412.         countpos[playerid] = 10;
  413.     }
  414.     else if(countpos[playerid] == 10)
  415.     {
  416.         Update3DTextLabelText(laber[playerid], 0x64F801AA, "Do aktywacji pozostało: \n9 sekund!");
  417.         countpos[playerid] = 9;
  418.     }
  419.     else if(countpos[playerid] == 9)
  420.     {
  421.         Update3DTextLabelText(laber[playerid], 0xBAF801AA, "Do aktywacji pozostało: \n8 sekund!");
  422.         countpos[playerid] = 8;
  423.     }
  424.     else if(countpos[playerid] == 8)
  425.     {
  426.         Update3DTextLabelText(laber[playerid], 0xDAF900AA, "Do aktywacji pozostało: \n7 sekund!");
  427.         countpos[playerid] = 7;
  428.     }
  429.     else if(countpos[playerid] == 7)
  430.     {
  431.         Update3DTextLabelText(laber[playerid], 0xFCEB18AA, "Do aktywacji pozostało: \n6 sekund!");
  432.         countpos[playerid] = 6;
  433.     }
  434.     else if(countpos[playerid] == 6)
  435.     {
  436.         Update3DTextLabelText(laber[playerid], 0xFCCE18AA, "Do aktywacji pozostało: \n5 sekund!");
  437.         countpos[playerid] = 5;
  438.     }
  439.     else if(countpos[playerid] == 5)
  440.     {
  441.         Update3DTextLabelText(laber[playerid], 0xFBA71AAA, "Do aktywacji pozostało: \n4 sekundy!");
  442.         countpos[playerid] = 4;
  443.     }
  444.     else if(countpos[playerid] == 4)
  445.     {
  446.         Update3DTextLabelText(laber[playerid], 0xFA6F1BAA, "Do aktywacji pozostało: \n3 sekundy!");
  447.         countpos[playerid] = 3;
  448.     }
  449.     else if(countpos[playerid] == 3)
  450.     {
  451.         Update3DTextLabelText(laber[playerid], 0xFA421BAA, "Do aktywacji pozostało: \n2 sekundy!");
  452.         countpos[playerid] = 2;
  453.     }
  454.     else if(countpos[playerid] == 2)
  455.     {
  456.         Update3DTextLabelText(laber[playerid], 0xFF0F0FAA, "Do aktywacji pozostało: \n1 sekunda!");
  457.         countpos[playerid] = 1;
  458.     }
  459.     else if(countpos[playerid] == 1)
  460.     {
  461.  
  462.         KillTimer(timer[playerid]);
  463.         Delete3DTextLabel(laber[playerid]);
  464.         countpos[playerid] = 0;
  465.         minePickup[playerid] = CreatePickup(0, 1, X, Y, Z, -1);
  466.     }
  467.     return 1;
  468. }
Add Comment
Please, Sign In to add comment