I looked around on AM for some knifemods with alot of features but didnt really find any i like so i started scripting my own knifemod that I will release when finished.
it wil have a wide range of variations since you can fully customize it to your needs with cvars. (I will put all cvars in a cfg file with the plugin)
If you have any suggestions or idea's id love to hear them, new knifemod idea's are always welcome.
EDIT:
I need help for 2 things, see next post(Credits will go to everybody that helped.)
Plugin description:
Spoiler
Code:
knife mod - shop
====================
Token system:
---------------
x token(s) for every x kill(s) you make (x=cvar),
with tokens you can buy stuff: extra items(one round only),
perm upgrades(last until vault is reset) and skins(last until vault is reset).
A reset_tokens command for admin to use on a player || team || master reset(set tokens to all registered players to 0 in the vault)
A command for every player that announces how much tokens a player has in chat.
A command for every player that shows a motd of all players currently in the server with info on what perm upgrades and skins they bought.
---------------
prices are cvars for everything that you can buy.
Knifeshopmenu:
--------------
1. extra items
[permanents-submenu] (Cvars = 6)
- Bhopper (1 cvar)
- leapjump (cooldown of x seconds.(x=cvar)) (2 cvars)
- grenade pack (max buy per round is 1) (1 cvar)
- low gravity (gravity amount = cvar (2 cvars)
- speed boost (speed value = cvar (2 cvars)
- ...
...
2. permanents
[permanents-submenu] (cvars = 50)
- vitality (+5 HP) for x tokens (x=cvar(set the cost for each level by cvar(5levels=5costcvars))
- endurance (time between every slash and time between every stab (diffrent values in percentage(%)(5 for slashspeed% + 5 for stabspeed% (100% are default speeds) + 5 for levelcost = 15cvars))
- speed (5 levels, (5 cvars for levelcosts + 5 for speedamounts = 10cvars))
- gravity ( 5 levels, 5 cvars for levelcost + 5 for gravityamounts = 10 cvars))
- Invisibility (10cvars: 5 for levelcost + %' of invisibility (1.00 = totally invisible || 0.00 = visible || 0.51 = semi visible)
- ....
....
3. Skins shop
[skins shop submenu :p] (Cvars = variable)
1. Playerskins
[Playerskins submenu] (5 skins = 5cvars)
- list of all skins that players can buy
(with token cost = x. x=cvar)
- players can see and wear their bought skins when they open the myskins menu by typing /myskins in chat.
2. Extra Knife
[Extra knife submenu] (5 skins = 5 cvars)
- list of all extra knifemodels that players can buy and their price (with token cost = x for every skin, (x=1cvar))
- players can see and use their bought skins when they open the knifes menu by typing knife in chat.
- skins you havent bought yet are displayed in darkwhite (for this menu and the knife menu).
I'm done for about 60 - 70 % of the plugin but there are 2 essential things to this plugin that I need some help with.
I attached the plugin, it cant get compiled yet due to the skin problem so take a look at the .sma if you wanna help.
greets and thx!
complications and todolist:
Code:
/*______________________________________________________________________________________________________________________
|Still to-do: - reset extra items on round end and new round start & when they enter server |
| - Bhop Code, Leapjump Code (Help is always appreciated & credited :) ) |
| - Code Optimizing |
| - When players with Perm items or bought skins join, letting them spawn with their perm items and skin |
| - Skins warderobe menu (when they type /myskins they can choose between their bought skins to wear), |
| (prob gonna need some help with this) |
| - extra Knife submenu with small abilities for in the shop
| ...
|
| |
|Need help for:
|
| - Making bought perm items and bought skins permanent |
| - Perm Upgrade Endurance (faster slash & stab) |
|______________________________________________________________________________________________________________________*/
//////////////////Credits:\\\\\\\\\\\\\\\\\\ // Pastout (for his Pointssystem) // Striker07
/*______________________________________________________________________________________________________________________ |Still to-do: - reset extra items on round end and new round start & when they enter server | - Bhop Code, Leapjump Code (Help is always appreciated & credited :) ) | | - Code Optimizing | | - When players with Perm itesm or bought skins join, letting them spawn with their perm items and skin | | - Skins warderobe menu (when they type /myskins they can choose between their bought skins to wear), | | (prob gonna need some help with this) | | - .. | | | |Need help for: - Setting the skin(foldername) by cvars | | - Making bought perm items and bought skins permanent | | - Perm Upgrade Endurance (faster slash & stab) | |______________________________________________________________________________________________________________________*/
#define PLUGIN "KM-Shop" #define VERSION "0.5" #define AUTHOR "Striker07"
#define ADMIN_TOKENS ADMIN_LEVEL_H // access to give/take/set tokens
// Do NOT uncomment all 3 will not work... either uncomment SAVE_METHOD_NICK OR SAVE_METHOD_IP OR SAVE_METHOD_ID // To save player data by nick, uncomment "//#define SAVE_METHOD_NICK" //#define SAVE_METHOD_NICK // To save player data by ip, uncomment "//#define SAVE_METHOD_IP" //#define SAVE_METHOD_IP // To save player data by id, uncomment "//#define SAVE_METHOD_ID" #define SAVE_METHOD_ID
const MAX_PLAYERS = 32;
#if defined SAVE_METHOD_NICK new g_iAuth[MAX_PLAYERS+1][32]; #endif #if defined SAVE_METHOD_IP new g_iAuthIP[MAX_PLAYERS+1][32]; #endif #if defined SAVE_METHOD_ID new g_iAuthID[MAX_PLAYERS+1][32]; #endif new g_vault; // Open a new vault to store a players points. new g_iTokens[MAX_PLAYERS+1]; // Amount of Points a player has new g_bHeadShot[MAX_PLAYERS+1][MAX_PLAYERS+1]; #define HITGROUP_HEAD 1
const MAX_PLAYERS = 32;
new g_MenuCallback;
new const g_szPluginPrefix[] = "Knife Mod"; new g_iMaxPlayers; new g_iMsgSayText; #define FIRST_PLAYER_ID 1 #define IsPlayer(%1) (FIRST_PLAYER_ID <= %1 <= g_iMaxPlayers)
//extra items new g_bHasBhop; new g_bHasLeap; new g_bHasNadePack; new g_bHasLowGravity; new g_bHasSpeed;
//perm upgrades new g_bHasPermVital; new g_bHasEndur; new g_bHasPermGrav; new g_bHasPermSpeed; new g_bHasPermInvis;
//skins new g_bHasSkin1; new g_bHasSkin2; new g_bHasSkin3; new g_bHasSkin4; new g_bHasSkin5;
///////////////////////////////////////// ////////////// Cvars //////////////////// new km_tokens_kill; // Tokens per kill new km_tokens_hskill; // Tokens per headshot kill //extra items new km_cost_bhop; new km_cost_leap; new km_cost_nadepack; new km_cost_lowgravity; new km_val_lowgravity; new km_cost_speed; new km_val_speed;
// Permanent upgrades new km_cost_permvitality; new km_val_permvitality; new km_cost_permendurance; //new km_val_permendurance; new km_cost_permgravity; new km_val_permgravity; new km_cost_permspeed; new km_val_permspeed; new km_cost_perminvisibility; new km_val_permvisibility;
// Skins new km_cost_skin1; new km_skin1_folder; new km_cost_skin2; new km_skin2_folder; new km_cost_skin3; new km_skin3_folder; new km_cost_skin4; new km_skin4_folder; new km_cost_skin5; new km_skin5_folder; /////////////////////////////////////////
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR)
new admin_name[32]; get_user_name(id, admin_name, charsmax(admin_name)); new player_name[32]; get_user_name(player, player_name, charsmax(player_name)); new pointnum = str_to_num(amount);
new admin_name[32]; get_user_name(id, admin_name, charsmax(admin_name)); new player_name[32]; get_user_name(player, player_name, charsmax(player_name));
public Knifeshop_handler(id, menu, item) { if( item == MENU_EXIT ) { menu_destroy(menu); //Note that you will want to destroy the menu after they do something return PLUGIN_HANDLED; }
new data[6], szName[64]; new access, callback; //heres the function that will give us that information (since it doesnt magicaly appear) menu_item_getinfo(menu, item, access, data,charsmax(data), szName,charsmax(szName), callback);
new key = str_to_num(data);
switch(key) { case 1: item_menu(id) case 2: perm_menu(id) case 3: skins_menu(id) }
menu_destroy(menu); return PLUGIN_HANDLED; }
public item_menu(id) { new menu = menu_create("\yExtra Items", "item_menu_handler");
public perm_menu_handler(id, menu, item) { // I need some help with the following; // 1. If a player already has bought a perm, I don't want them to be able to buy it again (after they leave the server and then come back in) perm upgrades should save once they have been bought // If you know how to fix this pls let me know (striker07) if( item == MENU_EXIT ) { menu_destroy(menu);
if( is_user_connected(id) ) Knifeshop(id);
return PLUGIN_HANDLED; }
new data[6], szName[64]; new access, callback; menu_item_getinfo(menu, item, access, data,charsmax(data), szName,charsmax(szName), callback);
new key = str_to_num(data);
switch(key) { case 1: { if(g_iTokens[id] < get_pcvar_num(km_cost_permvitality) ) { fnColorPrint(id, "You have insufficient tokens to purchase this upgrade."); menu_destroy(menu); return PLUGIN_HANDLED; } if(get_bit(g_bHasPermVital, id)) { fnColorPrint(id, "You already have this upgrade."); menu_destroy(menu); return PLUGIN_HANDLED; } set_bit(g_bHasPermVital, id); g_iTokens[id] -= get_pcvar_num(km_cost_permvitality); cs_set_user_money(id, g_iTokens[id], 1);
Perm_Vitality (id);
menu_destroy(menu);
} case 2: { if(g_iTokens[id] < get_pcvar_num(km_cost_permendurance) ) { fnColorPrint(id, "You have insufficient tokens to purchase this upgrade."); menu_destroy(menu); return PLUGIN_HANDLED; } if(get_bit(g_bHasEndur, id)) { fnColorPrint(id, "You already have this upgrade."); menu_destroy(menu); return PLUGIN_HANDLED; } set_bit(g_bHasEndur, id); g_iTokens[id] -= get_pcvar_num(km_cost_permendurance); cs_set_user_money(id, g_iTokens[id], 1);
Perm_Endurance(id);
menu_destroy(menu); } case 3: { if(g_iTokens[id] < get_pcvar_num(km_cost_permgravity) ) { fnColorPrint(id, "You have insufficient tokens to purchase this upgrade."); menu_destroy(menu); return PLUGIN_HANDLED; } if(get_bit(g_bHasPermGrav, id)) { fnColorPrint(id, "You already have this upgrade."); menu_destroy(menu); return PLUGIN_HANDLED; } set_bit(g_bHasPermGrav, id); g_iTokens[id] -= get_pcvar_num(km_cost_permgravity); cs_set_user_money(id, g_iTokens[id], 1);
Perm_Gravity(id);
menu_destroy(menu); } case 4: { if(g_iTokens[id] < get_pcvar_num(km_cost_permspeed) ) { fnColorPrint(id, "You have insufficient tokens to purchase this upgrade."); menu_destroy(menu); return PLUGIN_HANDLED; } if(get_bit(g_bHasPermSpeed, id)) { fnColorPrint(id, "You already have this upgrade."); menu_destroy(menu); return PLUGIN_HANDLED; } set_bit(g_bHasPermSpeed, id); g_iTokens[id] -= get_pcvar_num(km_cost_permspeed); cs_set_user_money(id, g_iTokens[id], 1);
Perm_Speed(id);
menu_destroy(menu); } case 5: { if(g_iTokens[id] < get_pcvar_num(km_cost_perminvisibility) ) { fnColorPrint(id, "You have insufficient tokens to purchase this upgrade."); menu_destroy(menu); return PLUGIN_HANDLED; } if(get_bit(g_bHasPermInvis, id)) { fnColorPrint(id, "You already have this upgrade."); menu_destroy(menu); return PLUGIN_HANDLED; } set_bit(g_bHasPermInvis, id); g_iTokens[id] -= get_pcvar_num(km_cost_perminvisibility); cs_set_user_money(id, g_iTokens[id], 1);
public skins_menu_handler(id, menu, item) { // I need some help with the following; // 1. If a player already has bought a skin, I don't want them to be able to buy it again (after they leave the server and then come back in), also their skin should save once bought // 2. for setting the skin with a cvar (cs_set_user_model), I experimented with %s but none worked. // If you know how to fix this pls let me know (striker07) if( item == MENU_EXIT ) { menu_destroy(menu);
if( is_user_connected(id) ) Knifeshop(id);
return PLUGIN_HANDLED; }
new data[6], szName[64]; new access, callback; menu_item_getinfo(menu, item, access, data,charsmax(data), szName,charsmax(szName), callback);
new key = str_to_num(data);
switch(key) { case 1: { if(g_iTokens[id] < get_pcvar_num(km_cost_skin1) ) { fnColorPrint(id, "You have insufficient tokens to purchase this skin."); menu_destroy(menu); return PLUGIN_HANDLED; } if(get_bit(g_bHasSkin1, id)) { fnColorPrint(id, "You already have this skin."); menu_destroy(menu); return PLUGIN_HANDLED; } new skin = get_pcvar_string(km_skin1_folder); cs_set_user_model(id, "%s" , skin); set_bit(g_bHasSkin1, id);
public client_authorized(id) { if(!is_user_bot(id) && !is_user_hltv(id)) { #if defined SAVE_METHOD_NICK get_user_name(id, g_iAuth[id], charsmax(g_iAuth)); #endif #if defined SAVE_METHOD_IP get_user_ip(id, g_iAuthIP[id], charsmax(g_iAuthIP)); #endif #if defined SAVE_METHOD_ID get_user_authid(id, g_iAuthID[id], charsmax(g_iAuthID)); #endif
GetData(id); } }
public Fwd_TraceAttack_Player_Post(const victim, const attacker, Float:flDamage, Float:flDirection[3], const ptr, const iDamagebits) { // Not a valid attacker / no victim if (!IsPlayer(attacker)) return HAM_IGNORED;