Advertisement
Guest User

Ножи

a guest
Jun 6th, 2016
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 18.38 KB | None | 0 0
  1. #include <sourcemod>
  2. #include <sdktools>
  3. #include <sdkhooks>
  4. #include <multicolors>
  5. #include <clientprefs>
  6. #include <cstrike>
  7. #include <fpvm_interface>
  8.  
  9. #pragma newdecls required // let's go new syntax!
  10.  
  11. int iTridaggerModel,iTridaggerSteelModel,iBlackDagger,iKabar,iOldKnife,iUltimateKnife, ifu, ides, iss, imp, ips;
  12. int KnifeSelection[MAXPLAYERS+1];
  13. Handle g_hMySelection;
  14. Handle g_hMyFirstJoin;
  15. int showMenu[MAXPLAYERS+1] = 1;
  16.  
  17. #define DATA "2.3.1.1"
  18.  
  19. Handle cvar_time, timers, trie_times, cvar_times;
  20. int g_veces, g_time;
  21.  
  22. public Plugin myinfo =
  23. {
  24.     name = "Custom Knife Models | !knife",
  25.     author = "Mr.Derp & Franc1sco franug + wi1dna edit",
  26.     description = "Custom Knife Models",
  27.     version = DATA,
  28.     url = "http://steamcommunity.com/id/iLoveAnime69"
  29. }
  30.  
  31. public void OnPluginStart()
  32. {
  33.     trie_times = CreateTrie();
  34.    
  35.     CreateConVar("sm_customknifemodels_version", DATA, "plugin info", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_DONTRECORD);
  36.    
  37.     cvar_time = CreateConVar("sm_customknifemodels_time", "0", "время в начале раунда, что нормальный клиент может использовать команду !knife. 0 = disabled.");
  38.     cvar_times = CreateConVar("sm_customknifemodels_times", "0", "раз в карте, что нормальный клиент может использовать команду !knife. 0 = disabled.");
  39.     g_veces = GetConVarInt(cvar_times);
  40.     g_time = GetConVarInt(cvar_time);
  41.     HookConVarChange(cvar_time, OnConVarChanged);
  42.     HookConVarChange(cvar_times, OnConVarChanged);
  43.    
  44.     HookEvent("player_spawn", Event_Spawn, EventHookMode_Post);
  45.     HookEvent("round_start", Event_Start);
  46.     RegConsoleCmd("sm_knife", Cmd_sm_customknife, "Меню ножей");
  47.     g_hMySelection = RegClientCookie("ck_selection", "Выбори нож", CookieAccess_Protected);
  48.     g_hMyFirstJoin = RegClientCookie("ck_firstjoin", "Меню ножей показано", CookieAccess_Protected);
  49.    
  50.     for (int i = MaxClients; i > 0; --i)
  51.     {
  52.         if (!AreClientCookiesCached(i))
  53.         {
  54.             continue;
  55.         }
  56.        
  57.         OnClientCookiesCached(i);
  58.     }
  59. }
  60.  
  61. public void OnConVarChanged(Handle convar, const char[] oldValue, const char[] newValue)
  62. {
  63.     if (convar == cvar_time)
  64.     {
  65.         g_time = StringToInt(newValue);
  66.     }
  67.     else if (convar == cvar_times)
  68.     {
  69.         g_veces = StringToInt(newValue);
  70.     }
  71. }
  72.  
  73. public void OnMapStart()
  74. {
  75.     ClearTrie(trie_times);
  76.    
  77.     iTridaggerModel = PrecacheModel("models/weaponf/v_knife_tridagger_v2.mdl");
  78.     iTridaggerSteelModel = PrecacheModel("models/weaponf/v_knife_tridagger_steel.mdl");
  79.     iBlackDagger = PrecacheModel("models/weaponf/v_knife_reaper.mdl");
  80.     iKabar = PrecacheModel("models/weaponf/v_knife_kabar_v2.mdl");
  81.     iOldKnife = PrecacheModel("models/weaponf/crashz.mdl");
  82.     iUltimateKnife = PrecacheModel("models/weaponf/v_knife_ultimate.mdl");
  83.    
  84.     ifu = PrecacheModel("models/weapons/v_gongfu.mdl");
  85.     ides = PrecacheModel("models/weapons/caleon1/screwdriver/v_knife_screwdriver.mdl");
  86.  
  87.     iss = PrecacheModel("models/weapons/v_summerstick.mdl");
  88.     imp = PrecacheModel("models/weapons/v_minecraft_pickaxe.mdl");
  89.     ips = PrecacheModel("models/weapons/v_punchs.mdl");
  90.     //Tridagger
  91.     AddFileToDownloadsTable("models/weaponf/v_knife_tridagger_v2.dx90.vtx");
  92.     AddFileToDownloadsTable("models/weaponf/v_knife_tridagger_v2.mdl");
  93.     AddFileToDownloadsTable("models/weaponf/v_knife_tridagger_v2.vvd");
  94.     AddFileToDownloadsTable("materials/models/weaponf/v_models/tridagger/tridagger.vmt");
  95.     AddFileToDownloadsTable("materials/models/weaponf/v_models/tridagger/tridagger.vtf");
  96.     AddFileToDownloadsTable("materials/models/weaponf/v_models/tridagger/tridagger_exp.vtf");
  97.     AddFileToDownloadsTable("materials/models/weaponf/v_models/tridagger/tridagger_normal.vtf");
  98.     //Tridagger Steel
  99.     AddFileToDownloadsTable("models/weaponf/v_knife_tridagger_steel.dx90.vtx");
  100.     AddFileToDownloadsTable("models/weaponf/v_knife_tridagger_steel.mdl");
  101.     AddFileToDownloadsTable("models/weaponf/v_knife_tridagger_steel.vvd");
  102.     AddFileToDownloadsTable("materials/models/weaponf/v_models/tridagger/steel/tridagger.vmt");
  103.     AddFileToDownloadsTable("materials/models/weaponf/v_models/tridagger/steel/tridagger_elite.vtf");
  104.     AddFileToDownloadsTable("materials/models/weaponf/v_models/tridagger/steel/tridagger_exp.vtf");
  105.     AddFileToDownloadsTable("materials/models/weaponf/v_models/tridagger/steel/tridagger_elite_normal.vtf");
  106.     //Black Dagger
  107.     AddFileToDownloadsTable("models/weaponf/v_knife_reaper.dx90.vtx");
  108.     AddFileToDownloadsTable("models/weaponf/v_knife_reaper.mdl");
  109.     AddFileToDownloadsTable("models/weaponf/v_knife_reaper.vvd");
  110.     AddFileToDownloadsTable("materials/models/weaponf/v_models/dtb_dagger/dtb.vmt");
  111.     AddFileToDownloadsTable("materials/models/weaponf/v_models/dtb_dagger/dtb.vtf");
  112.     AddFileToDownloadsTable("materials/models/weaponf/v_models/dtb_dagger/dtb_exp.vtf");
  113.     AddFileToDownloadsTable("materials/models/weaponf/v_models/dtb_dagger/dtb_normal.vtf");
  114.     //Kabar
  115.     AddFileToDownloadsTable("models/weaponf/v_knife_kabar_v2.dx90.vtx");
  116.     AddFileToDownloadsTable("models/weaponf/v_knife_kabar_v2.mdl");
  117.     AddFileToDownloadsTable("models/weaponf/v_knife_kabar_v2.vvd");
  118.     AddFileToDownloadsTable("materials/models/weaponf/kabar/KABAR.vmt");
  119.     AddFileToDownloadsTable("materials/models/weaponf/kabar/kabar.vtf");
  120.     AddFileToDownloadsTable("materials/models/weaponf/kabar/kabar_G.vtf");
  121.     AddFileToDownloadsTable("materials/models/weaponf/kabar/kabar_n.vtf");
  122.     //1.6 Knife
  123.     AddFileToDownloadsTable("materials/models/weaponf/v_models/knife_ct/bowieknife.vmt");
  124.     AddFileToDownloadsTable("materials/models/weaponf/v_models/knife_ct/knife.vtf");
  125.     AddFileToDownloadsTable("materials/models/weaponf/v_models/knife_ct/knife_env.vtf");
  126.     AddFileToDownloadsTable("materials/models/weaponf/v_models/knife_ct/knife_normal.vtf");
  127.     AddFileToDownloadsTable("models/weaponf/crashz.dx80.vtx");
  128.     AddFileToDownloadsTable("models/weaponf/crashz.dx90.vtx");
  129.     AddFileToDownloadsTable("models/weaponf/crashz.mdl");
  130.     AddFileToDownloadsTable("models/weaponf/crashz.sw.vtx");
  131.     AddFileToDownloadsTable("models/weaponf/crashz.vvd");
  132.     //Ultimate Knife
  133.     AddFileToDownloadsTable("materials/models/weaponf/ultimate/texture_1.vmt");
  134.     AddFileToDownloadsTable("materials/models/weaponf/ultimate/texture_1.vtf");
  135.     AddFileToDownloadsTable("materials/models/weaponf/ultimate/texture_2.vmt");
  136.     AddFileToDownloadsTable("materials/models/weaponf/ultimate/texture_2.vtf");
  137.     AddFileToDownloadsTable("materials/models/weaponf/ultimate/texture_3.vmt");
  138.     AddFileToDownloadsTable("materials/models/weaponf/ultimate/texture_3.vtf");
  139.     AddFileToDownloadsTable("materials/models/weaponf/ultimate/texture_4.vmt");
  140.     AddFileToDownloadsTable("materials/models/weaponf/ultimate/texture_4.vtf");
  141.     AddFileToDownloadsTable("materials/models/weaponf/ultimate/texture_5.vmt");
  142.     AddFileToDownloadsTable("materials/models/weaponf/ultimate/texture_5.vtf");
  143.     AddFileToDownloadsTable("materials/models/weaponf/ultimate/texture_6.vmt");
  144.     AddFileToDownloadsTable("materials/models/weaponf/ultimate/texture_6.vtf");
  145.     AddFileToDownloadsTable("materials/models/weaponf/ultimate/texture_7.vmt");
  146.     AddFileToDownloadsTable("materials/models/weaponf/ultimate/texture_7.vtf");
  147.     AddFileToDownloadsTable("models/weaponf/v_knife_ultimate.dx90.vtx");
  148.     AddFileToDownloadsTable("models/weaponf/v_knife_ultimate.mdl");
  149.     AddFileToDownloadsTable("models/weaponf/v_knife_ultimate.vvd");
  150.    
  151.     AddFileToDownloadsTable("models/weapons/v_gongfu.mdl");
  152.     AddFileToDownloadsTable("models/weapons/v_gongfu.dx90.vtx");
  153.     AddFileToDownloadsTable("models/weapons/v_gongfu.vvd");
  154.  
  155.     AddFileToDownloadsTable("materials/models/weapons/gongfu/v_models/knife_t/tm_leet_lowerbody_variantb.vmt");
  156.     AddFileToDownloadsTable("materials/models/weapons/gongfu/v_models/knife_t/tm_leet_lowerbody_variantb.vtf");
  157.     AddFileToDownloadsTable("materials/models/weapons/gongfu/v_models/knife_t/tm_leet_lowerbody_variantb_exponent.vtf");
  158.     AddFileToDownloadsTable("materials/models/weapons/gongfu/v_models/knife_t/tm_leet_lowerbody_variantb_normal.vtf");
  159.  
  160.     AddFileToDownloadsTable("models/weapons/caleon1/screwdriver/v_knife_screwdriver.dx90.vtx");
  161.     AddFileToDownloadsTable("models/weapons/caleon1/screwdriver/v_knife_screwdriver.mdl");
  162.     AddFileToDownloadsTable("models/weapons/caleon1/screwdriver/v_knife_screwdriver.vvd");
  163.  
  164.     AddFileToDownloadsTable("materials/models/weapons/caleon1/screwdriver/yellow.vtf");
  165.     AddFileToDownloadsTable("materials/models/weapons/caleon1/screwdriver/black.vmt");
  166.     AddFileToDownloadsTable("materials/models/weapons/caleon1/screwdriver/black.vtf");
  167.     AddFileToDownloadsTable("materials/models/weapons/caleon1/screwdriver/metal.vmt");
  168.     AddFileToDownloadsTable("materials/models/weapons/caleon1/screwdriver/metal.vtf");
  169.     AddFileToDownloadsTable("materials/models/weapons/caleon1/screwdriver/yellow.vmt");
  170.    
  171.     // PUNCHS
  172.     AddFileToDownloadsTable("models/weapons/v_punchs.dx90.vtx");
  173.     AddFileToDownloadsTable("models/weapons/v_punchs.mdl");
  174.     AddFileToDownloadsTable("models/weapons/v_punchs.vvd");
  175.  
  176.     // MINECRAFT PICKAXE
  177.     AddFileToDownloadsTable("models/weapons/v_minecraft_pickaxe.dx90.vtx");
  178.     AddFileToDownloadsTable("models/weapons/v_minecraft_pickaxe.mdl");
  179.     AddFileToDownloadsTable("models/weapons/v_minecraft_pickaxe.vvd");
  180.  
  181.     AddFileToDownloadsTable("models/weapons/w_minecraft_pickaxe.dx90.vtx");
  182.     AddFileToDownloadsTable("models/weapons/w_minecraft_pickaxe.mdl");
  183.     AddFileToDownloadsTable("models/weapons/w_minecraft_pickaxe.phy");
  184.     AddFileToDownloadsTable("models/weapons/w_minecraft_pickaxe.vvd");
  185.  
  186.     AddFileToDownloadsTable("materials/models/weapons/minecraft_pickaxe/minecraft_pick_final.vmt");
  187.     AddFileToDownloadsTable("materials/models/weapons/minecraft_pickaxe/minecraft_pick_final.vtf");
  188.     // SUMMER STICK - WEAPON
  189.     AddFileToDownloadsTable("models/weapons/v_summerstick.dx90.vtx");
  190.     AddFileToDownloadsTable("models/weapons/v_summerstick.mdl");
  191.     AddFileToDownloadsTable("models/weapons/v_summerstick.vvd");
  192.  
  193.     AddFileToDownloadsTable("models/weapons/w_summerstick.dx90.vtx");
  194.     AddFileToDownloadsTable("models/weapons/w_summerstick.mdl");
  195.     AddFileToDownloadsTable("models/weapons/w_summerstick.phy");
  196.     AddFileToDownloadsTable("models/weapons/w_summerstick.vvd");
  197.  
  198.     AddFileToDownloadsTable("materials/models/player/custom/summer_freak/T_GOD_Poseidon_Kiddie_DIF.vmt");
  199.     AddFileToDownloadsTable("materials/models/player/custom/summer_freak/T_GOD_Poseidon_Kiddie_DIF.vtf");
  200.     AddFileToDownloadsTable("materials/models/player/custom/summer_freak/T_GOD_Poseidon_Kiddie_NRM.vtf");
  201. }
  202.  
  203. public Action Cmd_sm_customknife(int client, int args)
  204. {
  205.     if (client == 0)
  206.     {
  207.         ReplyToCommand(client, "%t", "Команда только в игре");
  208.         return Plugin_Handled;
  209.     }
  210.     ShowKnifeMenu(client);
  211.     return Plugin_Handled;
  212. }
  213.  
  214. void ShowKnifeMenu(int client)
  215. {
  216.     Menu menu_knives = new Menu(mh_KnifeHandler);
  217.     SetMenuTitle(menu_knives, "Выбрать нож");
  218.  
  219.     AddMenuItem(menu_knives, "default", "Стандартный нож");
  220.     AddMenuItem(menu_knives, "tridagger", "Тройной кинжал (черный)");
  221.     AddMenuItem(menu_knives, "tridagger_steel", "Тройной кинжал (сталь)");
  222.     AddMenuItem(menu_knives, "kabar", "Ка-Бар");
  223.     AddMenuItem(menu_knives, "reaper", "Кинжал Жнеца");
  224.     AddMenuItem(menu_knives, "css", "Нож из CS:S/CS 1.6");
  225.     AddMenuItem(menu_knives, "ultimate", "Нож Медведя Гриллс");
  226.     AddMenuItem(menu_knives, "ifu", "Гонг-фу");
  227.     AddMenuItem(menu_knives, "ides", "Отвертка");
  228.     AddMenuItem(menu_knives, "iss", "Летняя палочка");
  229.     AddMenuItem(menu_knives, "imp", "Кирка");
  230.     AddMenuItem(menu_knives, "ips", "Кулаки");
  231.     SetMenuPagination(menu_knives, 0);
  232.     //SetMenuExitButton(menu_knives, true);
  233.     DisplayMenu(menu_knives, client, 0);
  234. }
  235.  
  236. public int mh_KnifeHandler(Menu menu, MenuAction action, int param1, int param2)
  237. {
  238.     switch (action)
  239.     {
  240.         case MenuAction_Select:
  241.         {
  242.             //param1 is client, param2 is item
  243.             if(GetUserAdmin(param1) == INVALID_ADMIN_ID)
  244.             {
  245.                 if(g_time > 0 && timers == INVALID_HANDLE)
  246.                 {
  247.                
  248.                     CPrintToChat(param1, "{GREEN}[Knife] {DEFAULT}Вы можете использовать этот плагин только спустя {GREEN}%i {DEFAULT}секунд начала раунда!", g_time);
  249.                     return;
  250.                 }
  251.            
  252.                 char steamid[64];
  253.                 int times;
  254.                 GetClientAuthId(param1, AuthId_Steam2,  steamid, sizeof(steamid));
  255.            
  256.                 if(!GetTrieValue(trie_times, steamid, times))
  257.                 {
  258.                     times = 0;
  259.                 }
  260.                
  261.                 if(g_veces > 0 && times >= g_veces)
  262.                 {
  263.                     CPrintToChat(param1, "{GREEN}[Knife] {DEFAULT}Вы можете использовать этот плагин только{GREEN} %i {DEFAULT}минут на карте!", g_veces);
  264.                     return;
  265.                 }
  266.                 ++times;
  267.    
  268.                 SetTrieValue(trie_times, steamid, times);
  269.             }
  270.            
  271.             char item[64];
  272.             GetMenuItem(menu, param2, item, sizeof(item));
  273.            
  274.             SetKnife(param1, item);
  275.            
  276.         }
  277.         case MenuAction_End:
  278.         {
  279.             //param1 is MenuEnd reason, if canceled param2 is MenuCancel reason
  280.             CloseHandle(menu);
  281.  
  282.         }
  283.  
  284.     }
  285. }
  286.  
  287. void SetKnife(int param1, char[] item)
  288. {
  289.     char item2[16];
  290.     if (StrEqual(item, "default"))
  291.     {
  292.         FPVMI_RemoveViewModelToClient(param1, "weapon_knife");
  293.         KnifeSelection[param1] = 0;
  294.         IntToString(KnifeSelection[param1], item2, sizeof(item2));
  295.         SetClientCookie(param1, g_hMySelection, item2);
  296.     }
  297.     else if (StrEqual(item, "tridagger"))
  298.     {
  299.         KnifeSelection[param1] = 1;
  300.         FPVMI_AddViewModelToClient(param1, "weapon_knife", iTridaggerModel);
  301.         IntToString(KnifeSelection[param1], item2, sizeof(item2));
  302.         SetClientCookie(param1, g_hMySelection, item2);
  303.     }
  304.     else if (StrEqual(item, "tridagger_steel"))
  305.     {
  306.         KnifeSelection[param1] = 2;
  307.         FPVMI_AddViewModelToClient(param1, "weapon_knife", iTridaggerSteelModel);
  308.         IntToString(KnifeSelection[param1], item2, sizeof(item2));
  309.         SetClientCookie(param1, g_hMySelection, item2);
  310.     }
  311.     else if (StrEqual(item, "kabar"))
  312.     {
  313.         KnifeSelection[param1] = 3;
  314.         FPVMI_AddViewModelToClient(param1, "weapon_knife", iKabar);
  315.         IntToString(KnifeSelection[param1], item2, sizeof(item2));
  316.         SetClientCookie(param1, g_hMySelection, item2);
  317.     }
  318.     else if (StrEqual(item, "reaper"))
  319.     {
  320.         KnifeSelection[param1] = 4;
  321.         FPVMI_AddViewModelToClient(param1, "weapon_knife", iBlackDagger);
  322.         IntToString(KnifeSelection[param1], item2, sizeof(item2));
  323.         SetClientCookie(param1, g_hMySelection, item2);
  324.     }
  325.     else if (StrEqual(item, "css"))
  326.     {
  327.         KnifeSelection[param1] = 5;
  328.         FPVMI_AddViewModelToClient(param1, "weapon_knife", iOldKnife);
  329.         IntToString(KnifeSelection[param1], item2, sizeof(item2));
  330.         SetClientCookie(param1, g_hMySelection, item2);
  331.     }
  332.     else if (StrEqual(item, "ultimate"))
  333.     {
  334.         KnifeSelection[param1] = 6;
  335.         FPVMI_AddViewModelToClient(param1, "weapon_knife", iUltimateKnife);
  336.         IntToString(KnifeSelection[param1], item2, sizeof(item2));
  337.         SetClientCookie(param1, g_hMySelection, item2);
  338.     }
  339.     else if (StrEqual(item, "ifu"))
  340.     {
  341.         KnifeSelection[param1] = 7;
  342.         FPVMI_AddViewModelToClient(param1, "weapon_knife", ifu);
  343.         IntToString(KnifeSelection[param1], item2, sizeof(item2));
  344.         SetClientCookie(param1, g_hMySelection, item2);
  345.     }
  346.     else if (StrEqual(item, "ides"))
  347.     {
  348.         KnifeSelection[param1] = 8;
  349.         FPVMI_AddViewModelToClient(param1, "weapon_knife", ides);
  350.         IntToString(KnifeSelection[param1], item2, sizeof(item2));
  351.         SetClientCookie(param1, g_hMySelection, item2);
  352.     }
  353.     else if (StrEqual(item, "iss"))
  354.     {
  355.         KnifeSelection[param1] = 9;
  356.         FPVMI_AddViewModelToClient(param1, "weapon_knife", iss);
  357.         IntToString(KnifeSelection[param1], item2, sizeof(item2));
  358.         SetClientCookie(param1, g_hMySelection, item2);
  359.     }
  360.     else if (StrEqual(item, "imp"))
  361.     {
  362.         KnifeSelection[param1] = 10;
  363.         FPVMI_AddViewModelToClient(param1, "weapon_knife", imp);
  364.         IntToString(KnifeSelection[param1], item2, sizeof(item2));
  365.         SetClientCookie(param1, g_hMySelection, item2);
  366.     }
  367.     else if (StrEqual(item, "ips"))
  368.     {
  369.         KnifeSelection[param1] = 11;
  370.         FPVMI_AddViewModelToClient(param1, "weapon_knife", ips);
  371.         IntToString(KnifeSelection[param1], item2, sizeof(item2));
  372.         SetClientCookie(param1, g_hMySelection, item2);
  373.     }
  374. }
  375.  
  376.  
  377.  
  378. public void OnClientCookiesCached(int client)
  379. {
  380.     char sCookieValue[11];
  381.     GetClientCookie(client, g_hMySelection, sCookieValue, sizeof(sCookieValue));
  382.     KnifeSelection[client] = StringToInt(sCookieValue);
  383.     char sCookieValue2[11];
  384.     GetClientCookie(client, g_hMyFirstJoin, sCookieValue2, sizeof(sCookieValue2));
  385.     showMenu[client] = StringToInt(sCookieValue2);
  386. }
  387.  
  388. public void OnClientPostAdminCheck(int client)
  389. {
  390.     if(AreClientCookiesCached(client)) SetKnife_saved(client);
  391. }
  392.  
  393. void SetKnife_saved(int param1)
  394. {
  395.     switch (KnifeSelection[param1])
  396.     {
  397.         case 1:
  398.         {
  399.             FPVMI_AddViewModelToClient(param1, "weapon_knife", iTridaggerModel);
  400.         }
  401.         case 2:
  402.         {
  403.             FPVMI_AddViewModelToClient(param1, "weapon_knife", iTridaggerSteelModel);
  404.         }
  405.         case 3:
  406.         {
  407.             FPVMI_AddViewModelToClient(param1, "weapon_knife", iKabar);
  408.         }
  409.         case 4:
  410.         {
  411.             FPVMI_AddViewModelToClient(param1, "weapon_knife", iBlackDagger);
  412.         }
  413.         case 5:
  414.         {
  415.             FPVMI_AddViewModelToClient(param1, "weapon_knife", iOldKnife);
  416.         }
  417.         case 6:
  418.         {
  419.             FPVMI_AddViewModelToClient(param1, "weapon_knife", iUltimateKnife);
  420.         }
  421.         case 7:
  422.         {
  423.             FPVMI_AddViewModelToClient(param1, "weapon_knife", ifu);   
  424.         }
  425.         case 8:
  426.         {
  427.             FPVMI_AddViewModelToClient(param1, "weapon_knife", ides);  
  428.         }
  429.         case 9:
  430.         {
  431.             FPVMI_AddViewModelToClient(param1, "weapon_knife", iss);   
  432.         }
  433.         case 10:
  434.         {
  435.             FPVMI_AddViewModelToClient(param1, "weapon_knife", imp);   
  436.         }
  437.         case 11:
  438.         {
  439.             FPVMI_AddViewModelToClient(param1, "weapon_knife", ips);   
  440.         }
  441.         default:
  442.         {
  443.                     // Blah
  444.         }
  445.     }
  446. }
  447.  
  448. public Action Event_Start(Event gEventHook, const char[] gEventName, bool iDontBroadcast)
  449. {
  450.     if(timers != INVALID_HANDLE) KillTimer(timers);
  451.     timers = CreateTimer(GetConVarInt(cvar_time) * 1.0, Passed);
  452.    
  453. }
  454.  
  455. public Action Passed(Handle timer)
  456. {
  457.     timers = INVALID_HANDLE;
  458. }
  459.  
  460. public Action Event_Spawn(Event gEventHook, const char[] gEventName, bool iDontBroadcast)
  461. {
  462.     int iClient = GetClientOfUserId(GetEventInt(gEventHook, "userid"));
  463.    
  464.     if (AreClientCookiesCached(iClient))
  465.     {
  466.         if (showMenu[iClient] == 0)
  467.         {
  468.             showMenu[iClient] = 1;
  469.             ShowKnifeMenu(iClient);
  470.             SetClientCookie(iClient, g_hMyFirstJoin, "1");
  471.         }
  472.     }
  473. }
  474.  
  475. stock bool IsValidClient(int client, bool nobots = true)
  476. {
  477.     if (client <= 0 || client > MaxClients || !IsClientConnected(client) || (nobots && IsFakeClient(client)))
  478.     {
  479.         return false;
  480.     }
  481.     return IsClientInGame(client);
  482. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement