daily pastebin goal
11%
SHARE
TWEET

mod

AescoEdits Apr 17th, 2018 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <engine>  
  4. #include <vault>
  5. #include <hamsandwich>
  6. #include <fvault>
  7.  
  8. #pragma tabsize 0
  9.  
  10. #define is_valid_player(%1) (1 <= %1 <= 32)
  11.  
  12. new knife_model[33];
  13. new vknife_model[33];
  14. new const g_VAULTNAME[] = "UnqE# Knifes";
  15. new const VERSION[] = "1.2"
  16. new const AUTHOR[] = "Aesco"
  17.  
  18. new iLevel[33];
  19. new iXp[33];
  20.  
  21. new knife_on;
  22.  
  23. new MaxLevel;
  24. new StartedLevel;
  25.  
  26. new cvar_KillXp;
  27. new cvar_HsXp;
  28. new cvar_KnifeXp;
  29.  
  30. new Forward_spawn;
  31. new Forward_levelup;
  32. new ForwardReturn;
  33.  
  34. new const g_VKnifeNames[][32] =
  35. {
  36. "VIP Duals",
  37. "VIP Butterfly",
  38. "VIP Theif",
  39. "VIP UnqE#",
  40. "VIP Katanas",
  41. "VIP Fish"
  42. };
  43.  
  44. new const g_KnifeNames[][32] =
  45. {
  46. "Obican Knife",
  47. "Alien Knife",
  48. "Dagger",
  49. "Dark Knife",
  50. "Transparent Knife",
  51. "Katara",
  52. "Special",
  53. "Ice Blade",
  54. "Gold Axe",
  55. "Katana",
  56. "Daedric",
  57. "Starwars Knife",
  58. "Wolverine Claws",
  59. "Blaze Axe",
  60. "Artic Daedric",
  61. "Tracker Knife",
  62. "Flip Knife",
  63. "Golden Sickle",
  64. "Saber",
  65. "Guitar",
  66. "Black & White",
  67. "Candy",
  68. "Tactical Knife",
  69. "Snake Knife",
  70. "Skulls Knife",
  71. "Combat Knife",
  72. "Combat Axe",
  73. "Xmas Hammer",
  74. "Xmas Axe",
  75. "Xmas Combat",
  76. "Xmas Snowman",
  77. "Xmas Katanas"
  78. };
  79.  
  80. new const g_KnifevVIP[][256]=
  81. {
  82. "models/KnifesVIP/v_dual.mdl",
  83. "models/KnifesVIP/v_but.mdl",
  84. "models/KnifesVIP/v_krv.mdl",
  85. "models/KnifesVIP/v_emac.mdl",
  86. "models/KnifesVIP/v_katana.mdl",
  87. "models/KnifesVIP/v_fish.mdl"
  88. }
  89.  
  90. new const g_KnifevModels[][256] =
  91. {
  92. "models/v_knife.mdl",
  93. "models/Knifes/v_knife_alien.mdl",
  94. "models/Knifes/v_knife_ellium.mdl",
  95. "models/Knifes/v_knife_dark.mdl",
  96. "models/Knifes/v_knife_transparent.mdl",
  97. "models/Knifes/v_knife_genuine.mdl",
  98. "models/Knifes/v_knife_hunt.mdl",
  99. "models/Knifes/v_knife_shadow.mdl",
  100. "models/Knifes/v_knife_slaughterer.mdl",
  101. "models/Knifes/v_knife_katana.mdl",
  102. "models/Knifes/v_daedric.mdl",
  103. "models/Knifes/v_knife_lightsaber.mdl",
  104. "models/Knifes/v_knife_wolverine.mdl",
  105. "models/Knifes/v_knife_proton.mdl",
  106. "models/Knifes/v_dedric.mdl",
  107. "models/Knifes/v_tracker.mdl",
  108. "models/Knifes/v_csgo.mdl",
  109. "models/Knifes/v_sickle.mdl",
  110. "models/Knifes/v_saber.mdl",
  111. "models/Knifes/v_guitar.mdl",
  112. "models/Knifes/v_bnw.mdl",
  113. "models/Knifes/v_candy.mdl",
  114. "models/Knifes/v_tactical.mdl",
  115. "models/Knifes/v_snake.mdl",
  116. "models/Knifes/v_skull.mdl",
  117. "models/Knifes/v_combat.mdl",
  118. "models/Knifes/v_hammer.mdl",
  119. "models/Knifes/v_xhammer.mdl",
  120. "models/Knifes/v_xaxe.mdl",
  121. "models/Knifes/v_xcombat.mdl",
  122. "models/Knifes/v_xsnow.mdl",
  123. "models/Knifes/v_xkatanas.mdl"
  124. }
  125.  
  126. native register_maxlevels( maxlevel = 200, started_xp_level = 100 );
  127. native get_user_level( index );
  128. native get_user_xp( index );
  129.  
  130. public plugin_init() {  
  131.    
  132.     register_plugin(g_VAULTNAME, VERSION, AUTHOR);
  133.     register_cvar("knife_skins", VERSION, FCVAR_SERVER); // Find Servers on Game-Monitor
  134.     set_cvar_string("knife_skins", VERSION); // Find Servers on Game-Monitor
  135.    
  136.     // register max levels 13 is the top level, 100 is the started level xp.
  137.     register_maxlevels( 200, 100 );
  138.    
  139.     //Admin commands
  140.    
  141.     register_concmd("give_xp" ,"givexp",ADMIN_CFG,"Usage <nick> <Add xp to a player>")
  142.     register_concmd("take_xp", "takexp",ADMIN_CFG,"Usage <nick> <Remove xp from a player>")
  143.     register_concmd("set_level", "givelevel",ADMIN_CFG,"Usage <nick> <LEVEL>")
  144.    
  145.    
  146.     //Clcmd's
  147.    
  148.     knife_on = register_cvar( "knife_skins", "1" );
  149.    
  150.     register_clcmd("say","HandleSay");
  151.     register_clcmd("say_team","HandleSay")
  152.     register_clcmd("say /knife", "KnifeSkinsMenu");
  153.     register_clcmd("say /knifes", "KnifeSkinsMenu");
  154.     register_clcmd("say /knive", "KnifeSkinsMenu");
  155.     register_clcmd("say /knives", "KnifeSkinsMenu");
  156.     register_clcmd("say /level", "PlayerLevelsMenu");
  157.     register_clcmd("say /levels", "PlayerLevelsMenu");
  158.     register_clcmd("say /vipmenu", "VIPMenu");
  159.    
  160.     //Event's
  161.    
  162.     register_event("CurWeapon","CurWeapon","be","1=1");
  163.     register_event( "DeathMsg", "EventDeathMsg", "a" );
  164.    
  165.     //Cvar's
  166.    
  167.     cvar_KillXp = register_cvar( "kill_xp", "5" );
  168.     cvar_HsXp = register_cvar( "hs_xp", "2" );
  169.     cvar_KnifeXp = register_cvar( "knife_xp", "3" );
  170.    
  171.     //Ham's
  172.    
  173.     RegisterHam( Ham_Spawn, "player", "FwdPlayerSpawn", 1 );
  174.     RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
  175.    
  176.     //Forward's
  177.    
  178.     Forward_levelup = CreateMultiForward( "forward_client_levelup", ET_IGNORE, FP_CELL, FP_CELL, FP_CELL );
  179.     Forward_spawn = CreateMultiForward( "forward_client_spawn", ET_IGNORE, FP_CELL , FP_CELL, FP_CELL );
  180.    
  181.     //set_task(15.0, "Knifemessage", 0, _, _, "b")
  182.     //set_task(35.0, "Levelmessage", 0, _, _, "b")
  183. }
  184.  
  185. public plugin_precache() {  
  186.    
  187.     precache_model("models/v_knife.mdl")
  188.     precache_model("models/Knifes/v_knife_alien.mdl")
  189.     precache_model("models/Knifes/v_knife_ellium.mdl")
  190.     precache_model("models/Knifes/v_knife_dark.mdl")
  191.     precache_model("models/Knifes/v_knife_transparent.mdl")
  192.     precache_model("models/Knifes/v_knife_genuine.mdl")
  193.     precache_model("models/Knifes/v_knife_hunt.mdl")
  194.     precache_model("models/Knifes/v_knife_shadow.mdl")
  195.     precache_model("models/Knifes/v_knife_slaughterer.mdl")
  196.     precache_model("models/Knifes/v_knife_katana.mdl")
  197.     precache_model("models/Knifes/v_daedric.mdl")
  198.     precache_model("models/Knifes/v_knife_lightsaber.mdl")
  199.     precache_model("models/Knifes/v_knife_wolverine.mdl")
  200.     precache_model("models/Knifes/v_knife_proton.mdl")
  201.     precache_model("models/Knifes/v_dedric.mdl")
  202.     precache_model("models/Knifes/v_tracker.mdl")
  203.     precache_model("models/Knifes/v_csgo.mdl")
  204.     precache_model("models/Knifes/v_sickle.mdl")
  205.     precache_model("models/Knifes/v_saber.mdl")
  206.     precache_model("models/Knifes/v_guitar.mdl")
  207.     precache_model("models/Knifes/v_bnw.mdl")
  208.     precache_model("models/Knifes/v_candy.mdl")
  209.     precache_model("models/Knifes/v_tactical.mdl")
  210.     precache_model("models/Knifes/v_snake.mdl")
  211.     precache_model("models/Knifes/v_skull.mdl")
  212.     precache_model("models/Knifes/v_combat.mdl")
  213.     precache_model("models/Knifes/v_hammer.mdl")
  214.     precache_model("models/KnifesVIP/v_dual.mdl")
  215.     precache_model("models/KnifesVIP/v_krv.mdl")
  216.     precache_model("models/KnifesVIP/v_katana.mdl")
  217.     precache_model("models/KnifesVIP/v_but.mdl")
  218.     precache_model("models/KnifesVIP/v_emac.mdl")
  219.     precache_model("models/KnifesVIP/v_fish.mdl")
  220.     precache_model("models/Knifes/v_xhammer.mdl")
  221.     precache_model("models/Knifes/v_xcombat.mdl")
  222.     precache_model("models/Knifes/v_xkatanas.mdl")
  223.     precache_model("models/Knifes/v_xsnow.mdl")
  224.     precache_model("models/Knifes/v_xaxe.mdl") 
  225. }
  226.  
  227. public plugin_natives( )
  228. {
  229.     //Native's
  230.    
  231.     register_library( "Knife-Skins" );
  232.    
  233.     register_native( "register_maxlevels", "_register_maxlevels" );
  234.     register_native( "get_user_level", "_get_user_level" );
  235.     register_native( "set_user_level", "_set_user_level" );
  236.     register_native( "get_user_xp", "_get_user_xp" );
  237.     register_native( "set_user_xp", "_set_user_xp" );
  238. }
  239.  
  240. public _register_maxlevels( plugin, params )
  241. {
  242.     if( MaxLevel != 0 && StartedLevel != 0 )
  243.     {
  244.         return;
  245.     }
  246.     else
  247.     {
  248.         MaxLevel = get_param( 1 );
  249.         StartedLevel = get_param( 2 );
  250.     }
  251. }
  252.  
  253. public _get_user_level( plugin, params )
  254. {
  255.     return iLevel[ get_param( 1 ) ];
  256. }
  257.  
  258. public _set_user_level( plugin, params )
  259. {
  260.     iLevel[ get_param( 1 ) ] = max( get_param( 2 ), MaxLevel );
  261.    
  262.     FlsahLevelUp( get_param( 1 ) );
  263.    
  264.     SaveData( get_param( 1 ) );
  265.    
  266.     LoadData( get_param( 1 ) );
  267.    
  268.     VLoadData( get_param( 1 ) );
  269. }
  270.  
  271. public _get_user_xp( plugin, params )
  272. {
  273.     return iXp[ get_param( 1 ) ];
  274. }
  275.  
  276. public _set_user_xp( plugin, params )
  277. {
  278.     iXp[ get_param( 1 ) ] = get_param( 2 );
  279.    
  280.     CheckLevel( get_param( 1 ) );
  281.    
  282.     SaveData( get_param( 1 ) );
  283.    
  284.     LoadData( get_param( 1 ) );
  285.    
  286.     VLoadData( get_param( 1 ) );
  287. }
  288.  
  289. public CheckLevel( id )
  290. {
  291.     if( iLevel[id] == MaxLevel )
  292.     {
  293.         return;
  294.     }
  295.     else
  296.     {
  297.         new level = iLevel[id] > 0 ? iLevel[id] : 1;
  298.        
  299.         new xp = level * StartedLevel;
  300.        
  301.         if( iLevel[id] > 0 )
  302.         {
  303.             xp +=  ( xp * 4 / 2 );
  304.         }
  305.        
  306.         while( iXp[id] >= xp )
  307.         {
  308.             iLevel[id]++;
  309.            
  310.             ColorChat(id,"^4Cestitamo!^1 dobili ste unapredjenje! sada ste^4 LEVEL^1: ^3%i^1.", iLevel[id]);
  311.             ColorChat(0,"^3%s^1 je sada ^4 LEVEL^3 %i^1!",get_player_name(id), iLevel[id]);
  312.            
  313.             FlsahLevelUp(id);
  314.            
  315.             ExecuteForward( Forward_levelup, ForwardReturn, id, iLevel[id], iXp[id] );
  316.            
  317.             SaveData( id );
  318.            
  319.             CheckLevel( id );
  320.            
  321.             break;
  322.         }
  323.     }
  324. }
  325.  
  326. public hudmessage( client ){
  327.     set_hudmessage(0, 255, 255, -1.0, 0.87, 0, 6.0, 12.0)
  328.     show_hudmessage(client, "Welcome to UnqE# Knife!^n--------------------^nYour Level:%d     |     Your XP:%d     |     Your Knife:%s", iLevel, iXp, g_KnifeNames )
  329. }
  330.  
  331. public FlsahLevelUp( id )
  332. {
  333.     message_begin( MSG_ONE, get_user_msgid( "ScreenFade" ), { 0, 0, 0}, id );
  334.     write_short( 1 << 10 );
  335.     write_short( 1 << 10 );
  336.     write_short( 0 );
  337.     write_byte( 0 );
  338.     write_byte( 255 );
  339.     write_byte( 215 );
  340.     write_byte( 100 );
  341.     message_end( );
  342. }
  343.  
  344.  
  345. public HandleSay(id){
  346.    
  347.     if (get_pcvar_num(knife_on) == 0)
  348.     {
  349.         ColorChat(id, "Mod je ugasen.");
  350.         return PLUGIN_HANDLED;
  351.     }
  352.    
  353.     new iMsg[200], iArgs[4][60];
  354.     new level = iLevel[id] > 0 ? iLevel[id] : 1;
  355.    
  356.     new xp = level * StartedLevel;
  357.    
  358.     if( iLevel[id] > 0 )
  359.     {
  360.         xp +=  ( xp * 4 / 2 );
  361.     }
  362.    
  363.     read_argv(1,iMsg ,sizeof iMsg - 1);
  364.     parse(iMsg,iArgs[0],charsmax(iArgs[]),iArgs[1],charsmax(iArgs[]),iArgs[2],charsmax(iArgs[]),iArgs[3],charsmax(iArgs[]));
  365.    
  366.     if (equali(iArgs[0],"/level") || equali(iArgs[0],"/lvl") || equali(iArgs[0],"/xp"))
  367.     {    
  368.         new player = cmd_target(id,iArgs[1],CMDTARGET_NO_BOTS);
  369.        
  370.         if (!player)
  371.         {
  372.             ColorChat( id, "^4LEVEL^1:^3 %i^4 |^1XP^4:^3 %i^1/^3%i^1.", iLevel[id], iXp[id], xp );
  373.         }
  374.     }
  375.    
  376.     return 0;
  377. }
  378.  
  379. public EventDeathMsg(id)
  380. {
  381.     if (get_pcvar_num(knife_on) == 0)
  382.         return PLUGIN_HANDLED;
  383.    
  384.     new killer = read_data( 1 );
  385.     new victim = read_data( 2 );
  386.    
  387.     if( killer == victim || ! is_user_connected( killer ) || ! is_user_connected( victim ) )
  388.     {
  389.         return PLUGIN_HANDLED;
  390.         //return;
  391.     }
  392.    
  393.     new XpAmount = get_pcvar_num( cvar_KillXp );
  394.    
  395.     if( read_data( 3 ) )
  396.     {
  397.         XpAmount += get_pcvar_num( cvar_HsXp );
  398.     }
  399.    
  400.     static sWeapon[ 26 ];
  401.    
  402.     read_data( 4, sWeapon, sizeof( sWeapon ) - 1 );
  403.    
  404.    
  405.     if( equal( sWeapon, "knife" ) )  
  406.     {
  407.         XpAmount += get_pcvar_num( cvar_KnifeXp );
  408.     }
  409.    
  410.     iXp[ killer ] += XpAmount;
  411.    
  412.     CheckLevel( killer );
  413.    
  414.     SaveData( killer );
  415.    
  416.     ColorChat( killer, "Dobio si^3 %i^1 XP.", XpAmount );
  417.    
  418.     return PLUGIN_HANDLED;
  419. }
  420.  
  421. public FwdPlayerSpawn( id )
  422. {
  423.     ExecuteForward( Forward_spawn, ForwardReturn, id, iLevel[id], iXp[id] );
  424. }
  425.  
  426. public fw_TakeDamage(victim, inflictor, attacker, Float:damage)
  427. {
  428.     if( get_pcvar_num( knife_on ) == 0 )
  429.         return HAM_IGNORED;
  430.    
  431.     if( is_valid_player( attacker ) && get_user_weapon(attacker) == CSW_KNIFE )
  432.     //{
  433.         //SetHamParamFloat(4, damage + knife_model[attacker]);
  434.         //
  435.         //return HAM_HANDLED;
  436.     //}
  437.    
  438.     return HAM_IGNORED;
  439. }
  440.  
  441. public KnifeSkinsMenu(id) {
  442.    
  443.     if (get_pcvar_num(knife_on) == 0)
  444.     {
  445.         ColorChat(id, "The mod has been disabale.");
  446.         return PLUGIN_HANDLED;
  447.     }
  448.    
  449.     new szItem[256], szAlien[50], szDagger[50], szDark[50], szTransparent[50],
  450.     szKatara[50], szSpecial[50], szIce[50], szGold[50], szKatana[50],
  451.     szDaedric[50], szStarwars[50], szWolverine[50], szBlaze[50], szArtic[50],
  452.     szTracker[50], szFlip[50], szGolden[50], szSaber[50], szGuitar[50],
  453.     szBlack[50], szCandy[50], szTactical[50], szSnake[50], szSkulls[50], szCombat[50], szHammer[50],
  454.     szXhammer[50], szXaxe[50], szXcombat[50], szXsnowman[50], szXkatanas[50], szVduals[50], szVbutterfly[50], szVtheif[50], szVeclipse[50], szVkatanas[50],
  455.     szVfish[50];
  456.    
  457.     new level = iLevel[id] > 0 ? iLevel[id] : 1;
  458.    
  459.     new xp = level * StartedLevel;
  460.    
  461.     if( iLevel[id] > 0 )
  462.     {
  463.         xp +=  ( xp * 4 / 2 );
  464.     }
  465.    
  466.     formatex(szItem, charsmax(szItem), "\w[ \r%s \w] \yKnives Menu \rv%s^n\yTvoj Level: \r%d \w- \yTvoj XP: \r%d\w/\r%d\w.^n\yPage:\r", g_VAULTNAME, VERSION,iLevel[id],iXp[id], xp);
  467.     formatex(szAlien, charsmax(szAlien),"%s", iLevel[id] >= 1 ? "\wAlien Knife [\yUNLOCKED\w]" : "\dAlien Knife [\rLEVEL 1 \d]");
  468.     formatex(szDagger, charsmax(szDagger),"%s", iLevel[id] >= 5 ? "\wDagger [\yUNLOCKED\w]" : "\dDagger [\rLEVEL 5 \d]");
  469.     formatex(szDark, charsmax(szDark),"%s", iLevel[id] >= 10 ? "\wDark Knife [\yUNLOCKED\w]" : "\dDark Knife [\rLEVEL 10 \d]");
  470.     formatex(szTransparent, charsmax(szTransparent),"%s", iLevel[id] >= 12 ? "\wTransparent Knife [\yUNLOCKED\w]" : "\dTransparent Knife [\rLEVEL 12 \d]");
  471.     formatex(szKatara, charsmax(szKatara),"%s", iLevel[id] >= 15 ? "\wKatara [\yUNLOCKED\w]" : "\dKatara [\rLEVEL 15 \d]");
  472.     formatex(szSpecial, charsmax(szSpecial),"%s", iLevel[id] >= 20 ? "\wSpecial Knife [\yUNLOCKED\w]" : "\dSpecial Knife [\rLEVEL 20 \d]");
  473.     formatex(szIce, charsmax(szIce),"%s", iLevel[id] >= 23 ? "\wIce Blade [\yUNLOCKED\w]" : "\dIce Blade [\rLEVEL 23 \d]");
  474.     formatex(szGold, charsmax(szGold),"%s", iLevel[id] >= 27 ? "\wGold Axe [\yUNLOCKED\w]" : "\dGold Axe [\rLEVEL 27 \d]");
  475.     formatex(szKatana, charsmax(szKatana),"%s", iLevel[id] >= 32 ? "\wKatana [\yUNLOCKED\w]" : "\dKatana [\rLEVEL 32 \d]");
  476.     formatex(szDaedric, charsmax(szDaedric),"%s", iLevel[id] >= 40 ? "\wDaedric [\yUNLOCKED\w]" : "\dDaedric [\rLEVEL 40 \d]");
  477.     formatex(szStarwars, charsmax(szStarwars),"%s", iLevel[id] >= 43 ? "\wStarwars Knife [\yUNLOCKED\w]" : "\dStarwars Knife [\rLEVEL 43 \d]");
  478.     formatex(szWolverine, charsmax(szWolverine),"%s", iLevel[id] >= 45 ? "\wWolverine's Claws [\yUNLOCKED\w]" : "\dWolverine's Claws [\rLEVEL 45 \d]");
  479.     formatex(szBlaze, charsmax(szBlaze),"%s", iLevel[id] >= 50 ? "\wBlaze Axe [\yUNLOCKED\w]" : "\dBlaze Axe [\rLEVEL 50 \d]");
  480.     formatex(szArtic, charsmax(szArtic),"%s", iLevel[id] >= 55 ? "\wArtic Daedric [\yUNLOCKED\w]" : "\dArtic Daedric [\rLEVEL 55 \d]");
  481.     formatex(szTracker, charsmax(szTracker),"%s", iLevel[id] >= 60 ? "\wTracker Knife [\yUNLOCKED\w]" : "\dTracker Knife [\rLEVEL 60 \d]");
  482.     formatex(szFlip, charsmax(szFlip),"%s", iLevel[id] >= 65 ? "\wFlip Knife [\yUNLOCKED\w]" : "\dFlip Knife [\rLEVEL 65 \d]");
  483.     formatex(szGolden, charsmax(szGolden),"%s", iLevel[id] >= 70 ? "\wGolden Sickle [\yUNLOCKED\w]" : "\dGolden Sickle [\rLEVEL 70 \d]");
  484.     formatex(szSaber, charsmax(szSaber),"%s", iLevel[id] >= 73 ? "\wSaber [\yUNLOCKED\w]" : "\dSaber [\rLEVEL 73 \d]");
  485.     formatex(szGuitar, charsmax(szGuitar),"%s", iLevel[id] >= 80 ? "\wGuitar [\yUNLOCKED\w]" : "\dGuitar [\rLEVEL 80 \d]");
  486.     formatex(szBlack, charsmax(szBlack),"%s", iLevel[id] >= 85 ? "\wBlack & White [\yUNLOCKED\w]" : "\dBlack & White [\rLEVEL 85 \d]");
  487.     formatex(szCandy, charsmax(szCandy),"%s", iLevel[id] >= 90 ? "\wCandy [\yUNLOCKED\w]" : "\dCandy [\rLEVEL 90 \d]");
  488.     formatex(szTactical, charsmax(szTactical),"%s", iLevel[id] > 96 ? "\wTactical Knife [\yUNLOCKED\w]" : "\dTactical Knife[\rLEVEL 96 \d]");
  489.     formatex(szSnake, charsmax(szSnake),"%s", iLevel[id] >= 103 ? "\wSnake Knife [\yUNLOCKED\w]" : "\dSnake Knife [\rLEVEL 103 \d]");
  490.     formatex(szSkulls, charsmax(szSkulls),"%s", iLevel[id] >= 110 ? "\wSkulls Knife [\yUNLOCKED\w]" : "\dSkulls Knife [\rLEVEL 110 \d]");
  491.     formatex(szCombat, charsmax(szCombat),"%s", iLevel[id] >= 115 ? "\wCombat Knife [\yUNLOCKED\w]" : "\dCombat Knife [\rLEVEL 115 \d]");
  492.     formatex(szHammer, charsmax(szHammer),"%s", iLevel[id] >= 125 ? "\wCombat Axe [\yUNLOCKED\w]" : "\dHammer [\rLEVEL 125 \d]");
  493.     formatex(szXhammer, charsmax(szXhammer),"%s", iLevel[id] >= 150 ? "\wXmas Hammer [\yWinter Edition\w]" : "\dXmas Hammer [\rLEVEL 150\d]");
  494.     formatex(szXaxe, charsmax(szXaxe),"%s", iLevel[id] >= 170 ? "\wXmas Axe [\yWinter Edition\w]" : "\dXmas Axe [\rLEVEL 170\d]");
  495.     formatex(szXcombat, charsmax(szXcombat),"%s", iLevel[id] >= 190 ? "\wXmas Combat [\yWinter Edition\w]" : "\dXmas Combat [\rLEVEL 190\d]");
  496.     formatex(szXsnowman, charsmax(szXsnowman),"%s", iLevel[id] >= 195 ? "\wXmas Snowman [\yWinter Edition\w]" : "\dXmas Snowman [\rLEVEL 195\d]");
  497.     formatex(szXkatanas, charsmax(szXkatanas),"%s", iLevel[id] >= 200 ? "\wXmas Katanas [\yWinter Edition\w]" : "\dXmas Katanas [\rLEVEL 200\d]");
  498.    
  499.    
  500.     new menu = menu_create( szItem, "KnifeSkinsMenu_Handler" );
  501.     menu_additem(menu, "\wObican Knife [\yUNLOCKED\w]", "", 0 );
  502.     menu_additem(menu, szAlien, "", iLevel[id] >= 1 ? 0 : 1);
  503.     menu_additem(menu, szDagger, "", iLevel[id] >= 5 ? 0 : 1);
  504.     menu_additem(menu, szDark, "", iLevel[id] >= 10 ? 0 : 1);
  505.     menu_additem(menu, szTransparent, "", iLevel[id] >= 12 ? 0 : 1);
  506.     menu_additem(menu, szKatara, "", iLevel[id] >= 15 ? 0 : 1);
  507.     menu_additem(menu, szSpecial, "", iLevel[id] >= 20 ? 0 : 1);
  508.     menu_additem(menu, szIce, "", iLevel[id] >= 23 ? 0 : 1);
  509.     menu_additem(menu, szGold, "", iLevel[id] >= 27 ? 0 : 1);
  510.     menu_additem(menu, szKatana, "", iLevel[id] >= 27 ? 0 : 1);
  511.     menu_additem(menu, szDaedric, "", iLevel[id] >= 40 ? 0 : 1);
  512.     menu_additem(menu, szStarwars, "", iLevel[id] >= 43 ? 0 : 1);
  513.     menu_additem(menu, szWolverine, "", iLevel[id] >= 45 ? 0 : 1);
  514.     menu_additem(menu, szBlaze, "", iLevel[id] >= 50 ? 0 : 1);
  515.     menu_additem(menu, szArtic, "", iLevel[id] >= 55 ? 0 : 1);
  516.     menu_additem(menu, szTracker, "", iLevel[id] >= 60 ? 0 : 1);
  517.     menu_additem(menu, szFlip, "", iLevel[id] >= 65 ? 0 : 1);
  518.     menu_additem(menu, szGolden, "", iLevel[id] >= 70 ? 0 : 1);
  519.     menu_additem(menu, szSaber, "", iLevel[id] >= 73 ? 0 : 1);
  520.     menu_additem(menu, szGuitar, "", iLevel[id] >= 80 ? 0 : 1);
  521.     menu_additem(menu, szBlack, "", iLevel[id] >= 85 ? 0 : 1);
  522.     menu_additem(menu, szCandy, "", iLevel[id] >= 90 ? 0 : 1);
  523.     menu_additem(menu, szTactical, "", iLevel[id] >= 96 ? 0 : 1);
  524.     menu_additem(menu, szSnake, "", iLevel[id] >= 103 ? 0 : 1);
  525.     menu_additem(menu, szSkulls, "", iLevel[id] >= 110 ? 0 : 1);
  526.     menu_additem(menu, szCombat, "", iLevel[id] >= 115 ? 0 : 1);
  527.     menu_additem(menu, szHammer, "", iLevel[id] >= 125 ? 0 : 1);
  528.     menu_additem(menu, szXhammer, "", iLevel[id] >= 150 ? 0 : 1);
  529.     menu_additem(menu, szXaxe, "", iLevel[id] >= 170 ? 0 : 1);
  530.     menu_additem(menu, szXcombat, "", iLevel[id] >= 190 ? 0 : 1);
  531.     menu_additem(menu, szXsnowman, "", iLevel[id] >= 195 ? 0 : 1);
  532.     menu_additem(menu, szXkatanas, "", iLevel[id] >= 200 ? 0 : 1);
  533.     menu_setprop(menu, MPROP_EXIT, MEXIT_ALL );
  534.     menu_display(id, menu, 0 );
  535.  
  536.     return PLUGIN_HANDLED;
  537.     }
  538.  
  539.  
  540.    
  541.     public KnifeSkinsMenu_Handler(id, menu, item)
  542. {
  543.     if(item == MENU_EXIT)
  544.     {
  545.         menu_destroy(menu)
  546.         return PLUGIN_HANDLED
  547.     }
  548.    
  549.     SetKnife(id, item);
  550.     ColorChat(id, "Noz koji si izabrao je: ^4%s^1.", g_KnifeNames[item]);
  551.    
  552.     SaveData(id);
  553.     return PLUGIN_HANDLED;
  554. }
  555.  
  556. public VIPMenu(id) {
  557.  
  558.     if( !( get_user_flags(id) & ADMIN_LEVEL_H ) )
  559.     {
  560.         ColorChat(id, "Niste VIP!");
  561.         return PLUGIN_HANDLED;
  562.     }
  563.    
  564.     new szItem[256], szVduals[50], szVbutterfly[50], szVtheif[50], szVeclipse[50], szVkatanas[50],
  565.     szVfish[50];
  566.    
  567.     new level = iLevel[id] > 0 ? iLevel[id] : 1;
  568.    
  569.     new xp = level * StartedLevel;
  570.    
  571.     if( iLevel[id] > 0 )
  572.     {
  573.         xp +=  ( xp * 4 / 2 );
  574.     }
  575.    
  576.     formatex(szItem, charsmax(szItem), "\w[ \r%s \w] \yVIP Knives Menu \rv%s^n\yTvoj Level: \r%d \w- \yTvoj XP: \r%d\w/\r%d\w.^n\yPage:\r", g_VAULTNAME, VERSION,iLevel[id],iXp[id], xp);
  577.     formatex(szVduals, charsmax(szVduals),"%s", iLevel[id] >= 2 ? "\wVIP Duals [\yVIP\w]" : "\dVIP Duals [\rVIP\d]");
  578.     formatex(szVbutterfly, charsmax(szVbutterfly),"%s", iLevel[id] >= 2 ? "\wVIP Butterfly [\yVIP\w]" : "\dVIP Butterfly [\rVIP\d]");  
  579.     formatex(szVtheif, charsmax(szVtheif),"%s", iLevel[id] >= 1 ? "\wVIP Theif [\yVIP\w]" : "\dVIP Theif [\rVIP\d]");
  580.     formatex(szVeclipse, charsmax(szVeclipse),"%s", iLevel[id] >= 2 ? "\wVIP UnqE# [\yVIP\w]" : "\dVIP UnqE# [\rVIP\d]");
  581.     formatex(szVkatanas, charsmax(szVkatanas),"%s", iLevel[id] >= 2 ? "\wVIP Katanas [\yVIP\w]" : "\dVIP Katanas [\rVIP\d]");
  582.     formatex(szVfish, charsmax(szVfish),"%s", iLevel[id] >= 2 ? "\wVIP Fish [\yVIP\w]" : "\dVIP Fish [\rVIP\d]");
  583.    
  584.  
  585.    
  586.     new Vmenu = menu_create( szItem, "VIPMenu_Handler" );
  587.     menu_additem(Vmenu, szVduals, "", iLevel[id] >= 2 ? 0 : 1);
  588.     menu_additem(Vmenu, szVbutterfly, "", iLevel[id] >= 2 ? 0 : 1);
  589.     menu_additem(Vmenu, szVtheif, "", iLevel[id] >= 2 ? 0 : 1);
  590.     menu_additem(Vmenu, szVeclipse, "", iLevel[id] >= 2 ? 0 : 1);
  591.     menu_additem(Vmenu, szVkatanas, "", iLevel[id] >= 2 ? 0 : 1);
  592.     menu_additem(Vmenu, szVfish, "", iLevel[id] >= 2 ? 0 : 1);
  593.     menu_setprop(Vmenu, MPROP_EXIT, MEXIT_ALL );
  594.     menu_display(id, Vmenu, 0 );
  595.  
  596.     return PLUGIN_CONTINUE;
  597.     }
  598.  
  599. public VIPMenu_Handler(id, Vmenu, Vitem)
  600. {
  601.     if(Vitem == MENU_EXIT)
  602.     {
  603.         menu_destroy(Vmenu)
  604.         return PLUGIN_HANDLED
  605.     }
  606.    
  607.     VSetKnife(id, Vitem);
  608.     ColorChat(id, "VIP Noz koji si izabrao je: ^4%s^1.", g_VKnifeNames[Vitem]);
  609.    
  610.     VSaveData(id);
  611.     return PLUGIN_HANDLED;
  612. }
  613.  
  614. public VSetKnife(id, Vitem) {
  615.    
  616.     vknife_model[id] = Vitem
  617.    
  618.     new Clip, Ammo, Weapon = get_user_weapon(id, Clip, Ammo)  
  619.     if ( Weapon != CSW_KNIFE )
  620.         return PLUGIN_HANDLED
  621.    
  622.     new vModel[56],pModel[56]
  623.    
  624.     if (get_pcvar_num(knife_on) == 0)
  625.     {
  626.         format(vModel,55,"models/v_knife.mdl")
  627.         return PLUGIN_HANDLED;
  628.     }
  629.    
  630.     format(vModel,55, g_KnifevVIP[Vitem])
  631.     format(pModel,55,"models/p_knife.mdl")
  632.     entity_set_string(id, EV_SZ_viewmodel, vModel)
  633.     entity_set_string(id, EV_SZ_weaponmodel, pModel)
  634.    
  635.     return PLUGIN_HANDLED;  
  636. }
  637.  
  638. public SetKnife(id, item) {
  639.    
  640.     knife_model[id] = item
  641.    
  642.     new Clip, Ammo, Weapon = get_user_weapon(id, Clip, Ammo)  
  643.     if ( Weapon != CSW_KNIFE )
  644.         return PLUGIN_HANDLED
  645.    
  646.     new vModel[56],pModel[56]
  647.    
  648.     if (get_pcvar_num(knife_on) == 0)
  649.     {
  650.         format(vModel,55,"models/v_knife.mdl")
  651.         return PLUGIN_HANDLED;
  652.     }
  653.    
  654.     format(vModel,55, g_KnifevModels[item])
  655.     format(pModel,55,"models/p_knife.mdl")
  656.     entity_set_string(id, EV_SZ_viewmodel, vModel)
  657.     entity_set_string(id, EV_SZ_weaponmodel, pModel)
  658.    
  659.     return PLUGIN_HANDLED;  
  660. }
  661.  
  662. public PlayerLevelsMenu(id)
  663. {  
  664.     if (get_pcvar_num(knife_on) == 0)
  665.     {
  666.         ColorChat(id, "Mod je ugasen.");
  667.         return PLUGIN_HANDLED;
  668.     }
  669.    
  670.     new some[256], menu;
  671.    
  672.     static players[32],szTemp[10],pnum;
  673.     get_players(players,pnum,"ch");
  674.    
  675.     formatex(some,255,"\w[ \r%s \w] \yLeveli igraca:\r", g_VAULTNAME);
  676.    
  677.     menu = menu_create(some,"PlayerLevelsMenu_Handler");
  678.    
  679.     for (new i; i < pnum; i++)
  680.     {
  681.         new level = iLevel[players[i]] > 0 ? iLevel[players[i]] : 1;
  682.        
  683.         new xp = level * StartedLevel;
  684.        
  685.         if( iLevel[players[i]] > 0 )
  686.         {
  687.             xp +=  ( xp * 4 / 2 );
  688.         }
  689.        
  690.         formatex(some,256,"%s \y(Level: \r%i\y) \w- \y(XP: \r%i\w/\r%i\y)",get_player_name(players[i]), iLevel[players[i]], iXp[players[i]], xp);
  691.         num_to_str(players[i],szTemp,charsmax(szTemp));
  692.         menu_additem(menu, some, szTemp);
  693.     }
  694.    
  695.     menu_setprop(menu, MPROP_EXIT, MEXIT_ALL );
  696.     menu_display(id, menu);
  697.    
  698.     return PLUGIN_HANDLED;
  699. }
  700.  
  701. public PlayerLevelsMenu_Handler(id,menu, item){
  702.     if (item == MENU_EXIT)
  703.     {
  704.         menu_destroy(menu);
  705.         return;
  706.     }
  707.    
  708.     new data[6] ,szName[64],access,callback;
  709.    
  710.     menu_item_getinfo(menu, item, access, data, charsmax(data), szName, charsmax(szName), callback);
  711.    
  712.     new player = str_to_num(data);
  713.    
  714.     new level = iLevel[player] > 0 ? iLevel[player] : 1;
  715.    
  716.     new xp = level * StartedLevel;
  717.    
  718.     if( iLevel[player] > 0 )
  719.     {
  720.         xp +=  ( xp * 4 / 2 );
  721.     }
  722.    
  723.     ColorChat(id,"^3%sov ^4LEVEL ^1je: ^3%i ^1sa ^3%i^1/^3%i ^4XP^1.",get_player_name(player), iLevel[player], iXp[player], xp);
  724.     PlayerLevelsMenu(id);
  725. }
  726.  
  727. public CurWeapon(id)
  728. {
  729.     // Set Knife Model
  730.     SetKnife(id, knife_model[id])
  731. }
  732.  
  733. public givexp(id) {
  734.     if (get_pcvar_num(knife_on) == 0)
  735.     {
  736.         ColorChat(id, "Mod je ugasen.");
  737.         return PLUGIN_HANDLED;
  738.     }
  739.    
  740.     if( get_user_flags( id ) & ADMIN_CFG ) {
  741.        
  742.         new PlayerToGive[32], XP[32]
  743.         read_argv(1,PlayerToGive,31)
  744.         read_argv(2,XP, 31)
  745.         new Player = cmd_target(id,PlayerToGive,9)
  746.        
  747.         if(!Player) {
  748.            
  749.             return PLUGIN_HANDLED
  750.            
  751.         }
  752.        
  753.         new XPtoGive = str_to_num(XP)
  754.         new name[32],owner[32]
  755.         get_user_name(id,owner,31)
  756.         get_user_name(Player,name,31)
  757.         ColorChat(0,"^4ADMIN^3 %s^1 je dao ^4 %s^3 %s^1 XP.", owner,name,XP );
  758.         iXp[Player]+= XPtoGive
  759.         CheckLevel(Player);
  760.         SaveData(id)
  761.        
  762.     }
  763.    
  764.     else {
  765.        
  766.         client_print(id,print_console,"You have no acces to that command")
  767.        
  768.         return PLUGIN_HANDLED
  769.     }
  770.    
  771.     return PLUGIN_HANDLED;
  772. }
  773.  
  774. public takexp(id) {
  775.     if (get_pcvar_num(knife_on) == 0)
  776.     {
  777.         ColorChat(id, "Mod je ugasen.");
  778.         return PLUGIN_HANDLED;
  779.     }
  780.    
  781.     if(get_user_flags(id) & ADMIN_CFG ) {
  782.        
  783.        
  784.         new PlayerToTake[32], XP[32]
  785.         read_argv(1,PlayerToTake,31 )
  786.         read_argv(2,XP,31 )
  787.         new Player = cmd_target(id,PlayerToTake,9)
  788.        
  789.         if(!Player) {
  790.            
  791.             return PLUGIN_HANDLED
  792.            
  793.         }
  794.        
  795.         new XPtoTake = str_to_num(XP)
  796.         new name[32],owner[32]
  797.         get_user_name(id,owner,31)
  798.         get_user_name(Player,name,31)
  799.         ColorChat(0,"^4ADMIN^3 %s^1 je uzeo^4 %s^3 %s^1 XP.", owner,name,XP );
  800.         iXp[ Player ]-=XPtoTake
  801.         CheckLevel(Player);
  802.         SaveData(id)
  803.        
  804.     }
  805.    
  806.     else {
  807.        
  808.         client_print(id,print_console,"You have no acces to that command.")
  809.        
  810.         return PLUGIN_HANDLED
  811.        
  812.     }
  813.    
  814.     return PLUGIN_HANDLED;
  815. }
  816.  
  817. public givelevel(id) {
  818.     if (get_pcvar_num(knife_on) == 0)
  819.     {
  820.         ColorChat(id, "Mod je ugasen.");
  821.         return PLUGIN_HANDLED;
  822.     }
  823.    
  824.     if( get_user_flags( id ) & ADMIN_CFG ) {
  825.        
  826.         new PlayerToGive[32], LEVEL[32]
  827.         read_argv(1,PlayerToGive,31)
  828.         read_argv(2,LEVEL, 31)
  829.         new Player = cmd_target(id,PlayerToGive,9)
  830.        
  831.         if(!Player) {
  832.            
  833.             return PLUGIN_HANDLED
  834.            
  835.         }
  836.        
  837.         new LEVELtoGive = str_to_num(LEVEL)
  838.         new name[32],owner[32]
  839.         get_user_name(id,owner,31)
  840.         get_user_name(Player,name,31)
  841.         ColorChat(0,"^4ADMIN^3 %s^1 je stavio ^4 %s^3 %s^1 Level.", owner,name,LEVEL );
  842.         iLevel[Player]= LEVELtoGive
  843.         CheckLevel(Player);
  844.         SaveData(id)
  845.        
  846.     }
  847.    
  848.     else {
  849.        
  850.         client_print(id,print_console,"You have no acces to that command")
  851.        
  852.         return PLUGIN_HANDLED
  853.     }
  854.    
  855.     return PLUGIN_HANDLED;
  856. }
  857.  
  858. public client_disconnect(id) {  
  859.    
  860.     if(task_exists(id)){
  861.         remove_task(id)
  862.     }
  863.     SaveData(id);
  864. }  
  865.  
  866.  
  867. //public Knifemessage(id) {
  868. // 
  869. //  if (get_pcvar_num(knife_on) == 0)
  870. //      return PLUGIN_HANDLED;
  871. // 
  872. //  ColorChat(0, "Type ^3/knife ^1in chat to open the ^4Knife Skins Menu^1.");
  873. //  ColorChat(0, "This server is running ^4%s ^3v%s^1 by ^4%s^1.",g_VAULTNAME, VERSION, AUTHOR)
  874. //  return PLUGIN_HANDLED;
  875. //}  
  876. //
  877. //public Levelmessage(id) {
  878. // 
  879. //  if (get_pcvar_num(knife_on) == 0)
  880. //      return PLUGIN_HANDLED;
  881. // 
  882. //  ColorChat(0,"To see other ^4Players Level ^1type ^3/level ^1in chat.");
  883. //  return PLUGIN_HANDLED;
  884. //}
  885. //
  886. public client_putinserver(id) LoadData(id);
  887.  
  888.  
  889.  
  890. public VSaveData(id){
  891.    
  892.     new authid[32]
  893.     get_user_authid(id, authid, 31)
  894.    
  895.     new vaultkey[64]
  896.     new vaultdata[64]
  897.    
  898.     format(vaultkey, 63, "KNIFEMOD_%s", authid)
  899.     format(vaultdata, 63, "%d", vknife_model[id])
  900.     set_vaultdata(vaultkey, vaultdata)
  901.    
  902.     new data[ 16 ];
  903.    
  904.     get_user_authid( id, authid, sizeof( authid ) - 1 );
  905.    
  906.     formatex( data, sizeof( data ) - 1, "%d %d", iLevel[id], iXp[id] );
  907.    
  908.     fvault_set_data(g_VAULTNAME, authid, data );
  909.    
  910.     return;
  911.    
  912.    
  913. }
  914.  
  915. public SaveData(id){
  916.    
  917.     new authid[32]
  918.     get_user_authid(id, authid, 31)
  919.    
  920.     new vaultkey[64]
  921.     new vaultdata[64]
  922.    
  923.     format(vaultkey, 63, "KNIFEMOD_%s", authid)
  924.     format(vaultdata, 63, "%d", knife_model[id])
  925.     set_vaultdata(vaultkey, vaultdata)
  926.    
  927.     new data[ 16 ];
  928.    
  929.     get_user_authid( id, authid, sizeof( authid ) - 1 );
  930.    
  931.     formatex( data, sizeof( data ) - 1, "%d %d", iLevel[id], iXp[id] );
  932.    
  933.     fvault_set_data(g_VAULTNAME, authid, data );
  934.    
  935.     return;
  936.    
  937.    
  938. }
  939.  
  940. public VLoadData(id){
  941.    
  942.     new authid[32]  
  943.     get_user_authid(id,authid,31)
  944.    
  945.     new vaultkey[64], vaultdata[64]
  946.    
  947.     format(vaultkey, 63, "KNIFEMOD_%s", authid)
  948.     get_vaultdata(vaultkey, vaultdata, 63)
  949.     vknife_model[id] = str_to_num(vaultdata)
  950.    
  951.     new data[ 16 ], szLevel[ 8 ], szXp[ 8 ];
  952.    
  953.     get_user_authid( id, authid, sizeof( authid ) - 1 );
  954.    
  955.     if( fvault_get_data(g_VAULTNAME, authid, data, sizeof( data ) - 1 ) )
  956.     {
  957.         strbreak( data, szLevel, sizeof( szLevel ) - 1, szXp, sizeof( szXp ) - 1 );
  958.        
  959.         iLevel[id] = str_to_num( szLevel );
  960.         iXp[id] = str_to_num( szXp );
  961.        
  962.         return;
  963.     }
  964.     else
  965.     {
  966.         iLevel[id] = 0;
  967.         iXp[id] = 0;
  968.        
  969.         return;
  970.     }
  971. }
  972.  
  973. public LoadData(id){
  974.    
  975.     new authid[32]  
  976.     get_user_authid(id,authid,31)
  977.    
  978.     new vaultkey[64], vaultdata[64]
  979.    
  980.     format(vaultkey, 63, "KNIFEMOD_%s", authid)
  981.     get_vaultdata(vaultkey, vaultdata, 63)
  982.     knife_model[id] = str_to_num(vaultdata)
  983.    
  984.     new data[ 16 ], szLevel[ 8 ], szXp[ 8 ];
  985.    
  986.     get_user_authid( id, authid, sizeof( authid ) - 1 );
  987.    
  988.     if( fvault_get_data(g_VAULTNAME, authid, data, sizeof( data ) - 1 ) )
  989.     {
  990.         strbreak( data, szLevel, sizeof( szLevel ) - 1, szXp, sizeof( szXp ) - 1 );
  991.        
  992.         iLevel[id] = str_to_num( szLevel );
  993.         iXp[id] = str_to_num( szXp );
  994.        
  995.         return;
  996.     }
  997.     else
  998.     {
  999.         iLevel[id] = 0;
  1000.         iXp[id] = 0;
  1001.        
  1002.         return;
  1003.     }
  1004. }
  1005.  
  1006. stock get_player_name(id){
  1007.     static szName[32];
  1008.     get_user_name(id,szName,31);
  1009.     return szName;
  1010. }
  1011.  
  1012. stock ColorChat( const id, const string[ ], { Float, Sql, Resul, _ } : ... )
  1013. {
  1014. new msg[ 191 ], players[ 32 ], count = 1;
  1015.  
  1016. static len;
  1017. len = formatex( msg, charsmax( msg ), "^x04[^x01 UnqE# Knife^x04 ]^x01 " );
  1018. vformat( msg[ len ], charsmax( msg ) - len, string, 3 );
  1019.  
  1020. if( id )
  1021.     players[ 0 ] = id;
  1022.     else
  1023.         get_players( players,count,"ch" );
  1024.    
  1025.     for( new i = 0; i < count; i++ )
  1026.     {
  1027.         if( is_user_connected( players[i] ) )
  1028.         {
  1029.             message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _ , players[ i ] );
  1030.             write_byte( players[ i ] );
  1031.             write_string( msg );
  1032.             message_end( );
  1033.         }
  1034.     }
  1035. }
RAW Paste Data
Top