Advertisement
CheezPuff

[Free] Jailbreak Knives Shop Abilities [v1.0] #גדוד501

Jul 12th, 2024 (edited)
523
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 19.37 KB | None | 0 0
  1. /* i will update everyday the code ofc i dont have server to test it but i will build every thing without any error so make sure if you test it leave me message, Discord: CheezPuff#7720 or Steam: CheezPuff (Ariel)*/
  2.  
  3. #include <amxmodx>
  4. #include <amxmisc>
  5. #include <cstrike>
  6. #include <fun>
  7. #include <hamsandwich>
  8. #include <fakemeta>
  9. #include <nvault>
  10.  
  11. #define MAX_PLAYERS 32
  12. #define PREVIEW_TIME 5.0 // זמן הצפייה בסכין בשניות
  13.  
  14. enum _:eKnife {
  15.     KNIFE_MODEL[64],
  16.     KNIFE_NAME[32],
  17.     KNIFE_PRICE,
  18.     KNIFE_LEVEL_REQ,
  19.     Float:KNIFE_CASH_BONUS,
  20.     Float:KNIFE_SLAG_AMOUNT,
  21.     KNIFE_HEALTH_BONUS,
  22.     KNIFE_ARMOR_BONUS,
  23.     KNIFE_DAMAGE_BONUS
  24. }
  25.  
  26. new const g_Knives[][eKnife] = {
  27.     // מודל הסכין, שם הסכין, מחיר, דרישת רמה, בונוס מזומנים, כמות סלאג, בונוס בריאות, בונוס שריון, בונוס נזק
  28. // Model location, name Knife, price, req level, bonus cash, bonus slag, bonus health, bonus armor, bonus damage
  29.     {"models/v_knife.mdl", "Normal Boxer", 0, 0, 0.0, 0.0, 0, 0, 0},
  30.     {"models/knives/v_knife1.mdl", "Special Knife 1", 25000, 5, 0.1, 0.05, 5, 5, 5},
  31.     {"models/knives/v_knife2.mdl", "Special Knife 2", 50000, 10, 0.2, 0.10, 10, 10, 10},
  32.     {"models/knives/v_knife3.mdl", "Special Knife 3", 100000, 15, 0.3, 0.15, 15, 15, 15},
  33.     {"models/knives/v_knife4.mdl", "Epic Knife", 200000, 20, 0.4, 0.20, 20, 20, 20},
  34.     {"models/knives/v_knife5.mdl", "Legendary Knife", 500000, 30, 0.5, 0.25, 30, 30, 30}
  35. };
  36.  
  37. new g_iPlayerCash[MAX_PLAYERS + 1];
  38. new g_iPlayerLevel[MAX_PLAYERS + 1];
  39. new g_iPlayerXP[MAX_PLAYERS + 1];
  40. new g_iPlayerEquippedKnife[MAX_PLAYERS + 1];
  41. new g_szPlayerOwnedKnives[MAX_PLAYERS + 1][256];
  42. new g_iPlayerPreviewingKnife[MAX_PLAYERS + 1];
  43. new g_iPlayerDamageBonus[MAX_PLAYERS + 1];
  44.  
  45. new g_vault;
  46.  
  47. public plugin_precache() {
  48.     for (new i = 0; i < sizeof g_Knives; i++) {
  49.         precache_model(g_Knives[i][KNIFE_MODEL]);
  50.     }
  51. }
  52.  
  53. public plugin_init() {
  54.     register_plugin("Jailbreak Knives Shop 29/07/2024", "1.0", "CheezPuff - Ariel");
  55.     register_clcmd("say /knife", "CmdKnifeShop");
  56.     register_clcmd("say_team /knife", "CmdKnifeShop");
  57.    
  58.     register_event("DeathMsg", "event_player_kill", "a");
  59.     register_event("HLTV", "event_round_start", "a", "1=0", "2=0");
  60.    
  61.     RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage");
  62.     register_forward(FM_PlayerPostThink, "fw_PlayerPostThink");
  63.    
  64.     g_vault = nvault_open("knife_shop_vault");
  65. }
  66.  
  67. public plugin_end() {
  68.     nvault_close(g_vault);
  69. }
  70.  
  71. public plugin_natives() {
  72.     register_native("get_player_knife_cash", "native_get_player_knife_cash");
  73.     register_native("set_player_knife_cash", "native_set_player_knife_cash");
  74.     register_native("get_player_knife_level", "native_get_player_knife_level");
  75.     register_native("set_player_knife_level", "native_set_player_knife_level");
  76. }
  77.  
  78. public fw_PlayerPostThink(id) {
  79.     if (!is_user_alive(id)) return FMRES_IGNORED;
  80.    
  81.     new knife = get_user_weapon(id) == CSW_KNIFE ? 1 : 0;
  82.     if (knife) {
  83.         new knife_id = g_iPlayerPreviewingKnife[id] != -1 ? g_iPlayerPreviewingKnife[id] : g_iPlayerEquippedKnife[id];
  84.         set_pev(id, pev_viewmodel2, g_Knives[knife_id][KNIFE_MODEL]);
  85.     }
  86.    
  87.     return FMRES_IGNORED;
  88. }
  89.  
  90. public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type) {
  91.     if (!is_user_connected(attacker) || get_user_weapon(attacker) != CSW_KNIFE) {
  92.         return HAM_IGNORED;
  93.     }
  94.    
  95.     new knife_id = g_iPlayerEquippedKnife[attacker];
  96.     new Float:new_damage = damage + float(g_Knives[knife_id][KNIFE_DAMAGE_BONUS]);
  97.     SetHamParamFloat(4, new_damage);
  98.    
  99.     return HAM_HANDLED;
  100. }
  101.  
  102. public event_round_start() {
  103.     for (new id = 1; id <= MAX_PLAYERS; id++) {
  104.         if (is_user_connected(id) && is_user_alive(id)) {
  105.             apply_knife_abilities(id);
  106.         }
  107.     }
  108. }
  109.  
  110. public apply_knife_abilities(id) {
  111.     new knife_id = g_iPlayerEquippedKnife[id];
  112.    
  113.     // health bonus
  114.     new health = get_user_health(id);
  115.     set_user_health(id, health + g_Knives[knife_id][KNIFE_HEALTH_BONUS]);
  116.    
  117.     // armor bonus
  118.     new armor = get_user_armor(id);
  119.     set_user_armor(id, armor + g_Knives[knife_id][KNIFE_ARMOR_BONUS]);
  120.    
  121.     // damage bonus for later use
  122.     g_iPlayerDamageBonus[id] = g_Knives[knife_id][KNIFE_DAMAGE_BONUS];
  123.    
  124.     // slag amount
  125.     set_user_gravity(id, 1.0 - g_Knives[knife_id][KNIFE_SLAG_AMOUNT]);
  126. }
  127.  
  128. public CmdKnifeShop(id) {
  129.     show_main_menu(id);
  130.     return PLUGIN_HANDLED;
  131. }
  132.  
  133. public show_main_menu(id) {
  134.     new menu_title[128];
  135.     formatex(menu_title, charsmax(menu_title), "\r[JailBreak] \wKnives Shop^n\wCash: $%d | Top Knife: %s | Current: %s",
  136.         g_iPlayerCash[id],
  137.         g_Knives[get_player_top_knife(id)][KNIFE_NAME],
  138.         g_Knives[g_iPlayerEquippedKnife[id]][KNIFE_NAME]);
  139.    
  140.     new menu = menu_create(menu_title, "main_menu_handler");
  141.    
  142.     menu_additem(menu, "View Knives");
  143.     menu_additem(menu, "My Inventory");
  144.     menu_additem(menu, "Shop Information");
  145.     menu_additem(menu, "צפה בסכין"); // Hebrew option for "View Knife"
  146.    
  147.     menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
  148.     menu_display(id, menu, 0);
  149. }
  150.  
  151. public main_menu_handler(id, menu, item) {
  152.     if (item == MENU_EXIT) {
  153.         menu_destroy(menu);
  154.         return PLUGIN_HANDLED;
  155.     }
  156.    
  157.     switch (item) {
  158.         case 0: show_knives_list(id, 0);
  159.         case 1: show_inventory(id);
  160.         case 2: show_shop_info(id);
  161.         case 3: show_preview_menu(id);
  162.     }
  163.    
  164.     menu_destroy(menu);
  165.     return PLUGIN_HANDLED;
  166. }
  167.  
  168. public show_preview_menu(id) {
  169.     new menu = menu_create("[JailBreak] \wviewing Knive", "preview_menu_handler");
  170.    
  171.     for (new i = 0; i < sizeof g_Knives; i++) {
  172.         new item_text[64], item_info[8];
  173.         formatex(item_text, charsmax(item_text), "%s", g_Knives[i][KNIFE_NAME]);
  174.         formatex(item_info, charsmax(item_info), "%d", i);
  175.         menu_additem(menu, item_text, item_info);
  176.     }
  177.    
  178.     menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
  179.     menu_display(id, menu, 0);
  180. }
  181.  
  182. public preview_menu_handler(id, menu, item) {
  183.     if (item == MENU_EXIT) {
  184.         menu_destroy(menu);
  185.         show_main_menu(id);
  186.         return PLUGIN_HANDLED;
  187.     }
  188.    
  189.     new item_info[8], item_name[64], access, callback;
  190.     menu_item_getinfo(menu, item, access, item_info, charsmax(item_info), item_name, charsmax(item_name), callback);
  191.    
  192.     new knife_id = str_to_num(item_info);
  193.     preview_knife(id, knife_id);
  194.    
  195.     menu_destroy(menu);
  196.     return PLUGIN_HANDLED;
  197. }
  198.  
  199. public preview_knife(id, knife_id) {
  200.     g_iPlayerPreviewingKnife[id] = knife_id;
  201.    
  202.     client_print(id, print_chat, "Previewing %s for %.0f seconds", g_Knives[knife_id][KNIFE_NAME], PREVIEW_TIME);
  203.    
  204.     set_task(PREVIEW_TIME, "end_preview", id);
  205. }
  206.  
  207. public end_preview(id) {
  208.     g_iPlayerPreviewingKnife[id] = -1;
  209.    
  210.     client_print(id, print_chat, "Preview ended. Returned to your equipped knife.");
  211. }
  212.  
  213. public show_knives_list(id, page) {
  214.     new total_pages = (sizeof g_Knives - 1) / 7 + 1;
  215.     new menu_title[64];
  216.     formatex(menu_title, charsmax(menu_title), "Knives List - Page %d/%d", page + 1, total_pages);
  217.     new menu = menu_create(menu_title, "knives_list_handler");
  218.    
  219.     new start = page * 7;
  220.     new end = min(start + 7, sizeof g_Knives);
  221.    
  222.     for (new i = start; i < end; i++) {
  223.         new item_text[64], item_info[8];
  224.         formatex(item_text, charsmax(item_text), "%s | $%d | Lvl %d %s",
  225.             g_Knives[i][KNIFE_NAME], g_Knives[i][KNIFE_PRICE], g_Knives[i][KNIFE_LEVEL_REQ],
  226.             is_knife_owned(id, i) ? "| Owned" : "");
  227.         formatex(item_info, charsmax(item_info), "%d", i);
  228.         menu_additem(menu, item_text, item_info);
  229.     }
  230.    
  231.     if (page > 0) menu_additem(menu, "Previous Page", "prev");
  232.     if (end < sizeof g_Knives) menu_additem(menu, "Next Page", "next");
  233.    
  234.     menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
  235.     menu_display(id, menu, 0);
  236. }
  237.  
  238. public knives_list_handler(id, menu, item) {
  239.     if (item == MENU_EXIT) {
  240.         menu_destroy(menu);
  241.         show_main_menu(id);
  242.         return PLUGIN_HANDLED;
  243.     }
  244.    
  245.     new item_info[8], item_name[64], access, callback;
  246.     menu_item_getinfo(menu, item, access, item_info, charsmax(item_info), item_name, charsmax(item_name), callback);
  247.    
  248.     if (equal(item_info, "prev")) {
  249.         new page = (item - 1) / 7;
  250.         show_knives_list(id, page - 1);
  251.     } else if (equal(item_info, "next")) {
  252.         new page = (item - 1) / 7;
  253.         show_knives_list(id, page + 1);
  254.     } else {
  255.         new knife_id = str_to_num(item_info);
  256.         show_knife_details(id, knife_id);
  257.     }
  258.    
  259.     menu_destroy(menu);
  260.     return PLUGIN_HANDLED;
  261. }
  262.  
  263. public show_knife_details(id, knife_id) {
  264.     new menu_title[64];
  265.     formatex(menu_title, charsmax(menu_title), "%s Details", g_Knives[knife_id][KNIFE_NAME]);
  266.     new menu = menu_create(menu_title, "knife_details_handler");
  267.    
  268.     new item_text[256];
  269.     formatex(item_text, charsmax(item_text), "\wLevel Requirement: \y%d %s^n\
  270.        \wCost: \y$%d^n\
  271.        \wCash Bonus: \y%.1f%%",
  272.         g_Knives[knife_id][KNIFE_LEVEL_REQ], (g_iPlayerLevel[id] >= g_Knives[knife_id][KNIFE_LEVEL_REQ]) ? "(Reached)" : "",
  273.         g_Knives[knife_id][KNIFE_PRICE],
  274.         g_Knives[knife_id][KNIFE_CASH_BONUS] * 100.0);
  275.     menu_addtext(menu, item_text, 0);
  276.    
  277.     if (is_knife_owned(id, knife_id)) {
  278.         menu_additem(menu, "Use");
  279.     } else if (g_iPlayerLevel[id] >= g_Knives[knife_id][KNIFE_LEVEL_REQ]) {
  280.         menu_additem(menu, "Purchase Knife");
  281.     }
  282.    
  283.     menu_additem(menu, "View Knife Stats");
  284.     menu_additem(menu, "Back to Knives Menu");
  285.    
  286.     menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
  287.     menu_display(id, menu, 0);
  288. }
  289.  
  290. public knife_details_handler(id, menu, item) {
  291.     if (item == MENU_EXIT) {
  292.         menu_destroy(menu);
  293.         show_knives_list(id, 0);
  294.         return PLUGIN_HANDLED;
  295.     }
  296.    
  297.     new item_info[8], item_name[64], access, callback;
  298.     menu_item_getinfo(menu, item, access, item_info, charsmax(item_info), item_name, charsmax(item_name), callback);
  299.    
  300.     new knife_id = str_to_num(item_info);
  301.    
  302.     switch (item) {
  303.         case 0: {
  304.             // Use or Purchase logic
  305.             if (is_knife_owned(id, knife_id)) {
  306.                 g_iPlayerEquippedKnife[id] = knife_id;
  307.                 apply_knife_abilities(id);
  308.                 client_print(id, print_chat, "You have equipped %s!", g_Knives[knife_id][KNIFE_NAME]);
  309.             } else if (g_iPlayerCash[id] >= g_Knives[knife_id][KNIFE_PRICE]) {
  310.                 g_iPlayerCash[id] -= g_Knives[knife_id][KNIFE_PRICE];
  311.                 add_owned_knife(id, knife_id);
  312.                 client_print(id, print_chat, "You have purchased %s!", g_Knives[knife_id][KNIFE_NAME]);
  313.                 save_player_data(id);
  314.             } else {
  315.                 client_print(id, print_chat, "You don't have enough cash to purchase this knife.");
  316.             }
  317.         }
  318.         case 1: {
  319.             // View Knife Stats
  320.             show_knife_stats(id, knife_id);
  321.         }
  322.         case 2: {
  323.             show_knives_list(id, 0);
  324.         }
  325.     }
  326.    
  327.     menu_destroy(menu);
  328.     return PLUGIN_HANDLED;
  329. }
  330.  
  331. public show_knife_stats(id, knife_id) {
  332.     new stats_text[512];
  333.     formatex(stats_text, charsmax(stats_text),
  334.         "\r[Frag JailBreak] Knives Shop^n^n\
  335.        \yYou Are Using: \w%s^n\
  336.        \yYour Top Knife: \w%s^n^n\
  337.        \r%s \wStats:^n^n\
  338.        \y1. \wSlag Amount: \r+%.2f%%^n\
  339.        \y2. \wHealth Bonus: \rUp To %d^n\
  340.        \y3. \wArmor Bonus: \r+%d^n\
  341.        \y4. \wDamage Bonus: \r+%d^n\
  342.        \y5. \wCash Bonus: \r+%.1f%%^n\
  343.        \y6. \wThis Knife Costs: \r(%d Cash)^n^n\
  344.        \r0. \wBack",
  345.         g_Knives[g_iPlayerEquippedKnife[id]][KNIFE_NAME],
  346.         g_Knives[get_player_top_knife(id)][KNIFE_NAME],
  347.         g_Knives[knife_id][KNIFE_NAME],
  348.         g_Knives[knife_id][KNIFE_SLAG_AMOUNT] * 100.0,
  349.         g_Knives[knife_id][KNIFE_HEALTH_BONUS],
  350.         g_Knives[knife_id][KNIFE_ARMOR_BONUS],
  351.         g_Knives[knife_id][KNIFE_DAMAGE_BONUS],
  352.         g_Knives[knife_id][KNIFE_CASH_BONUS] * 100.0,
  353.         g_Knives[knife_id][KNIFE_PRICE]
  354.     );
  355.    
  356.     show_menu(id, MENU_KEY_0, stats_text, -1, "Knife Stats Menu");
  357. }
  358.  
  359. public knife_stats_menu_handler(id, key) {
  360.     if (key == 9) { // Back key
  361.         show_knife_details(id, g_iPlayerEquippedKnife[id]);
  362.     }
  363.     return PLUGIN_HANDLED;
  364. }
  365.  
  366. public show_inventory(id) {
  367.     new menu = menu_create("My Inventory", "inventory_menu_handler");
  368.    
  369.     for (new i = 0; i < sizeof g_Knives; i++) {
  370.         if (is_knife_owned(id, i)) {
  371.             new item_text[64], item_info[8];
  372.             formatex(item_text, charsmax(item_text), "%s %s",
  373.                 g_Knives[i][KNIFE_NAME],
  374.                 (i == g_iPlayerEquippedKnife[id]) ? "(Equipped)" : "");
  375.             formatex(item_info, charsmax(item_info), "%d", i);
  376.             menu_additem(menu, item_text, item_info);
  377.         }
  378.     }
  379.    
  380.     menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
  381.     menu_display(id, menu, 0);
  382. }
  383.  
  384. public inventory_menu_handler(id, menu, item) {
  385.     if (item == MENU_EXIT) {
  386.         menu_destroy(menu);
  387.         show_main_menu(id);
  388.         return PLUGIN_HANDLED;
  389.     }
  390.    
  391.     new item_info[8], item_name[64], access, callback;
  392.     menu_item_getinfo(menu, item, access, item_info, charsmax(item_info), item_name, charsmax(item_name), callback);
  393.    
  394.     new knife_id = str_to_num(item_info);
  395.     g_iPlayerEquippedKnife[id] = knife_id;
  396.     apply_knife_abilities(id);
  397.     client_print(id, print_chat, "You have equipped %s!", g_Knives[knife_id][KNIFE_NAME]);
  398.    
  399.     menu_destroy(menu);
  400.     show_inventory(id);
  401.     return PLUGIN_HANDLED;
  402. }
  403.  
  404. public show_shop_info(id) {
  405.     new info_text[512];
  406.     formatex(info_text, charsmax(info_text),
  407.         "\r[Frag JailBreak] Knives Shop Information^n\
  408.        ^n\
  409.        Welcome to the Knives Shop!^n\
  410.        ^n\
  411.        Here you can purchase and equip various knives.^n\
  412.        Each knife has unique stats and bonuses.^n\
  413.        ^n\
  414.        - Earn cash by killing enemies^n\
  415.        - Level up to unlock more powerful knives^n\
  416.        - Equipped knives give cash bonuses on kills^n\
  417.        ^n\
  418.        Use /knife command to open the shop anytime!");
  419.    
  420.     show_motd(id, info_text, "Shop Information");
  421. }
  422.  
  423. public get_player_top_knife(id) {
  424.     new top_knife = 0;
  425.     for (new i = 0; i < sizeof g_Knives; i++) {
  426.         if (is_knife_owned(id, i) && g_Knives[i][KNIFE_PRICE] > g_Knives[top_knife][KNIFE_PRICE]) {
  427.             top_knife = i;
  428.         }
  429.     }
  430.     return top_knife;
  431. }
  432.  
  433. public bool:is_knife_owned(id, knife_id) {
  434.     new owned_knives[256];
  435.     copy(owned_knives, charsmax(owned_knives), g_szPlayerOwnedKnives[id]);
  436.     new knife_name[32];
  437.     copy(knife_name, charsmax(knife_name), g_Knives[knife_id][KNIFE_NAME]);
  438.    
  439.     return (contain(owned_knives, knife_name) != -1);
  440. }
  441.  
  442. public add_owned_knife(id, knife_id) {
  443.     new owned_knives[256];
  444.     formatex(owned_knives, charsmax(owned_knives), "%s,%s", g_szPlayerOwnedKnives[id], g_Knives[knife_id][KNIFE_NAME]);
  445.     copy(g_szPlayerOwnedKnives[id], charsmax(g_szPlayerOwnedKnives[]), owned_knives);
  446. }
  447.  
  448. public load_player_data(id) {
  449.     new authid[32];
  450.     get_user_authid(id, authid, charsmax(authid));
  451.    
  452.     new data[512];
  453.     if (nvault_get(g_vault, authid, data, charsmax(data))) {
  454.         new key[32], value[96];
  455.        
  456.         while (strlen(data) > 0) {
  457.             strtok(data, key, charsmax(key), value, charsmax(value), ';');
  458.             trim(key); trim(value);
  459.            
  460.             if (equal(key, "cash")) g_iPlayerCash[id] = str_to_num(value);
  461.             else if (equal(key, "level")) g_iPlayerLevel[id] = str_to_num(value);
  462.             else if (equal(key, "xp")) g_iPlayerXP[id] = str_to_num(value);
  463.             else if (equal(key, "equipped_knife")) g_iPlayerEquippedKnife[id] = str_to_num(value);
  464.             else if (equal(key, "owned_knives")) copy(g_szPlayerOwnedKnives[id], charsmax(g_szPlayerOwnedKnives[]), value);
  465.         }
  466.     } else {
  467.         // Default values for new players
  468.         g_iPlayerCash[id] = 1000;
  469.         g_iPlayerLevel[id] = 1;
  470.         g_iPlayerXP[id] = 0;
  471.         g_iPlayerEquippedKnife[id] = 0;
  472.         formatex(g_szPlayerOwnedKnives[id], charsmax(g_szPlayerOwnedKnives[]), "Default Knife");
  473.     }
  474. }
  475.  
  476. public save_player_data(id) {
  477.     new authid[32];
  478.     get_user_authid(id, authid, charsmax(authid));
  479.    
  480.     new data[512];
  481.     formatex(data, charsmax(data), "cash=%d;level=%d;xp=%d;equipped_knife=%d;owned_knives=%s",
  482.         g_iPlayerCash[id], g_iPlayerLevel[id], g_iPlayerXP[id], g_iPlayerEquippedKnife[id], g_szPlayerOwnedKnives[id]);
  483.    
  484.     nvault_set(g_vault, authid, data);
  485. }
  486.  
  487. public client_putinserver(id) {
  488.     load_player_data(id);
  489.     g_iPlayerPreviewingKnife[id] = -1;
  490. }
  491.  
  492. public client_disconnected(id) {
  493.     save_player_data(id);
  494. }
  495.  
  496. public event_player_kill() {
  497.     new killer = read_data(1);
  498.     new victim = read_data(2);
  499.    
  500.     if (killer == victim || !is_user_connected(killer)) return;
  501.    
  502.     // Add cash and XP for kill
  503.     new xp_gain = is_user_alive(victim) ? 20 : 10; // More XP for killing guards
  504.     g_iPlayerCash[killer] += 100;
  505.     g_iPlayerXP[killer] += xp_gain;
  506.    
  507.     client_print(killer, print_chat, "You gained %d XP and $100 for the kill!", xp_gain);
  508.  
  509.     if (g_iPlayerXP[killer] >= g_iPlayerLevel[killer] * 100) {
  510.         g_iPlayerXP[killer] -= g_iPlayerLevel[killer] * 100;
  511.         g_iPlayerLevel[killer]++;
  512.        
  513.         // Announce level up to all players
  514.         new name[32];
  515.         get_user_name(killer, name, charsmax(name));
  516.         client_print(0, print_chat, "%s has leveled up to level %d!", name, g_iPlayerLevel[killer]);
  517.     }
  518.    
  519.     // Apply cash bonus from equipped knife
  520.     new knife_id = g_iPlayerEquippedKnife[killer];
  521.     new Float:cash_bonus = g_Knives[knife_id][KNIFE_CASH_BONUS];
  522.     if (cash_bonus > 0.0) {
  523.         new bonus_cash = floatround(float(g_iPlayerCash[killer]) * cash_bonus);
  524.         g_iPlayerCash[killer] += bonus_cash;
  525.         client_print(killer, print_chat, "You earned a bonus of $%d from your knife!", bonus_cash);
  526.     }
  527.    
  528.     save_player_data(killer);
  529. }
  530.  
  531. public native_get_player_knife_cash(plugin_id, num_params) {
  532.     new id = get_param(1);
  533.     if (id < 1 || id > MAX_PLAYERS) {
  534.         log_error(AMX_ERR_NATIVE, "Invalid player id %d", id);
  535.         return 0;
  536.     }
  537.     return g_iPlayerCash[id];
  538. }
  539.  
  540. public native_set_player_knife_cash(plugin_id, num_params) {
  541.     new id = get_param(1);
  542.     new cash = get_param(2);
  543.     if (id < 1 || id > MAX_PLAYERS) {
  544.         log_error(AMX_ERR_NATIVE, "Invalid player id %d", id);
  545.         return 0;
  546.     }
  547.     g_iPlayerCash[id] = cash;
  548.     save_player_data(id);
  549.     return 1;
  550. }
  551.  
  552. public native_get_player_knife_level(plugin_id, num_params) {
  553.     new id = get_param(1);
  554.     if (id < 1 || id > MAX_PLAYERS) {
  555.         log_error(AMX_ERR_NATIVE, "Invalid player id %d", id);
  556.         return 0;
  557.     }
  558.     return g_iPlayerLevel[id];
  559. }
  560.  
  561. public native_set_player_knife_level(plugin_id, num_params) {
  562.     new id = get_param(1);
  563.     new level = get_param(2);
  564.     if (id < 1 || id > MAX_PLAYERS) {
  565.         log_error(AMX_ERR_NATIVE, "Invalid player id %d", id);
  566.         return 0;
  567.     }
  568.     g_iPlayerLevel[id] = level;
  569.     save_player_data(id);
  570.     return 1;
  571. }
Advertisement
Comments
  • CheezPuff
    126 days
    # text 0.26 KB | 0 0
    1. מי שעוקב אחריי המוד רק בתהליכי בנייה כי יש בחור מתנשא
    2. infender חושב שהוא מתכנת על
    3. build shop hardcoded 1.8.3 so lets copy and paste the SAME SHIT, OFC NOT 100% SAME only half works because not have time
Add Comment
Please, Sign In to add comment
Advertisement