mindegy felrakom, hátha valakinek segít abban hogy segítsen az én problémámon

Kód:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <fakemeta_util>
#include <fun>
#include <hamsandwich>
#include <cstrike>
#include <engine>
#include <nst_wpn>
#include <zombieplague>
#define PLUGIN "NST Wpn Mod"
#define VERSION "1.0"
#define AUTHOR "NST"
// Var main
const TYPE_WPN = 3
const MAX_WPN = 40
new HAS_WEAPON[33]
new g_wpn_name[MAX_WPN][32]
new g_wpn_model[MAX_WPN][32]
new g_wpn_change[MAX_WPN]
new g_wpn_cmdbuy[MAX_WPN][32]
new Name_WpnChange[MAX_WPN][32]
new current_select[33]
// Models
new P_MODEL[MAX_WPN][64]
new V_MODEL[MAX_WPN][64]
// Sound
new Sound_miss[MAX_WPN][64]
new Sound_hitwall[MAX_WPN][64]
new Sound_hit1[MAX_WPN][64]
new Sound_hit2[MAX_WPN][64]
new Sound_stab[MAX_WPN][64]
// Cvar
new cvar_dmg_name[MAX_WPN][64]
new cvar_cost_name[MAX_WPN][64]
new cvar_dmgmultiplier[MAX_WPN]
new cvar_cost[MAX_WPN]
new cvar_buy
#define is_valid_player(%1) (1 <= %1 <= 32)
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
// Reg Public
register_event("CurWeapon","checkWeapon","be","1=1")
register_event("DeathMsg", "Death", "a")
RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
register_forward(FM_EmitSound,"fw_emitsound")
// Reg Cmd
register_clcmd("nst_wpn_3", "menu_wpn")
register_clcmd("nst_wpn_3_rebuy", "rebuy_wpn")
cvar_buy = register_cvar("nst_buy_model3", "nst")
register_clcmd("nst_buy_wpn3", "buy_weapon_cvar")
new i = 1, check_value = 1
while(check_value && i<MAX_WPN)
{
if (g_wpn_change[i] <= 0) check_value = 0
if (check_value)
{
new szWpnName[32]
get_weaponname(g_wpn_change[i], szWpnName, 31)
format(Name_WpnChange[i], 31, "%s", szWpnName)
register_clcmd(g_wpn_cmdbuy[i],"buy_weapon", i)
}
i++
}
}
public plugin_precache()
{
new configfile[200]
get_configsdir(configfile,199)
format(configfile,199,"%s/nst_wpn.ini",configfile)
if(file_exists(configfile))
{
new row[200], left[64], trash, right[64], idwpn = 1
new size=file_size(configfile,1)
for(new i=0;i<size;i++)
{
new name[64], model[64], wpn_change, damage[32], cost[32]
read_file(configfile,i,row,200,trash)
if( (contain(row,";")!=0) && strlen(row) && idwpn<MAX_WPN)
{
// Create Value
replace(row, 199, " ", "_")
replace(row, 199, "[name]", "")
replace(row, 199, "[model]", " ")
replace(row, 199, "[wpn_change]", " ")
replace(row, 199, "[damage]", " ")
replace(row, 199, "[cost]", " ")
strbreak(row,left,63,right,63)
format(row, 199, "%s", right)
format(name, 63, "%s", left)
replace(name, 63, "_", " ")
strbreak(row,left,63,right,63)
format(row, 199, "%s", right)
format(model, 63, "%s", left)
strbreak(row,left,63,right,63)
format(row, 199, "%s", right)
wpn_change = str_to_num(left)
strbreak(row,left,63,right,63)
format(row, 199, "%s", right)
format(damage, 31, "%s", left)
strbreak(row,left,63,right,63)
format(row, 199, "%s", right)
format(cost, 31, "%s", left)
if (nst_get_weapon_type(wpn_change) == TYPE_WPN)
{
// Set Value
format(g_wpn_name[idwpn], 31, "%s", name)
format(g_wpn_model[idwpn], 31, "%s", model)
format(g_wpn_cmdbuy[idwpn], 31, "nst_buywpn %s", model)
g_wpn_change[idwpn] = wpn_change
// Create Vvar
format(cvar_dmg_name[idwpn], 63, "nst_%s_dmg", model)
format(cvar_cost_name[idwpn], 63, "nst_%s_cost", model)
cvar_dmgmultiplier[idwpn] = register_cvar(cvar_dmg_name[idwpn], damage)
cvar_cost[idwpn] = register_cvar(cvar_cost_name[idwpn], cost)
// Precache
format(P_MODEL[idwpn], 63, "models/nst_wpn/p_%s.mdl", model)
format(V_MODEL[idwpn], 63, "models/nst_wpn/v_%s.mdl", model)
precache_model(P_MODEL[idwpn])
precache_model(V_MODEL[idwpn])
format(Sound_miss[idwpn], 63, "weapons/%s_miss.wav", model)
format(Sound_hitwall[idwpn], 63, "weapons/%s_hitwall.wav", model)
format(Sound_hit1[idwpn], 63, "weapons/%s_hit1.wav", model)
format(Sound_hit2[idwpn], 63, "weapons/%s_hit2.wav", model)
format(Sound_stab[idwpn], 63, "weapons/%s_stab.wav", model)
precache_sound(Sound_miss[idwpn])
precache_sound(Sound_hitwall[idwpn])
precache_sound(Sound_hit1[idwpn])
precache_sound(Sound_hit2[idwpn])
precache_sound(Sound_stab[idwpn])
idwpn++
}
}
}
}
}
// Human Death
public zp_user_infected_post(id)
{
if (zp_get_user_zombie(id) && HAS_WEAPON[id])
{
HAS_WEAPON[id] = 0
}
}
public Death()
{
new id = read_data(2)
if(HAS_WEAPON[id])
{
HAS_WEAPON[id] = 0
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
// Change Sound
public fw_emitsound(entity,channel,sample[],Float:volume,Float:attenuation,fFlags,pitch)
{
for (new id = 1; id < 33; id++)
{
new CURENT_WEAPON = HAS_WEAPON[id]
new CHANGE_WEAPON = g_wpn_change[CURENT_WEAPON]
new plrClip, plrAmmo, plrWeapId
plrWeapId = get_user_weapon(id, plrClip , plrAmmo)
if (plrWeapId == CHANGE_WEAPON && HAS_WEAPON[id])
{
new sound_new[64]
if( (equal(sample,"weapons/knife_slash1.wav")) || (equal(sample,"weapons/knife_slash2.wav")) ) copy(sound_new, 63, Sound_miss[CURENT_WEAPON])
else if(equal(sample,"weapons/knife_hitwall1.wav")) copy(sound_new, 63, Sound_hitwall[CURENT_WEAPON])
else if( (equal(sample,"weapons/knife_hit1.wav")) || (equal(sample,"weapons/knife_hit3.wav"))) copy(sound_new, 63, Sound_hit1[CURENT_WEAPON])
else if( (equal(sample,"weapons/knife_hit2.wav")) || (equal(sample,"weapons/knife_hit4.wav"))) copy(sound_new, 63, Sound_hit2[CURENT_WEAPON])
else if(equal(sample,"weapons/knife_stab.wav")) copy(sound_new, 63, Sound_stab[CURENT_WEAPON])
emit_sound(entity,channel,sound_new,volume,attenuation,fFlags,pitch)
return FMRES_SUPERCEDE
}
}
return FMRES_IGNORED;
}
// Menu Wpn
public menu_wpn(id)
{
if (!g_wpn_change[1]) return PLUGIN_HANDLED
new mHandleID = menu_create("[NST Wpn] Menu Knife:", "menu_wpn_handler")
menu_additem(mHandleID, "Default Knife", "0", 0)
new i = 1, check_value = 1
while(check_value && i<MAX_WPN)
{
if (g_wpn_change[i] <= 0) check_value = 0
if (check_value)
{
new wpn_cost = get_pcvar_num(cvar_cost[i])
new item_name[150], idwpn[32]
format(item_name, 149, "%s: %i$", g_wpn_name[i], wpn_cost)
format(idwpn, 31, "%i", i)
new check_money[33], user_money = cs_get_user_money(id)
if(user_money < wpn_cost) check_money[id] = 1
else check_money[id] = 0
menu_additem(mHandleID, item_name, idwpn, check_money[id])
}
i++
}
menu_addblank(mHandleID, 1) // add blank got problem
menu_setprop(mHandleID, MPROP_PERPAGE, 7)
menu_display(id, mHandleID, 0)
return PLUGIN_HANDLED
}
public menu_wpn_handler(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new idwpn[32], name[32], access
menu_item_getinfo(menu, item, access, idwpn, 31, name, 31, access)
new idweapon = str_to_num(idwpn)
if (!idweapon) HAS_WEAPON[id] = 0
else buy_weapon(id, idweapon)
menu_destroy(menu)
//client_print(id, print_chat, "item: %i - id: %s", item, idwpn);
return PLUGIN_HANDLED
}
public rebuy_wpn(id)
{
new idwpn = current_select[id]
if (idwpn>0) buy_weapon(id, idwpn)
return PLUGIN_HANDLED
}
// Change Damage
public fw_TakeDamage(victim, inflictor, attacker, Float:damage)
{
new CURENT_WEAPON = HAS_WEAPON[attacker]
new CHANGE_WEAPON = g_wpn_change[CURENT_WEAPON]
if ( is_valid_player( attacker ) && get_user_weapon(attacker) == CHANGE_WEAPON && HAS_WEAPON[attacker] )
{
SetHamParamFloat(4, damage * get_pcvar_float( cvar_dmgmultiplier[CURENT_WEAPON] ) )
}
}
// Buy Weapon
public buy_weapon_cvar(id)
{
new models[62]
get_pcvar_string(cvar_buy, models, 61)
for(new i=1; i<MAX_WPN; i++)
{
if (g_wpn_change[i] > 0)
{
if (equali(g_wpn_model[i],models))
{
buy_weapon(id, i)
return PLUGIN_HANDLED
}
}
}
return PLUGIN_HANDLED
}
public buy_weapon(id, idwpn)
{
//client_print(id, print_chat, "Mua %i", idwpn)
new buyzone = cs_get_user_buyzone(id)
new mod_runing = nst_get_mod_runing()
if (mod_runing == 1 || mod_runing == 2 || mod_runing == 3) buyzone = 1
if (buyzone == 0) client_print(id, print_chat, "[NST Wpn] Ban khong the mua Vu khi o vi tri nay")
else
{
new plrClip, plrAmmo
get_user_weapon(id, plrClip , plrAmmo)
new user_money = cs_get_user_money(id)
new wp_cost = get_pcvar_num(cvar_cost[idwpn])
if (zp_get_user_zombie(id))
{
client_print(id, print_chat, "[NST Wpn] Ban dang la Zombie nen khong the mua %s", g_wpn_name[idwpn])
}
else if(!is_user_alive(id))
{
client_print(id, print_chat, "[NST Wpn] Ban chi co the mua duoc %s khi con song", g_wpn_name[idwpn]);
}
else if(user_money < wp_cost)
{
client_print(id, print_chat, "[NST Wpn] Ban khong du tien de mua");
}
else if(HAS_WEAPON[id] == idwpn)
{
client_print(id, print_chat, "[NST Wpn] Ban da co %s roi", g_wpn_name[idwpn])
}
else
{
current_select[id] = idwpn
HAS_WEAPON[id] = idwpn
give_weapon(id)
cs_set_user_money(id, user_money-wp_cost)
checkModel(id)
client_print(id, print_chat, "[NST Wpn] Ban da mua %s", g_wpn_name[idwpn])
}
}
}
// Give Weapon
public give_weapon(id)
{
if (zp_get_user_zombie(id)) return PLUGIN_HANDLED
new CURENT_WEAPON = HAS_WEAPON[id]
give_item(id,Name_WpnChange[CURENT_WEAPON])
return PLUGIN_HANDLED
}
// Check Weapon
public checkModel(id)
{
if (zp_get_user_zombie(id)) return PLUGIN_HANDLED
new CURENT_WEAPON = HAS_WEAPON[id]
new CHANGE_WEAPON = g_wpn_change[CURENT_WEAPON]
new plrClip, plrAmmo, plrWeapId
plrWeapId = get_user_weapon(id, plrClip , plrAmmo)
if ( plrWeapId == CHANGE_WEAPON && HAS_WEAPON[id])
{
set_pev(id, pev_viewmodel2, V_MODEL[CURENT_WEAPON])
set_pev(id, pev_weaponmodel2, P_MODEL[CURENT_WEAPON])
}
return PLUGIN_HANDLED
}
public checkWeapon(id)
{
new CURENT_WEAPON = HAS_WEAPON[id]
new CHANGE_WEAPON = g_wpn_change[CURENT_WEAPON]
new plrClip, plrAmmo, plrWeapId
plrWeapId = get_user_weapon(id, plrClip , plrAmmo)
if (plrWeapId == CHANGE_WEAPON && HAS_WEAPON[id])
{
checkModel(id)
}
return PLUGIN_HANDLED
}
// Other Public
public client_connect(id)
{
HAS_WEAPON[id] = 0
}
public client_disconnect(id)
{
HAS_WEAPON[id] = 0
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1034\\ f0\\ fs16 \n\\ par }
*/
Tessék, ebbe bennevan amit én szeretnék a knife mod-hoz, remélem ez elég alap hogy segíts nekem kiki

(vagy valaki más)