Advertisement
Tibers

knife_system_v1.0_by_pićunak

Mar 11th, 2024
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 22.88 KB | Source Code | 0 0
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <nvault>  
  4. #include <csstats>
  5. #include <fun>
  6. #include <cstrike>
  7. #include <colorchat>
  8. #include <engine>
  9. #include <hamsandwich>
  10.  
  11. #define PLUGIN "Knife System"
  12. #define VERSION "1.0"
  13. #define AUTHOR "Pićunak"
  14. #define HUD 672
  15.  
  16. new model_noza[33];
  17. new noz[33][33];
  18. new ubistva_igraca[33];
  19. new osvojeno_nozeva[33];
  20. new energija_igraca[33];
  21. new g_vault;
  22. new g_msgHideWeapon;
  23. new SyncHudObj;
  24.  
  25. new const imena_nozeva[28][] = {
  26.     "Default",
  27.     "Machete",
  28.     "Back",
  29.     "Pocket",
  30.     "Butcher",
  31.     "Wooden",
  32.     "Dragon",
  33.     "Ninja",
  34.     "Black",
  35.     "Hitman",
  36.     "Daedric",
  37.     "Ice",
  38.     "Katana",
  39.     "Rusty",
  40.     "Crowbar",
  41.     "Celurit",
  42.     "Kabar",
  43.     "Karambit",
  44.     "Omega",
  45.     "Metal Machete",
  46.     "Plunger",
  47.     "Rambo",
  48.     "Toporiaka",
  49.     "Candy",
  50.     "Elite",
  51.     "Traker",
  52.     "Bayonet",
  53.     "Triple"
  54. }
  55.  
  56. new const potrebno_ubistava[] = {
  57.     0,        
  58.     10,        
  59.     20,        
  60.     30,        
  61.     40,        
  62.     50,        
  63.     60,  
  64.     70,
  65.     80,
  66.     90,
  67.     100,
  68.     150,
  69.     200,
  70.     250,
  71.     300,
  72.     350,
  73.     400,
  74.     450,
  75.     500,
  76.     550,
  77.     600,
  78.     650,
  79.     700,
  80.     750,
  81.     800,
  82.     850,
  83.     900,
  84.     950
  85. }
  86.  
  87. public plugin_precache() {
  88.     precache_model("models/v_knife.mdl")
  89.     precache_model("models/knife-system/v_machete.mdl")
  90.     precache_model("models/knife-system/v_back.mdl")
  91.     precache_model("models/knife-system/v_pocket.mdl")
  92.     precache_model("models/knife-system/v_butcher.mdl")
  93.     precache_model("models/knife-system/v_wooden.mdl")
  94.     precache_model("models/knife-system/v_dragon.mdl")
  95.     precache_model("models/knife-system/v_ninja.mdl")
  96.     precache_model("models/knife-system/v_black.mdl")
  97.     precache_model("models/knife-system/v_hitman.mdl")
  98.     precache_model("models/knife-system/v_daedric.mdl")
  99.     precache_model("models/knife-system/v_ice.mdl")
  100.     precache_model("models/knife-system/v_katana.mdl")
  101.     precache_model("models/knife-system/v_rusty.mdl")
  102.     precache_model("models/knife-system/v_crowbar.mdl")
  103.     precache_model("models/knife-system/v_celurit.mdl")
  104.     precache_model("models/knife-system/v_kabar.mdl")
  105.     precache_model("models/knife-system/v_karambit.mdl")
  106.     precache_model("models/knife-system/v_domega.mdl")
  107.     precache_model("models/knife-system/v_mmachete.mdl")
  108.     precache_model("models/knife-system/v_plunger.mdl")
  109.     precache_model("models/knife-system/v_rambo.mdl")
  110.     precache_model("models/knife-system/v_toporiaka.mdl")
  111.     precache_model("models/knife-system/v_candy.mdl")
  112.     precache_model("models/knife-system/v_elite.mdl")
  113.     precache_model("models/knife-system/v_traker.mdl")
  114.     precache_model("models/knife-system/v_bayonet.mdl")
  115.     precache_model("models/knife-system/v_kunai.mdl")
  116.     precache_model("models/knife-system/p_machete.mdl")
  117.     precache_model("models/knife-system/p_back.mdl")
  118.     precache_model("models/knife-system/p_pocket.mdl")
  119.     precache_model("models/knife-system/p_butcher.mdl")
  120.     precache_model("models/knife-system/p_wooden.mdl")
  121.     precache_model("models/knife-system/p_dragon.mdl")
  122.     precache_model("models/knife-system/p_ninja.mdl")
  123.     precache_model("models/knife-system/p_black.mdl")
  124.     precache_model("models/knife-system/p_hitman.mdl")
  125.     precache_model("models/knife-system/p_daedric.mdl")
  126.     precache_model("models/knife-system/p_ice.mdl")
  127.     precache_model("models/knife-system/p_katana.mdl")
  128.     precache_model("models/knife-system/p_rusty.mdl")
  129.     precache_model("models/knife-system/p_crowbar.mdl")
  130.     precache_model("models/knife-system/p_celurit.mdl")
  131.     precache_model("models/knife-system/p_kabar.mdl")
  132.     precache_model("models/knife-system/p_karambit.mdl")
  133.     precache_model("models/knife-system/p_domega.mdl")
  134.     precache_model("models/knife-system/p_mmachete.mdl")
  135.     precache_model("models/knife-system/p_plunger.mdl")
  136.     precache_model("models/knife-system/p_rambo.mdl")
  137.     precache_model("models/knife-system/p_toporiaka.mdl")
  138.     precache_model("models/knife-system/p_candy.mdl")
  139.     precache_model("models/knife-system/p_elite.mdl")
  140.     precache_model("models/knife-system/p_traker.mdl")
  141.     precache_model("models/knife-system/p_bayonet.mdl")
  142.     precache_model("models/knife-system/p_kunai.mdl")
  143. }
  144.  
  145. public plugin_init() {
  146.     register_plugin(PLUGIN, VERSION, AUTHOR)
  147.     register_clcmd("say /knife", "PromeniNoz");
  148.     register_clcmd("say_team /knife", "PromeniNoz");
  149.     register_clcmd("say /noz", "PromeniNoz");
  150.     register_clcmd("say_team /noz", "PromeniNoz");
  151.     register_clcmd("say /resetall", "RestartUbistava");
  152.     register_clcmd("say_team /resetall", "RestartUbistava");
  153.     register_clcmd("say /reset", "Resetovanje");
  154.     register_clcmd("say_team /reset", "Resetovanje");
  155.    
  156.     register_event("CurWeapon", "CurWeapon", "be", "1=1");
  157.     register_event("ResetHUD", "eResetHUD", "be");
  158.    
  159.     RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1);
  160.    
  161.     set_task(1.0, "Pomoc");
  162.    
  163.     g_vault = nvault_open("KnifeSystem");
  164.     if(g_vault== INVALID_HANDLE) set_fail_state("Greska pri otvaranju gVaulta");  
  165.     SyncHudObj = CreateHudSyncObj();
  166.     g_msgHideWeapon = get_user_msgid("HideWeapon");
  167. }
  168.  
  169.  
  170. public PromeniNoz(id)
  171. {
  172.     new menu = menu_create("Izaberite Noz" , "izaberite_noz_handle");
  173.     new MeniNozevi[64]
  174.     for(new i; i<sizeof(imena_nozeva) && i<sizeof(potrebno_ubistava); i++)
  175.     {
  176.         if(ubistva_igraca[id] < potrebno_ubistava[i])
  177.         {
  178.             formatex(MeniNozevi, charsmax(MeniNozevi), "%s \r[Ubistva %i/%i]", imena_nozeva[i], ubistva_igraca[id], potrebno_ubistava[i])
  179.         }
  180.         else
  181.         formatex(MeniNozevi, charsmax(MeniNozevi), "%s \y[Otkljucano]", imena_nozeva[i])
  182.         menu_additem(menu, MeniNozevi)
  183.     }
  184.      
  185.     menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
  186.     menu_setprop(menu, MPROP_BACKNAME, "Prethodna stranica");
  187.     menu_setprop(menu, MPROP_NEXTNAME, "Sledeca stranica");
  188.     menu_setprop(menu, MPROP_EXITNAME, "Izlaz");
  189.      
  190.     menu_display(id, menu);
  191.     return PLUGIN_HANDLED;  
  192. }
  193.  
  194. public izaberite_noz_handle(id, menu, item)
  195. {
  196.     if(item == MENU_EXIT)
  197.     {
  198.         menu_destroy(menu);
  199.         return PLUGIN_HANDLED;
  200.     }
  201.     if(item == model_noza[id])
  202.     {
  203.         ColorChat(id,GREEN,"[Knife Mod] ^1Vec koristis taj noz.");
  204.         return PLUGIN_HANDLED;
  205.     }
  206.    
  207.     new command[6], name[64], access, callback;
  208.     menu_item_getinfo(menu, item, access, command, sizeof command - 1, name, sizeof name - 1, callback);
  209.     switch(item)
  210.     {
  211.         case 0: PostaviNoz(id , 0), ColorChat(id,GREEN,"[Knife Mod] ^1Promenio si noz, sada koristis default.");
  212.         case 1:
  213.         if(ubistva_igraca[id] < 10)
  214.         ColorChat(id,GREEN,"[Knife Mod] ^1Nemas potreban broj ubistava za ovaj noz.");
  215.         else
  216.         PostaviNoz(id , 1), ColorChat(id,GREEN,"[Knife Mod] ^1Promenio si noz, sada koristis machete.");
  217.  
  218.         case 2:
  219.         if(ubistva_igraca[id] < 20)
  220.         ColorChat(id,GREEN,"[Knife Mod] ^1Nemas potreban broj ubistava za ovaj noz.");
  221.         else
  222.         PostaviNoz(id, 2), ColorChat(id,GREEN,"[Knife Mod] ^1Promenio si noz, sada koristis back.");
  223.        
  224.         case 3:
  225.         if(ubistva_igraca[id] < 30)
  226.         ColorChat(id,GREEN,"[Knife Mod] ^1Nemas potreban broj ubistava za ovaj noz.");
  227.         else
  228.         PostaviNoz(id, 3), ColorChat(id,GREEN,"[Knife Mod] ^1Promenio si noz, sada koristis pocket.");
  229.        
  230.         case 4:
  231.         if(ubistva_igraca[id] < 40)
  232.         ColorChat(id,GREEN,"[Knife Mod] ^1Nemas potreban broj ubistava za ovaj noz.");
  233.         else
  234.         PostaviNoz(id, 4), ColorChat(id,GREEN,"[Knife Mod] ^1Promenio si noz, sada koristis butcher.");
  235.        
  236.         case 5:
  237.         if(ubistva_igraca[id] < 50)
  238.         ColorChat(id,GREEN,"[Knife Mod] ^1Nemas potreban broj ubistava za ovaj noz.");
  239.         else
  240.         PostaviNoz(id, 5), ColorChat(id,GREEN,"[Knife Mod] ^1Promenio si noz, sada koristis wooden.");
  241.        
  242.         case 6:
  243.         if(ubistva_igraca[id] < 60)
  244.         ColorChat(id,GREEN,"[Knife Mod] ^1Nemas potreban broj ubistava za ovaj noz.");
  245.         else
  246.         PostaviNoz(id, 6), ColorChat(id,GREEN,"[Knife Mod] ^1Promenio si noz, sada koristis dragon.");
  247.        
  248.         case 7:
  249.         if(ubistva_igraca[id] < 70)
  250.         ColorChat(id,GREEN,"[Knife Mod] ^1Nemas potreban broj ubistava za ovaj noz.");
  251.         else
  252.         PostaviNoz(id, 7), ColorChat(id,GREEN,"[Knife Mod] ^1Promenio si noz, sada koristis ninja.");
  253.        
  254.         case 8:
  255.         if(ubistva_igraca[id] < 80)
  256.         ColorChat(id,GREEN,"[Knife Mod] ^1Nemas potreban broj ubistava za ovaj noz.");
  257.         else
  258.         PostaviNoz(id, 8), ColorChat(id,GREEN,"[Knife Mod] ^1Promenio si noz, sada koristis black.");
  259.        
  260.         case 9:
  261.         if(ubistva_igraca[id] < 90)
  262.         ColorChat(id,GREEN,"[Knife Mod] ^1Nemas potreban broj ubistava za ovaj noz.");
  263.         else
  264.         PostaviNoz(id, 9), ColorChat(id,GREEN,"[Knife Mod] ^1Promenio si noz, sada koristis hitman.");
  265.        
  266.         case 10:
  267.         if(ubistva_igraca[id] < 100)
  268.         ColorChat(id,GREEN,"[Knife Mod] ^1Nemas potreban broj ubistava za ovaj noz.");
  269.         else
  270.         PostaviNoz(id, 10), ColorChat(id,GREEN,"[Knife Mod] ^1Promenio si noz, sada koristis daedric.");
  271.  
  272.         case 11:
  273.         if(ubistva_igraca[id] < 150)
  274.         ColorChat(id,GREEN,"[Knife Mod] ^1Nemas potreban broj ubistava za ovaj noz.");
  275.         else
  276.         PostaviNoz(id, 11), ColorChat(id,GREEN,"[Knife Mod] ^1Promenio si noz, sada koristis ice.");
  277.        
  278.         case 12:
  279.         if(ubistva_igraca[id] < 200)
  280.         ColorChat(id,GREEN,"[Knife Mod] ^1Nemas potreban broj ubistava za ovaj noz.");
  281.         else
  282.         PostaviNoz(id, 12), ColorChat(id,GREEN,"[Knife Mod] ^1Promenio si noz, sada koristis katane.");
  283.        
  284.         case 13:
  285.         if(ubistva_igraca[id] < 250)
  286.         ColorChat(id,GREEN,"[Knife Mod] ^1Nemas potreban broj ubistava za ovaj noz.");
  287.         else
  288.         PostaviNoz(id, 13), ColorChat(id,GREEN,"[Knife Mod] ^1Promenio si noz, sada koristis rusty.");
  289.        
  290.         case 14:
  291.         if(ubistva_igraca[id] < 300)
  292.         ColorChat(id,GREEN,"[Knife Mod] ^1Nemas potreban broj ubistava za ovaj noz.");
  293.         else
  294.         PostaviNoz(id, 14), ColorChat(id,GREEN,"[Knife Mod] ^1Promenio si noz, sada koristis crowbar.");
  295.        
  296.         case 15:
  297.         if(ubistva_igraca[id] < 350)
  298.         ColorChat(id,GREEN,"[Knife Mod] ^1Nemas potreban broj ubistava za ovaj noz.");
  299.         else
  300.         PostaviNoz(id, 15), ColorChat(id,GREEN,"[Knife Mod] ^1Promenio si noz, sada koristis celurit.");
  301.        
  302.         case 16:
  303.         if(ubistva_igraca[id] < 400)
  304.         ColorChat(id,GREEN,"[Knife Mod] ^1Nemas potreban broj ubistava za ovaj noz.");
  305.         else
  306.         PostaviNoz(id, 16), ColorChat(id,GREEN,"[Knife Mod] ^1Promenio si noz, sada koristis kabar.");
  307.        
  308.         case 17:
  309.         if(ubistva_igraca[id] < 450)
  310.         ColorChat(id,GREEN,"[Knife Mod] ^1Nemas potreban broj ubistava za ovaj noz.");
  311.         else
  312.         PostaviNoz(id, 17), ColorChat(id,GREEN,"[Knife Mod] ^1Promenio si noz, sada koristis karambit.");
  313.        
  314.         case 18:
  315.         if(ubistva_igraca[id] < 500)
  316.         ColorChat(id,GREEN,"[Knife Mod] ^1Nemas potreban broj ubistava za ovaj noz.");
  317.         else
  318.         PostaviNoz(id, 18), ColorChat(id,GREEN,"[Knife Mod] ^1Promenio si noz, sada koristis omega.");
  319.    
  320.         case 19:
  321.         if(ubistva_igraca[id] < 550)
  322.         ColorChat(id,GREEN,"[Knife Mod] ^1Nemas potreban broj ubistava za ovaj noz.");
  323.         else
  324.         PostaviNoz(id, 19), ColorChat(id,GREEN,"[Knife Mod] ^1Promenio si noz, sada koristis metal machete.");
  325.        
  326.         case 20:
  327.         if(ubistva_igraca[id] < 600)
  328.         ColorChat(id,GREEN,"[Knife Mod] ^1Nemas potreban broj ubistava za ovaj noz.");
  329.         else
  330.         PostaviNoz(id, 20), ColorChat(id,GREEN,"[Knife Mod] ^1Promenio si noz, sada koristis plunger.");
  331.        
  332.         case 21:
  333.         if(ubistva_igraca[id] < 650)
  334.         ColorChat(id,GREEN,"[Knife Mod] ^1Nemas potreban broj ubistava za ovaj noz.");
  335.         else
  336.         PostaviNoz(id, 21), ColorChat(id,GREEN,"[Knife Mod] ^1Promenio si noz, sada koristis rambo.");
  337.        
  338.         case 22:
  339.         if(ubistva_igraca[id] < 700)
  340.         ColorChat(id,GREEN,"[Knife Mod] ^1Nemas potreban broj ubistava za ovaj noz.");
  341.         else
  342.         PostaviNoz(id, 22), ColorChat(id,GREEN,"[Knife Mod] ^1Promenio si noz, sada koristis toporiaku.");
  343.        
  344.         case 23:
  345.         if(ubistva_igraca[id] < 750)
  346.         ColorChat(id,GREEN,"[Knife Mod] ^1Nemas potreban broj ubistava za ovaj noz.");
  347.         else
  348.         PostaviNoz(id, 23), ColorChat(id,GREEN,"[Knife Mod] ^1Promenio si noz, sada koristis candy.");
  349.        
  350.         case 24:
  351.         if(ubistva_igraca[id] < 800)
  352.         ColorChat(id,GREEN,"[Knife Mod] ^1Nemas potreban broj ubistava za ovaj noz.");
  353.         else
  354.         PostaviNoz(id, 24), ColorChat(id,GREEN,"[Knife Mod] ^1Promenio si noz, sada koristis elite.");
  355.        
  356.         case 25:
  357.         if(ubistva_igraca[id] < 850)
  358.         ColorChat(id,GREEN,"[Knife Mod] ^1Nemas potreban broj ubistava za ovaj noz.");
  359.         else
  360.         PostaviNoz(id, 25), ColorChat(id,GREEN,"[Knife Mod] ^1Promenio si noz, sada koristis traker.");
  361.        
  362.         case 26:
  363.         if(ubistva_igraca[id] < 900)
  364.         ColorChat(id,GREEN,"[Knife Mod] ^1Nemas potreban broj ubistava za ovaj noz.");
  365.         else
  366.         PostaviNoz(id, 26), ColorChat(id,GREEN,"[Knife Mod] ^1Promenio si noz, sada koristis bayonet.");
  367.        
  368.         case 27:
  369.         if(ubistva_igraca[id] < 950)
  370.         ColorChat(id,GREEN,"[Knife Mod] ^1Nemas potreban broj ubistava za ovaj noz.");
  371.         else
  372.         PostaviNoz(id, 27), ColorChat(id,GREEN,"[Knife Mod] ^1Promenio si noz, sada koristis triple.");
  373.     }
  374.     menu_destroy(menu);
  375.     return PLUGIN_HANDLED;
  376. }
  377.  
  378. public PostaviNoz(id , Knife)
  379. {
  380.     model_noza[id] = Knife
  381.     new Clip, Ammo, Weapon = get_user_weapon(id, Clip, Ammo)
  382.     if(Weapon != CSW_KNIFE)
  383.         return PLUGIN_HANDLED
  384.     new vModel[56]
  385.     new pModel[56]
  386.     switch(Knife)
  387.     {
  388.         case 0: format(vModel,55,"models/v_knife.mdl"),format(pModel,55,"models/p_knife.mdl")
  389.         case 1: format(vModel,55,"models/knife-system/v_machete.mdl"),format(pModel,55,"models/knife-system/p_machete.mdl")
  390.         case 2: format(vModel,55,"models/knife-system/v_back.mdl"),format(pModel,55,"models/knife-system/p_back.mdl")
  391.         case 3: format(vModel,55,"models/knife-system/v_pocket.mdl"),format(pModel,55,"models/knife-system/p_pocket.mdl")
  392.         case 4: format(vModel,55,"models/knife-system/v_butcher.mdl"),format(pModel,55,"models/knife-system/p_butcher.mdl")
  393.         case 5: format(vModel,55,"models/knife-system/v_wooden.mdl"),format(pModel,55,"models/knife-system/p_wooden.mdl")
  394.         case 6: format(vModel,55,"models/knife-system/v_dragon.mdl"),format(pModel,55,"models/knife-system/p_dragon.mdl")
  395.         case 7: format(vModel,55,"models/knife-system/v_ninja.mdl"),format(pModel,55,"models/knife-system/p_ninja.mdl")
  396.         case 8: format(vModel,55,"models/knife-system/v_black.mdl"),format(pModel,55,"models/knife-system/p_black.mdl")
  397.         case 9: format(vModel,55,"models/knife-system/v_hitman.mdl"),format(pModel,55,"models/knife-system/p_hitman.mdl")
  398.         case 10: format(vModel,55,"models/knife-system/v_daedric.mdl"),format(pModel,55,"models/knife-system/p_daedric.mdl")
  399.         case 11: format(vModel,55,"models/knife-system/v_ice.mdl"),format(pModel,55,"models/knife-system/p_ice.mdl")
  400.         case 12: format(vModel,55,"models/knife-system/v_katana.mdl"),format(pModel,55,"models/knife-system/p_katana.mdl")
  401.         case 13: format(vModel,55,"models/knife-system/v_rusty.mdl"),format(pModel,55,"models/knife-system/p_rusty.mdl")
  402.         case 14: format(vModel,55,"models/knife-system/v_crowbar.mdl"),format(pModel,55,"models/knife-system/p_crowbar.mdl")
  403.         case 15: format(vModel,55,"models/knife-system/v_celurit.mdl"),format(pModel,55,"models/knife-system/p_celurit.mdl")
  404.         case 16: format(vModel,55,"models/knife-system/v_kabar.mdl"),format(pModel,55,"models/knife-system/p_kabar.mdl")
  405.         case 17: format(vModel,55,"models/knife-system/v_karambit.mdl"),format(pModel,55,"models/knife-system/p_karambit.mdl")
  406.         case 18: format(vModel,55,"models/knife-system/v_domega.mdl"),format(pModel,55,"models/knife-system/p_domega.mdl")
  407.         case 19: format(vModel,55,"models/knife-system/v_mmachete.mdl"),format(pModel,55,"models/knife-system/p_mmachete.mdl")
  408.         case 20: format(vModel,55,"models/knife-system/v_plunger.mdl"),format(pModel,55,"models/knife-system/p_plunger.mdl")
  409.         case 21: format(vModel,55,"models/knife-system/v_rambo.mdl"),format(pModel,55,"models/knife-system/p_rambo.mdl")
  410.         case 22: format(vModel,55,"models/knife-system/v_toporiaka.mdl"),format(pModel,55,"models/knife-system/p_toporiaka.mdl")
  411.         case 23: format(vModel,55,"models/knife-system/v_candy.mdl"),format(pModel,55,"models/knife-system/p_candy.mdl")
  412.         case 24: format(vModel,55,"models/knife-system/v_elite.mdl"),format(pModel,55,"models/knife-system/p_elite.mdl")
  413.         case 25: format(vModel,55,"models/knife-system/v_traker.mdl"),format(pModel,55,"models/knife-system/p_traker.mdl")
  414.         case 26: format(vModel,55,"models/knife-system/v_bayonet.mdl"),format(pModel,55,"models/knife-system/p_bayonet.mdl")
  415.         case 27: format(vModel,55,"models/knife-system/v_kunai.mdl"),format(pModel,55,"models/knife-system/p_kunai.mdl")
  416.     }
  417.     entity_set_string(id, EV_SZ_viewmodel, vModel)
  418.     entity_set_string(id, EV_SZ_weaponmodel, pModel)
  419.     return PLUGIN_CONTINUE;
  420. }
  421.  
  422. public CurWeapon(id)
  423. {
  424.     PostaviNoz(id, model_noza[id])
  425.     return PLUGIN_HANDLED
  426. }
  427.  
  428. public Pomoc()
  429. {
  430.     switch(random(4))
  431.     {
  432.         case 0: ColorChat(0, NORMAL, "^4[Knife Mod] ^1Da promenis noz kucaj /noz ili /knife.");
  433.         case 1: ColorChat(0, NORMAL, "^4[Knife Mod] ^1Za uzimanje svakog noza potreban je odredjen broj ubistava.");
  434.         case 2: ColorChat(0, NORMAL, "^4[Knife Mod] ^1Da bi otkljucao sve nozeve potrebno je da ubijes 950 ljudi.");
  435.         case 3: ColorChat(0, NORMAL, "^4[Knife Mod] ^1Da restartujes svoja ubistva kucaj /reset.");
  436.    
  437.     }
  438.     set_task(16.0, "Pomoc");
  439. }
  440.  
  441. public pokazi_podatke(id)
  442. {
  443.     id -= HUD
  444.            
  445.     if(model_noza[id] == 0) noz[id] = "Default";
  446.     if(model_noza[id] == 1) noz[id] = "Machete";
  447.     if(model_noza[id] == 2) noz[id] = "Back";
  448.     if(model_noza[id] == 3) noz[id] = "Pocket";
  449.     if(model_noza[id] == 4) noz[id] = "Butcher";
  450.     if(model_noza[id] == 5) noz[id] = "Wooden";
  451.     if(model_noza[id] == 6) noz[id] = "Dragon";
  452.     if(model_noza[id] == 7) noz[id] = "Ninja";
  453.     if(model_noza[id] == 8) noz[id] = "Black";
  454.     if(model_noza[id] == 9) noz[id] = "Hitman";
  455.     if(model_noza[id] == 10) noz[id] = "Daedric";
  456.     if(model_noza[id] == 11) noz[id] = "Ice";
  457.     if(model_noza[id] == 12) noz[id] = "Katana";
  458.     if(model_noza[id] == 13) noz[id] = "Rusty";
  459.     if(model_noza[id] == 14) noz[id] = "Crowbar";
  460.     if(model_noza[id] == 15) noz[id] = "Celurit";
  461.     if(model_noza[id] == 16) noz[id] = "Kabar";
  462.     if(model_noza[id] == 17) noz[id] = "Karambit";
  463.     if(model_noza[id] == 18) noz[id] = "Omega";
  464.     if(model_noza[id] == 19) noz[id] = "Metal Machete";
  465.     if(model_noza[id] == 20) noz[id] = "Plunger";
  466.     if(model_noza[id] == 21) noz[id] = "Rambo";
  467.     if(model_noza[id] == 22) noz[id] = "Toporiaka";
  468.     if(model_noza[id] == 23) noz[id] = "Candy";
  469.     if(model_noza[id] == 24) noz[id] = "Elite";
  470.     if(model_noza[id] == 25) noz[id] = "Traker";
  471.     if(model_noza[id] == 26) noz[id] = "Bayonet";
  472.     if(model_noza[id] == 27) noz[id] = "Triple";
  473.    
  474.     if(ubistva_igraca[id] < 10) osvojeno_nozeva[id] = 1;
  475.     if(ubistva_igraca[id] >= 10) osvojeno_nozeva[id] = 2;
  476.     if(ubistva_igraca[id] >= 20) osvojeno_nozeva[id] = 3;
  477.     if(ubistva_igraca[id] >= 30) osvojeno_nozeva[id] = 4;
  478.     if(ubistva_igraca[id] >= 40) osvojeno_nozeva[id] = 5;
  479.     if(ubistva_igraca[id] >= 50) osvojeno_nozeva[id] = 6;
  480.     if(ubistva_igraca[id] >= 60) osvojeno_nozeva[id] = 7;
  481.     if(ubistva_igraca[id] >= 70) osvojeno_nozeva[id] = 8;
  482.     if(ubistva_igraca[id] >= 80) osvojeno_nozeva[id] = 9;
  483.     if(ubistva_igraca[id] >= 90) osvojeno_nozeva[id] = 10;
  484.     if(ubistva_igraca[id] >= 100) osvojeno_nozeva[id] = 11;
  485.     if(ubistva_igraca[id] >= 150) osvojeno_nozeva[id] = 12;
  486.     if(ubistva_igraca[id] >= 200) osvojeno_nozeva[id] = 13;
  487.     if(ubistva_igraca[id] >= 250) osvojeno_nozeva[id] = 14;
  488.     if(ubistva_igraca[id] >= 300) osvojeno_nozeva[id] = 15;
  489.     if(ubistva_igraca[id] >= 350) osvojeno_nozeva[id] = 16;
  490.     if(ubistva_igraca[id] >= 400) osvojeno_nozeva[id] = 17;
  491.     if(ubistva_igraca[id] >= 450) osvojeno_nozeva[id] = 18;
  492.     if(ubistva_igraca[id] >= 500) osvojeno_nozeva[id] = 19;
  493.     if(ubistva_igraca[id] >= 550) osvojeno_nozeva[id] = 20;
  494.     if(ubistva_igraca[id] >= 600) osvojeno_nozeva[id] = 21;
  495.     if(ubistva_igraca[id] >= 650) osvojeno_nozeva[id] = 22;
  496.     if(ubistva_igraca[id] >= 700) osvojeno_nozeva[id] = 23;
  497.     if(ubistva_igraca[id] >= 750) osvojeno_nozeva[id] = 24;
  498.     if(ubistva_igraca[id] >= 800) osvojeno_nozeva[id] = 25;
  499.     if(ubistva_igraca[id] >= 850) osvojeno_nozeva[id] = 26;
  500.     if(ubistva_igraca[id] >= 900) osvojeno_nozeva[id] = 27;
  501.     if(ubistva_igraca[id] >= 950) osvojeno_nozeva[id] = 28;
  502.    
  503.     set_task(0.2, "pokazi_podatke", id+HUD);
  504.    
  505.     energija_igraca[id] = get_user_health(id);
  506.     if(energija_igraca[id] < 0)
  507.     {
  508.         energija_igraca[id] = 0;
  509.     }
  510.    
  511.     if(!is_user_alive(id))
  512.     {
  513.         new target = entity_get_int(id, EV_INT_iuser2);
  514.        
  515.         if(target == 0)
  516.             return PLUGIN_CONTINUE;
  517.            
  518.         set_hudmessage(0, 127, 255, 0.02, 0.22, 0, 0.0, 0.21, 0.0, 0.0, 2);
  519.         ShowSyncHudMsg(id, SyncHudObj, "[Trenutni noz: %s]^n[Ubistva : %i]^n[Otkljucano nozeva : %i]^n[Energija : %i]", noz[target], ubistva_igraca[target], osvojeno_nozeva[target], energija_igraca[target]);
  520.        
  521.         return PLUGIN_CONTINUE;
  522.     }
  523.     else if(cs_get_user_team(id) == CS_TEAM_SPECTATOR)
  524.     {
  525.         new target = entity_get_int(id, EV_INT_iuser2);
  526.        
  527.         if(target == 0)
  528.             return PLUGIN_CONTINUE;
  529.            
  530.         set_hudmessage(0, 127, 255, 0.02, 0.22, 0, 0.0, 0.21, 0.0, 0.0, 2);
  531.         ShowSyncHudMsg(id, SyncHudObj, "[Trenutni noz: %s]^n[Ubistva : %i]^n[Otkljucano nozeva : %i]^n[Energija : %i]", noz[target], ubistva_igraca[target], osvojeno_nozeva[target], energija_igraca[target]);
  532.        
  533.         return PLUGIN_CONTINUE;
  534.     }
  535.     else
  536.     {
  537.         set_hudmessage(0, 127, 255, 0.02, 0.02, 0, 0.0, 0.21, 0.0, 0.0, 2);
  538.         ShowSyncHudMsg(id, SyncHudObj, "[Trenutni noz: %s]^n[Ubistva : %i]^n[Otkljucano nozeva : %i]^n[Energija : %i]", noz[id], ubistva_igraca[id], osvojeno_nozeva[id], energija_igraca[id]);
  539.     }
  540.    
  541.     return PLUGIN_CONTINUE;
  542. }
  543.  
  544. public client_putinserver(id)
  545. {
  546.     LoadData(id)
  547.     set_task(3.0, "pokazi_podatke", id+HUD);
  548. }
  549.  
  550. public client_disconnect(id)
  551. {
  552.     SaveData(id)
  553. }
  554.  
  555. public client_death(killer,victim)
  556. {
  557.     if(killer != victim)
  558.     {
  559.         ubistva_igraca[killer] ++;
  560.     }
  561.     SaveData(killer)
  562.     return PLUGIN_CONTINUE;
  563. }  
  564.  
  565. public SaveData(id)
  566. {
  567.     new AuthID[35]
  568.     get_user_authid(id,AuthID,34)
  569.     new vaultkey[64],vaultdata[256]
  570.  
  571.     format(vaultkey,63,"%s-Knife",AuthID)
  572.     format(vaultdata,255,"%i",ubistva_igraca[id])
  573.    
  574.     nvault_set(g_vault,vaultkey,vaultdata)
  575.     return PLUGIN_CONTINUE
  576. }
  577.  
  578. public LoadData(id)
  579. {
  580.     new AuthID[35]
  581.     get_user_authid(id,AuthID,34)
  582.     new vaultkey[64],vaultdata[256]
  583.    
  584.     format(vaultkey,63,"%s-Knife",AuthID)
  585.     format(vaultdata,255,"%i",ubistva_igraca[id])
  586.    
  587.     nvault_get(g_vault,vaultkey,vaultdata,255)
  588.     replace_all(vaultdata, 255, "#", " ")
  589.     new ubistva[32]
  590.     parse(vaultdata, ubistva, 31)
  591.     ubistva_igraca[id] = str_to_num(ubistva)
  592.     return PLUGIN_CONTINUE
  593. }  
  594.  
  595. public plugin_end()
  596. {
  597.     nvault_close(g_vault)
  598. }
  599.  
  600. public eResetHUD(id)
  601. {
  602.     if(!is_user_bot(id)) {
  603.         message_begin(MSG_ONE_UNRELIABLE, g_msgHideWeapon, _, id);
  604.         write_byte((1 << 3));
  605.         message_end();
  606.     }
  607. }
  608.  
  609. public fwHamPlayerSpawnPost(iPlayer)
  610. {
  611.     /*
  612.         TREBAO JE BITI KOD OVDE ALI SAM PRONAŠAO DRUGI NAČIN
  613.     */
  614. }
  615.  
  616. public RestartUbistava(id)
  617. {
  618.     new flags = get_user_flags(id)
  619.     if(flags & ADMIN_RCON)
  620.     {
  621.         ColorChat(0, NORMAL, "^4[Knife Mod] ^1Restart svih ubistava će se izvršiti za 10 sekundi.");
  622.         set_task(10.0, "RestartujUbistva");
  623.     }
  624.     else
  625.     {
  626.         return PLUGIN_HANDLED
  627.     }
  628.     return PLUGIN_CONTINUE
  629. }
  630.  
  631. public RestartujUbistva()
  632. {
  633.     new iPlayer[32], iNum
  634.     get_players(iPlayer, iNum)
  635.     for(new i; i < iNum; i++)
  636.     {
  637.         ubistva_igraca[iPlayer[i]] = 0;
  638.     }
  639.     nvault_prune(g_vault, 0, get_systime() + 1)
  640.     server_cmd("changelevel de_dust2");
  641.     return PLUGIN_CONTINUE
  642. }
  643.  
  644. public Resetovanje(id)
  645. {
  646.     ubistva_igraca[id] = 0;
  647.     PostaviNoz(id, 0)
  648.     ColorChat(0, NORMAL, "^4[Knife Mod] ^1Restartovao si svoja ubistva, sada su vracena na 0.");
  649.     SaveData(id);
  650.     return PLUGIN_HANDLED;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement