29-09-2022, Saat: 14:00
merhabalar forumda yeniyim isteğime başlamadan öncelikle iyi forumlar dilerim
pluginde bir sorun yok derlediğimde hata da vermiyor
plugini kuruyorum serverime giriyorum knife menuyu açıyorum
astra knifesini seçiyorum fakat başka knife seçince astra elimde kalıyor guilitone hariç
başka knifeleri seçince astra elime geliyor bu sorunu çözerseniz sevinirim plugini aşağıda bırakıyorum.
kusura bakmayın .sma olarak paylaşamadım galiba öyle yükleme yok
pluginde bir sorun yok derlediğimde hata da vermiyor
plugini kuruyorum serverime giriyorum knife menuyu açıyorum
astra knifesini seçiyorum fakat başka knife seçince astra elimde kalıyor guilitone hariç
başka knifeleri seçince astra elime geliyor bu sorunu çözerseniz sevinirim plugini aşağıda bırakıyorum.
kusura bakmayın .sma olarak paylaşamadım galiba öyle yükleme yok
Kod:
#include <amxmodx>
#include <amxmisc>
#include <amxconst>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#include <zombieplague>
#include <levels>
native give_astra(const id);
native remove_astra(const id);
native gui_ekle(id);
native gui_sil(id);
new g_knife1[33],g_knife2[33],g_knife3[33],g_knife4[33],g_knife5[33],g_knife6[33],g_knife7[33]
new cvar_knife1_knock, cvar_knife2_knock, cvar_knife3_knock, cvar_knife4_knock, cvar_knife5_knock
new cvar_knife1_dmg, cvar_knife2_dmg, cvar_knife3_dmg, cvar_knife4_dmg, cvar_knife5_dmg
new knife1_v_model[] = "models/tayo_knife/v_knife1.mdl"
new knife2_v_model[] = "models/tayo_knife/v_knife2.mdl"
new knife3_v_model[] = "models/tayo_knife/v_knife3.mdl"
new knife4_v_model[] = "models/tayo_knife/v_knife4.mdl"
new knife5_v_model[] = "models/tayo_knife/v_knife5.mdl"
new v_astra[] = "models/v_guillotineex.mdl"
new p_astra[] = "models/p_guillotineex.mdl"
new const knife1_sounds[][] =
{
"knf_tayo/classic/knife_deploy1.wav",
"knf_tayo/classic/knife_hit1.wav",
"knf_tayo/classic/knife_hit2.wav",
"knf_tayo/classic/knife_hit3.wav",
"knf_tayo/classic/knife_hit4.wav",
"knf_tayo/classic/knife_hitwall1.wav",
"knf_tayo/classic/knife_slash1.wav",
"knf_tayo/classic/knife_slash2.wav",
"knf_tayo/classic/knife_stap.wav"
}
new const knife2_sounds[][] =
{
"knf_tayo/galaxy/knife_deploy1.wav",
"knf_tayo/galaxy/knife_hit1.wav",
"knf_tayo/galaxy/knife_hit2.wav",
"knf_tayo/galaxy/knife_hit3.wav",
"knf_tayo/galaxy/knife_hit4.wav",
"knf_tayo/galaxy/knife_hitwall1.wav",
"knf_tayo/galaxy/knife_slash1.wav",
"knf_tayo/galaxy/knife_slash2.wav",
"knf_tayo/galaxy/knife_stap.wav"
}
new const knife3_sounds[][] =
{
"knf_tayo/dread/knife_deploy1.wav",
"knf_tayo/dread/knife_hit1.wav",
"knf_tayo/dread/knife_hit2.wav",
"knf_tayo/dread/knife_hit3.wav",
"knf_tayo/dread/knife_hit4.wav",
"knf_tayo/dread/knife_hitwall1.wav",
"knf_tayo/dread/knife_slash1.wav",
"knf_tayo/dread/knife_slash2.wav",
"knf_tayo/dread/knife_stap.wav"
}
new const knife4_sounds[][] =
{
"knf_tayo/sword/knife_deploy1.wav",
"knf_tayo/sword/knife_hit1.wav",
"knf_tayo/sword/knife_hit2.wav",
"knf_tayo/sword/knife_hit3.wav",
"knf_tayo/sword/knife_hit4.wav",
"knf_tayo/sword/knife_hitwall1.wav",
"knf_tayo/sword/knife_slash1.wav",
"knf_tayo/sword/knife_slash2.wav",
"knf_tayo/sword/knife_stap.wav"
}
new const knife5_sounds[][] =
{
"knf_tayo/warhammer/warhammer_deploy.wav",
"knf_tayo/warhammer/warhammer_hit.wav",
"knf_tayo/warhammer/warhammer_hit.wav",
"knf_tayo/warhammer/warhammer_hit.wav",
"knf_tayo/warhammer/warhammer_hit.wav",
"knf_tayo/warhammer/warhammer_hitwall.wav",
"knf_tayo/warhammer/warhammer_slash.wav",
"knf_tayo/warhammer/warhammer_slash.wav",
"knf_tayo/warhammer/warhammer_stap.wav"
}
new const oldknife_sounds[][] =
{
"weapons/knife_deploy1.wav",
"weapons/knife_hit1.wav",
"weapons/knife_hit2.wav",
"weapons/knife_hit3.wav",
"weapons/knife_hit4.wav",
"weapons/knife_hitwall1.wav",
"weapons/knife_slash1.wav",
"weapons/knife_slash2.wav",
"weapons/knife_stab.wav"
}
public plugin_init()
{
register_plugin("Knife Menu", "1.0","Multipower,Tayo")
register_event("CurWeapon","checkWeapon","be","1=1")
register_event("Damage" , "event_Damage" , "b" , "2>0");
RegisterHam(Ham_Spawn, "player", "Player_Spawn", 1)
RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage");
register_forward(FM_EmitSound, "fw_EmitSound");
register_clcmd("say /bicak","knifemenu")
register_clcmd("say /knife","knifemenu")
register_clcmd("say_team /knife","knifemenu")
register_clcmd("say_team /bicak","knifemenu")
cvar_knife1_knock = register_cvar("ze_knife1_knock" , "6.0");
cvar_knife2_knock = register_cvar("ze_knife2_knock" , "9.0");
cvar_knife3_knock = register_cvar("ze_knife3_knock" , "12.0");
cvar_knife4_knock = register_cvar("ze_knife4_knock" , "15.0");
cvar_knife5_knock = register_cvar("ze_knife5_knock" , "18.0");
cvar_knife1_dmg = register_cvar("ze_knife1_dmg" , "100.0");
cvar_knife2_dmg = register_cvar("ze_knife2_dmg" , "300.0");
cvar_knife3_dmg = register_cvar("ze_knife3_dmg" , "500.0");
cvar_knife4_dmg = register_cvar("ze_knife4_dmg" , "700.0");
cvar_knife5_dmg = register_cvar("ze_knife5_dmg" , "900.0");
}
public plugin_precache()
{
precache_model(knife1_v_model)
precache_model(knife2_v_model)
precache_model(knife3_v_model)
precache_model(knife4_v_model)
precache_model(knife5_v_model)
precache_model(v_astra)
precache_model(p_astra)
for(new i = 0; i < sizeof knife1_sounds; i++)
precache_sound(knife1_sounds[i])
for(new i = 0; i < sizeof knife2_sounds; i++)
precache_sound(knife2_sounds[i])
for(new i = 0; i < sizeof knife3_sounds; i++)
precache_sound(knife3_sounds[i])
for(new i = 0; i < sizeof knife4_sounds; i++)
precache_sound(knife4_sounds[i])
for(new i = 0; i < sizeof knife5_sounds; i++)
precache_sound(knife5_sounds[i])
}
public Player_Spawn(id)
{
if(is_user_alive(id) && get_user_flags(id) == ADMIN_KICK && !zp_get_user_zombie(id))
{
give_astra(id);
}
else
{
knife1(id)
}
}
public client_connect(id)
{
g_knife1[id] = false
g_knife2[id] = false
g_knife3[id] = false
g_knife4[id] = false
g_knife5[id] = false
g_knife7[id] = false
}
public client_disconnected(id)
{
g_knife1[id] = false
g_knife2[id] = false
g_knife3[id] = false
g_knife4[id] = false
g_knife5[id] = false
g_knife7[id] = false
}
public knifemenu(id)
{
new menuz;
static amenu[512];
formatex(amenu,charsmax(amenu),"\r[ZoP] \yKnife Menu")
menuz = menu_create(amenu,"knifemenu_devam")
formatex(amenu,charsmax(amenu),"\y[\rZoP\y] \w-| Classic Knife |-")
menu_additem(menuz,amenu,"1")
if(get_user_level(id) >= 0)
{
formatex(amenu,charsmax(amenu),"\y[\rZoP\y] \w-| Luminous Sword |-")
}
else
{
formatex(amenu,charsmax(amenu),"\rLOCKED \d[LVL:20]")
}
menu_additem(menuz,amenu,"2")
if(get_user_level(id) >= 0)
{
formatex(amenu,charsmax(amenu),"\y[\rZoP\y] \w-| Valorant |-")
}
else
{
formatex(amenu,charsmax(amenu),"\rLOCKED \d[LVL:40]")
}
menu_additem(menuz,amenu,"3")
if(get_user_level(id) >= 0)
{
formatex(amenu,charsmax(amenu),"\y[\rZoP\y] \w-| Warhammer |-")
}
else
{
formatex(amenu,charsmax(amenu),"\rLOCKED \d[LVL:60]")
}
menu_additem(menuz,amenu,"4")
if(get_user_level(id) >= 65)
{
formatex(amenu,charsmax(amenu),"\y[\rZoP\y] \w-| Swords |-")
}
else
{
formatex(amenu,charsmax(amenu),"\rLOCKED \d[LVL:65]")
}
menu_additem(menuz,amenu,"5")
if(is_user_admin(id))
{
formatex(amenu,charsmax(amenu),"\y[\rZoP\y] \w-| Guillotine |-")
}
else
{
formatex(amenu,charsmax(amenu),"\rLOCKED \r[Admin]")
}
menu_additem(menuz,amenu,"6")
if(get_user_flags(id) & ADMIN_BAN)
{
formatex(amenu,charsmax(amenu),"\y[\rZoP\y] \w-| Astra Gui |-")
}
else
{
formatex(amenu,charsmax(amenu),"\rLOCKED \r[Admin Plus]")
}
menu_additem(menuz,amenu,"7")
menu_setprop(menuz,MPROP_EXIT,MEXIT_ALL)
menu_display(id,menuz,0)
return PLUGIN_HANDLED
}
public knifemenu_devam(id,menu,item)
{
if(item == MENU_EXIT || zp_get_user_zombie(id))
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new access,callback,data[6],iname[64]
menu_item_getinfo(menu,item,access,data,5,iname,63,callback)
new key = str_to_num(data)
if(key == 1)
{
remove_astra(id);
gui_sil(id)
knife1(id)
}
else if(key == 2)
{
if(get_user_level(id) >= 20)
{
knife2(id)
remove_astra(id);
gui_sil(id)
}
else
{
client_print_color(id, print_team_default, "x04[ZE]x03 Yeterli LvL'niz Yok.")
knifemenu(id)
}
}
else if(key == 3)
{
if(get_user_level(id) >= 40)
{
knife3(id)
remove_astra(id);
gui_sil(id)
}
else
{
client_print_color(id, print_team_default, "x04[ZE]x03 Yeterli LvL'niz Yok.")
knifemenu(id)
}
}
else if(key == 4)
{
if(get_user_level(id) >= 60)
{
knife4(id)
remove_astra(id);
gui_sil(id)
}
else
{
client_print_color(id, print_team_default, "x04[ZE]x03 Yeterli LvL'niz Yok.")
knifemenu(id)
}
}
else if(key == 5)
{
if(get_user_level(id) >= 70)
{
knife5(id)
remove_astra(id);
gui_sil(id)
}
else
{
client_print_color(id, print_team_default, "x04[ZE]x03 Yeterli LvL'niz Yok.")
knifemenu(id)
}
}
else if(key == 6)
{
if(is_user_admin(id))
{
remove_astra(id);
gui_silici(id)
gui_ekle(id)
}
else
{
client_print_color(id, print_team_default, "x04[ZE]x03 Yetkin Yok. x04|| x03Only For VIPS.")
knifemenu(id)
}
}
else if(key == 7)
{
if(get_user_flags(id) & ADMIN_BAN)
{
gui_sil(id);
gui_silici(id)
give_astra(id)
knife7(id)
}
else
{
client_print_color(id, print_team_default, "x04[ZE]x03 Yetkin Yok. x04|| x03Only For VIPS.")
knifemenu(id)
}
}
menu_destroy(menu)
return PLUGIN_HANDLED
}
public knife1(id)
{
g_knife1[id] = true
g_knife2[id] = false
g_knife3[id] = false
g_knife4[id] = false
g_knife5[id] = false
}
public knife2(id)
{
g_knife1[id] = false
g_knife2[id] = true
g_knife3[id] = false
g_knife4[id] = false
g_knife5[id] = false
}
public knife3(id)
{
g_knife1[id] = false
g_knife2[id] = false
g_knife3[id] = true
g_knife4[id] = false
g_knife5[id] = false
}
public knife4(id)
{
g_knife1[id] = false
g_knife2[id] = false
g_knife3[id] = false
g_knife4[id] = true
g_knife5[id] = false
}
public knife5(id)
{
g_knife1[id] = false
g_knife2[id] = false
g_knife3[id] = false
g_knife4[id] = false
g_knife5[id] = true
}
public gui_silici(id)
{
g_knife1[id] = false
g_knife2[id] = false
g_knife3[id] = false
g_knife4[id] = false
g_knife5[id] = false
}
public knife7(id)
{
g_knife7[id] = true
}
public fw_EmitSound(id, channel, const sound[])
{
if(!is_user_alive(id) || zp_get_user_zombie(id))
return FMRES_IGNORED
for(new i = 0; i < sizeof knife1_sounds; i++)
for(new i = 0; i < sizeof knife2_sounds; i++)
for(new i = 0; i < sizeof knife3_sounds; i++)
for(new i = 0; i < sizeof knife4_sounds; i++)
for(new i = 0; i < sizeof knife5_sounds; i++)
{
if(equal(sound, oldknife_sounds[i]))
{
if (g_knife1[id])
{
emit_sound(id, channel, knife1_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
return FMRES_SUPERCEDE
}
if (g_knife2[id])
{
emit_sound(id, channel, knife2_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
return FMRES_SUPERCEDE
}
if (g_knife3[id])
{
emit_sound(id, channel, knife3_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
return FMRES_SUPERCEDE
}
if (g_knife4[id])
{
emit_sound(id, channel, knife4_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
return FMRES_SUPERCEDE
}
if (g_knife5[id])
{
emit_sound(id, channel, knife5_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
return FMRES_SUPERCEDE
}
if (g_knife6[id])
{
emit_sound(id, channel, oldknife_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
return FMRES_SUPERCEDE
}
}
}
return FMRES_IGNORED
}
public checkWeapon(id)
{
new plrWeapId
plrWeapId = get_user_weapon(id)
if (plrWeapId == CSW_KNIFE && (g_knife1[id] || g_knife2[id] || g_knife3[id] || g_knife4[id] || g_knife5[id] || g_knife6[id] || g_knife7[id]))
{
checkModel(id)
}
}
public checkModel(id)
{
if (zp_get_user_zombie(id))
return PLUGIN_HANDLED
if (g_knife1[id])
{
set_pev(id, pev_viewmodel2, knife1_v_model)
}
if (g_knife2[id])
{
set_pev(id, pev_viewmodel2, knife2_v_model)
}
if (g_knife3[id])
{
set_pev(id, pev_viewmodel2, knife3_v_model)
}
if (g_knife4[id])
{
set_pev(id, pev_viewmodel2, knife4_v_model)
}
if (g_knife5[id])
{
set_pev(id, pev_viewmodel2, knife5_v_model)
}
if (g_knife7[id])
{
set_pev(id, pev_viewmodel2, v_astra)
set_pev(id, pev_weaponmodel2, p_astra)
}
return PLUGIN_HANDLED
}
public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
{
if(!is_user_connected(attacker))
return HAM_IGNORED
if(zp_get_user_zombie(attacker))
return HAM_IGNORED
new weapon = get_user_weapon(attacker)
if (weapon == CSW_KNIFE && g_knife1[attacker])
{
SetHamParamFloat(4, get_pcvar_float(cvar_knife1_dmg))
}
if (weapon == CSW_KNIFE && g_knife2[attacker])
{
SetHamParamFloat(4, get_pcvar_float(cvar_knife2_dmg))
}
if (weapon == CSW_KNIFE && g_knife3[attacker])
{
SetHamParamFloat(4, get_pcvar_float(cvar_knife3_dmg))
}
if (weapon == CSW_KNIFE && g_knife4[attacker])
{
SetHamParamFloat(4, get_pcvar_float(cvar_knife4_dmg))
}
if (weapon == CSW_KNIFE && g_knife5[attacker])
{
SetHamParamFloat(4, get_pcvar_float(cvar_knife5_dmg))
}
return HAM_IGNORED
}
public event_Damage(id)
{
new weapon , attacker = get_user_attacker(id , weapon);
if(!is_user_alive(attacker))
return PLUGIN_CONTINUE;
if(weapon == CSW_KNIFE && g_knife1[attacker])
{
new Float:vec[3];
new Float:oldvelo[3];
get_user_velocity(id, oldvelo);
create_velocity_vector(id , attacker , vec);
vec[0] += oldvelo[0];
vec[1] += oldvelo[1];
set_user_velocity(id , vec);
}
if(weapon == CSW_KNIFE && g_knife2[attacker])
{
new Float:vec[3];
new Float:oldvelo[3];
get_user_velocity(id, oldvelo);
create_velocity_vector(id , attacker , vec);
vec[0] += oldvelo[0];
vec[1] += oldvelo[1];
set_user_velocity(id , vec);
}
if(weapon == CSW_KNIFE && g_knife3[attacker])
{
new Float:vec[3];
new Float:oldvelo[3];
get_user_velocity(id, oldvelo);
create_velocity_vector(id , attacker , vec);
vec[0] += oldvelo[0];
vec[1] += oldvelo[1];
set_user_velocity(id , vec);
}
if(weapon == CSW_KNIFE && g_knife4[attacker])
{
new Float:vec[3];
new Float:oldvelo[3];
get_user_velocity(id, oldvelo);
create_velocity_vector(id , attacker , vec);
vec[0] += oldvelo[0];
vec[1] += oldvelo[1];
set_user_velocity(id , vec);
}
if(weapon == CSW_KNIFE && g_knife5[attacker])
{
new Float:vec[3];
new Float:oldvelo[3];
get_user_velocity(id, oldvelo);
create_velocity_vector(id , attacker , vec);
vec[0] += oldvelo[0];
vec[1] += oldvelo[1];
set_user_velocity(id , vec);
}
return PLUGIN_CONTINUE;
}
stock create_velocity_vector(victim,attacker,Float:velocity[3])
{
if(!zp_get_user_zombie(victim) || !is_user_alive(attacker))
return 0;
new Float:vicorigin[3];
new Float:attorigin[3];
entity_get_vector(victim , EV_VEC_origin , vicorigin);
entity_get_vector(attacker , EV_VEC_origin , attorigin);
new Float:origin2[3]
origin2[0] = vicorigin[0] - attorigin[0];
origin2[1] = vicorigin[1] - attorigin[1];
new Float:largestnum = 0.0;
if(floatabs(origin2[0])>largestnum) largestnum = floatabs(origin2[0]);
if(floatabs(origin2[1])>largestnum) largestnum = floatabs(origin2[1]);
origin2[0] /= largestnum;
origin2[1] /= largestnum;
if (g_knife1[attacker])
{
velocity[0] = ( origin2[0] * (get_pcvar_float(cvar_knife1_knock) * 3000) ) / get_entity_distance(victim , attacker);
velocity[1] = ( origin2[1] * (get_pcvar_float(cvar_knife1_knock) * 3000) ) / get_entity_distance(victim , attacker);
}
if (g_knife2[attacker])
{
velocity[0] = ( origin2[0] * (get_pcvar_float(cvar_knife2_knock) * 3000) ) / get_entity_distance(victim , attacker);
velocity[1] = ( origin2[1] * (get_pcvar_float(cvar_knife2_knock) * 3000) ) / get_entity_distance(victim , attacker);
}
if (g_knife3[attacker])
{
velocity[0] = ( origin2[0] * (get_pcvar_float(cvar_knife3_knock) * 3000) ) / get_entity_distance(victim , attacker);
velocity[1] = ( origin2[1] * (get_pcvar_float(cvar_knife3_knock) * 3000) ) / get_entity_distance(victim , attacker);
}
if (g_knife4[attacker])
{
velocity[0] = ( origin2[0] * (get_pcvar_float(cvar_knife4_knock) * 3000) ) / get_entity_distance(victim , attacker);
velocity[1] = ( origin2[1] * (get_pcvar_float(cvar_knife4_knock) * 3000) ) / get_entity_distance(victim , attacker);
}
if (g_knife5[attacker])
{
velocity[0] = ( origin2[0] * (get_pcvar_float(cvar_knife5_knock) * 3000) ) / get_entity_distance(victim , attacker);
velocity[1] = ( origin2[1] * (get_pcvar_float(cvar_knife5_knock) * 3000) ) / get_entity_distance(victim , attacker);
}
if(velocity[0] <= 20.0 || velocity[1] <= 20.0)
velocity[2] = random_float(200.0 , 275.0);
return 1;
}