zp extra items

Šiame forume rašomi vartotojų klausimai/problemos su kuriomis jie susidūrė kuriant pluginus.
Post Reply
KaimyneliS
Jau po truputį tampa savu
Posts: 164
Joined: 2015 Dec 24 14:55
Location: Kaunas

zp extra items

Post by KaimyneliS »

Iskilo problema kad plante ikirtus i deze ji sprogsta ir kartu mane uzmusa, reiktu kad dezes nesprogtu

Kodas: Select all

/* Plugin generated by AMXX-Studio */#pragma compress 1 #include <amxmodx>#include <engine>#include <fakemeta>#include <fakemeta_util>#include <hamsandwich>#include <xs>#include <zombieplague> #define PLUGIN "CSO Dual Sword Phantom Slayer"#define VERSION "1.0"#define AUTHOR "Natasha aka Asdian" #define CSW_DPS CSW_KNIFE#define weapon_dps "weapon_knife" #define v_model "models/v_dualsword.mdl"#define p_model "models/p_dualsword_a.mdl"#define p_model2 "models/p_dualsword_b.mdl"#define spr_wpn "knife_dualsword" new const weapon_sound[][] ={    "weapons/dualsword_stab1.wav",              // 0    "weapons/dualsword_stab2.wav",              // 1    "weapons/dualsword_stab1_hit.wav",          // 2    "weapons/dualsword_stab2_hit.wav",          // 3    "weapons/katanad_hitwall.wav",              // 4        "weapons/dualsword_slash_1.wav",            // 5    "weapons/dualsword_slash_2.wav",            // 6    "weapons/dualsword_slash_3.wav",            // 7    "weapons/dualsword_slash_4.wav",            // 8    "weapons/dualsword_hit1.wav",               // 9    "weapons/dualsword_hit2.wav",               // 10    "weapons/dualsword_hit3.wav",               // 11    "weapons/dualsword_slash_4_1.wav",          // 12    "weapons/dualsword_slash_4_2.wav",          // 13    "weapons/dualsword_skill_end.wav",          // 14        "weapons/dualsword_fly1.wav",               // 15    "weapons/dualsword_fly2.wav",               // 16    "weapons/dualsword_fly3.wav",               // 17    "weapons/dualsword_fly4.wav",               // 18    "weapons/dualsword_fly5.wav",               // 19    "weapons/dualsword_skill_start.wav"} //Hit#define RESULT_HIT_NONE             0#define RESULT_HIT_PLAYER           1#define RESULT_HIT_WORLD            2 enum _:WpnAnim{    ANIM_IDLEA = 0,    ANIM_SLASH1,    ANIM_SLASH2,    ANIM_SLASH3,    ANIM_SLASH4,    ANIM_SLASHEND,    ANIM_DRAWA,    ANIM_IDLEB,    ANIM_STAB1,    ANIM_STAB2,    ANIM_STABEND,    ANIM_DRAWB} new g_had_dps[33], g_mode[33], g_slashend[33], g_check[33], g_dps, g_soundmode[33]new ef_sakura[4]new Float:g_Sound[33] new cvar_damage_slash[4], cvar_slash_radius, cvar_slash_rangenew cvar_damage_stab[2], cvar_stab_radius, cvar_stab_rangenew cvar_damage_special, cvar_special_rangenew cvar_knockback[3], cvar_fast_attack, cvar_remove, cvar_spr public plugin_init() {    register_plugin(PLUGIN, VERSION, AUTHOR)        register_event("CurWeapon", "Event_CurWeapon", "be", "1=1")    register_message(get_user_msgid("DeathMsg"), "message_DeathMsg")    register_event("HLTV", "Event_NewRound", "a", "1=0", "2=0")    register_forward(FM_AddToFullPack, "Fw_AddToFullPack_Post", 1);     register_think("dps_entytyd", "Fw_DPSEnt_Think")        RegisterHam(Ham_Item_PostFrame, weapon_dps, "fw_Item_PostFrame")        g_dps = zp_register_extra_item("Dual Sword Phantom Slayer", 0, ZP_TEAM_HUMAN)    register_clcmd(spr_wpn, "hook_rb")        cvar_damage_slash[0] = register_cvar("dps_slashdamage_4","486.0")    cvar_damage_slash[1] = register_cvar("dps_slashdamage_1","120.0")    cvar_damage_slash[2] = register_cvar("dps_slashdamage_2","140.0")    cvar_damage_slash[3] = register_cvar("dps_slashdamage_3","360.0")    cvar_slash_radius = register_cvar("dps_slashradius","120.0")    cvar_slash_range = register_cvar("dps_slashrange","95.0")        cvar_damage_stab[0] = register_cvar("dps_stabdamage_2","1200.0")    cvar_damage_stab[1] = register_cvar("dps_stabdamage_1","350.0")    cvar_stab_radius = register_cvar("dps_stabradius","90.0")    cvar_stab_range = register_cvar("dps_stabrange","150.0")        cvar_damage_special = register_cvar("dps_specialdamage","95.0")    cvar_special_range = register_cvar("dps_specialrange","120.0")        cvar_knockback[0] = register_cvar("dps_slashknockback","0.0")    cvar_knockback[1] = register_cvar("dps_stabknockback","0.0")    cvar_knockback[2] = register_cvar("dps_specialknockback","0.0")        cvar_fast_attack = register_cvar("dps_fast_attack_enabled", "0")    cvar_remove = register_cvar("dps_remove_onnewround", "0")    cvar_spr = register_cvar("dps_enable_sprites", "1")        g_dps = zp_register_extra_item("Dual Sword Phantom Slayer", 10, ZP_TEAM_HUMAN)} public plugin_precache(){    precache_model(v_model)    precache_model(p_model)    precache_model(p_model2)        for(new i = 0; i < sizeof(weapon_sound); i++)        precache_sound(weapon_sound[i])        precache_model("models/dualswordfx.mdl")    precache_model("models/dualsword_skill.mdl")    precache_model("models/dualsword_skillfx1.mdl")    precache_model("models/dualsword_skillfx2.mdl")        ef_sakura[0] = precache_model("sprites/leaf01_dualsword.spr")    ef_sakura[1] = precache_model("sprites/leaf02_dualsword.spr")    ef_sakura[2] = precache_model("sprites/petal01_dualsword.spr")    ef_sakura[3] = precache_model("sprites/petal02_dualsword.spr")        new Txt[32]    format(Txt, 31, "sprites/%s.txt", spr_wpn)    engfunc(EngFunc_PrecacheGeneric, Txt)} public zp_extra_item_selected(i, d) if(d == g_dps) get_dps(i)public zp_user_infected_post(i) remove_dps(i)public zp_user_humanized_post(i) remove_dps(i) public hook_rb(id){    engclient_cmd(id, weapon_dps)    return PLUGIN_HANDLED} public get_dps(id){    if (!is_user_alive(id))        return     g_had_dps[id] = 1    g_mode[id] = 0    g_slashend[id] = 0    g_check[id] = 0    g_soundmode[id] = 0        fm_give_item(id, weapon_dps)        if (get_user_weapon(id) == CSW_DPS) Event_CurWeapon(id)    else engclient_cmd(id,weapon_dps)} public client_connect(id) remove_dps(id)public client_disconnect(id) remove_dps(id) public Event_NewRound(){    if(!get_pcvar_num(cvar_remove))        return        for(new i = 0; i < get_maxplayers(); i++)        remove_dps(i)} public remove_dps(id){    g_had_dps[id] = 0    g_slashend[id] = 0    g_check[id] = 0        static iEnt; iEnt = fm_get_user_weapon_entity(id, CSW_DPS)    if(!pev_valid(iEnt)) return        set_pev(iEnt, pev_iuser1, 0)    set_pev(iEnt, pev_iuser2, 0)    set_pev(iEnt, pev_iuser3, 0)    set_pev(iEnt, pev_iuser4, 0)    set_pev(iEnt, pev_fuser1, 0.0)} public Event_CurWeapon(id){    if(!is_user_alive(id))        return 1    if(get_user_weapon(id) != CSW_DPS)        return 1    if(!g_had_dps[id])        return 1    if(zp_get_user_zombie(id))        return 1            set_pev(id, pev_viewmodel2, v_model)    set_pev(id, pev_weaponmodel2, g_mode[id] ? p_model2:p_model)        Set_WeaponAnim(id, g_mode[id]?ANIM_DRAWA:ANIM_DRAWB)        static iEnt; iEnt = fm_get_user_weapon_entity(id, CSW_DPS)    if(!pev_valid(iEnt)) return 1        set_pev(iEnt, pev_iuser1, 0)    set_pev(iEnt, pev_iuser2, 0)    set_pev(iEnt, pev_iuser3, 0)    set_pev(iEnt, pev_iuser4, 0)    set_pev(iEnt, pev_fuser1, 0.0)            g_slashend[id] = 0    g_check[id] = 0        set_pdata_float(id, 83, 0.23)    set_pdata_float(iEnt, 46, 0.25);    set_pdata_float(iEnt, 47, 0.25);    set_pdata_float(iEnt, 48, 0.25);        if(get_pcvar_num(cvar_spr))    {        message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("WeaponList"), _, id)        write_string(g_had_dps[id] == 1 ? spr_wpn : weapon_dps)        write_byte(-1)        write_byte(-1)        write_byte(-1)        write_byte(-1)        write_byte(2)        write_byte(1)        write_byte(CSW_DPS)        write_byte(0)        message_end()    }    return 0} public message_DeathMsg(msg_id, msg_dest, msg_ent){    new szWeapon[64]    get_msg_arg_string(4, szWeapon, charsmax(szWeapon))        if (strcmp(szWeapon, "knife"))        return PLUGIN_CONTINUE     new iEntity = get_pdata_cbase(get_msg_arg_int(1), 373)    if (!pev_valid(iEntity) || get_pdata_int(iEntity, 43, 4) != CSW_DPS || !g_had_dps[get_msg_arg_int(1)])        return PLUGIN_CONTINUE     set_msg_arg_string(4, "dualsword")    return PLUGIN_CONTINUE} public Fw_AddToFullPack_Post(esState, iE, iEnt, iHost, iHostFlags, iPlayer, pSet){    if (!pev_valid(iEnt))        return;    if (pev(iEnt, pev_flags) & FL_KILLME)         return;     new classname[32];    pev(iEnt, pev_classname, classname, 31);     if (equal(classname,"dps_entytyd") && pev(iEnt, pev_iuser4))    {        if (iHost != pev(iEnt, pev_owner))            set_es(esState, ES_Effects, (get_es(esState, ES_Effects) | EF_NODRAW));    }} public Fw_DPSEnt_Think(iEnt){    if(!pev_valid(iEnt))         return        new iOwner    iOwner = pev(iEnt, pev_owner)        if(!is_user_alive(iOwner) || !is_user_connected(iOwner) || zp_get_user_zombie(iOwner))    {        remove_entity(iEnt)        g_soundmode[iOwner] = 0        return    }        if(!Get_Entity_Mode(iEnt))    {        new iWpn,iState,Float:vecOrigin[3], Float:vecAngle[3];        iWpn = pev(iEnt, pev_iuser1)        iState = pev(iWpn, pev_iuser4)        Stock_Get_Postion(iOwner, 0.0, 0.0, 0.0, vecOrigin);                pev(iOwner, pev_v_angle, vecAngle);        vecAngle[0] = -vecAngle[0];                set_pev(iEnt, pev_origin, vecOrigin);        set_pev(iEnt, pev_angles, vecAngle);                if(!iState || get_user_weapon(iOwner) != CSW_DPS)        {            new Float:fRenderAmount;            pev(iEnt, pev_renderamt, fRenderAmount);             fRenderAmount -= 4.5;             if (fRenderAmount <= 5.0)            {                remove_entity(iEnt);                return;            }            set_pev(iEnt, pev_renderamt, fRenderAmount);        }    }        if(Get_Entity_Mode(iEnt) == 1)    {        set_pev(iEnt, pev_movetype, MOVETYPE_FLY)            static Float:Origin[3]; pev(iOwner, pev_origin, Origin)        Origin[2] -= 25.0                Stock_Hook_Ent(iEnt, Origin, 0.01)                if(pev(iEnt, pev_fuser1) < get_gametime() || !IsAlive(iOwner))        {            set_pev(iEnt, pev_flags, pev(iEnt, pev_flags) | FL_KILLME)            return        }                    set_pev(iEnt, pev_velocity, Float:{1.0,1.0,1.0});        set_pev(iEnt, pev_origin, Origin);    }        if(Get_Entity_Mode(iEnt) == 2)    {        new Float:vecOrigin[3]        GetGunPosition(iOwner, vecOrigin);                new Float:fOldOrigin[3];        pev(iEnt, pev_oldorigin, fOldOrigin);                new Float:vecNewOrigin[3];        pev(iEnt, pev_origin, vecNewOrigin);                new Float:vecfff[3];        xs_vec_sub(vecOrigin, fOldOrigin, vecfff);        xs_vec_add(vecNewOrigin, vecfff, vecNewOrigin);                set_pev(iEnt, pev_origin, vecNewOrigin);        set_pev(iEnt, pev_oldorigin, vecOrigin);                if (pev(iEnt, pev_iuser1) == 2)        {            new Float:fDist = get_distance_f(vecOrigin, vecNewOrigin);            if (fDist > 175.0 * 0.5)            {                remove_entity(iEnt);                return;            }        }                if(g_Sound[iOwner] < get_gametime())        {            if(!g_soundmode[iOwner]) emit_sound(iOwner, CHAN_ITEM, weapon_sound[random_num(15,19)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)            if(g_soundmode[iOwner] == 1) emit_sound(iOwner, CHAN_BODY, weapon_sound[random_num(15,19)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)            if(g_soundmode[iOwner] == 2) emit_sound(iOwner, CHAN_VOICE, weapon_sound[random_num(15,19)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)            if(g_soundmode[iOwner] == 3) emit_sound(iOwner, CHAN_WEAPON, weapon_sound[random_num(15,19)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)                        g_soundmode[iOwner]++            if(g_soundmode[iOwner] > 3) g_soundmode[iOwner] = 0                        g_Sound[iOwner] = get_gametime()+0.088;        }    }    set_pev(iEnt, pev_nextthink, get_gametime() + 0.01)        if(Get_Entity_Mode(iEnt) == 2)    {        new Float:fTimeLast;        pev(iEnt, pev_fuser1, fTimeLast);                if (fTimeLast < get_gametime() || pev(pev(iEnt, pev_iuser2), pev_fuser1) < get_gametime())        {            if (pev(iEnt, pev_iuser1) == 1)            {                new Float:fRenderAmount;                pev(iEnt, pev_renderamt, fRenderAmount);                fRenderAmount -= 7.5;                                if (fRenderAmount <= 5.0)                {                    remove_entity(iEnt);                    return;                }                set_pev(iEnt, pev_renderamt, fRenderAmount);            } else remove_entity(iEnt);                        g_soundmode[iOwner] = 0        }    }} public fw_Item_PostFrame(ent){    new id = pev(ent, pev_owner)        if(!is_user_connected(id))        return HAM_IGNORED    if(get_user_weapon(id) != CSW_DPS || !g_had_dps[id])        return HAM_IGNORED     if(get_pdata_float(ent, 48, 4) <= 0.01 && (!pev(ent, pev_iuser2) || !g_slashend[id]))    {        if(g_check[id] < 6) g_check[id] = 0        set_pev(ent, pev_iuser3, 0)        Set_WeaponAnim(id, g_mode[id]?ANIM_IDLEA:ANIM_IDLEB)        set_pdata_float(ent, 48, 4.03, 4)    }        new iButton = pev(id,pev_button)    return AurezBotac(id, ent, iButton)} public AurezBotac(id, iEnt, iButton){    new iState = pev(iEnt, pev_iuser3)    new iState2 = pev(iEnt, pev_iuser2)    new iSlash = pev(iEnt, pev_iuser4)    new Float:fSound; pev(iEnt, pev_fuser1, fSound)    new Float:fRange = get_pcvar_float(g_mode[id] ? cvar_slash_range : cvar_stab_range)        if(!(iButton & IN_ATTACK) && get_pdata_float(iEnt, 46,4) <= 0.0 && iState2)    {        if(!iState || iState == 1)        {            Set_WeaponAnim(id, ANIM_STABEND)            set_pev(iEnt, pev_iuser2, 0)            set_pdata_float(iEnt, 48, 1.45,4)        }    }        if(!(iButton & IN_ATTACK2) && get_pdata_float(iEnt, 47,4) <= 0.0 && g_slashend[id])    {        Set_WeaponAnim(id, ANIM_SLASHEND)        set_pdata_float(iEnt, 48, 2.03,4)        g_slashend[id] = 0    }        if (get_pdata_float(id, 83) <= 0.0 && pev(iEnt, pev_iuser1))    {        new Float:fAngle = get_pcvar_float(g_mode[id] ? cvar_slash_radius : cvar_stab_radius)        new Float:fDamage = get_pcvar_float(g_mode[id] ? cvar_damage_slash[iSlash] : cvar_damage_stab[iState])                new iHitResult = KnifeAttack_Global(id, true, fRange, fAngle, fDamage, get_pcvar_float(cvar_knockback[1+g_mode[id]]))        switch (iHitResult)        {            case RESULT_HIT_PLAYER : client_cmd(id, "spk %s", weapon_sound[g_mode[id]?random_num(9,11):iState+2])             case RESULT_HIT_WORLD : client_cmd(id, "spk %s", weapon_sound[4])        }        set_pev(iEnt, pev_iuser1, 0);    }        if(get_pdata_float(iEnt, 47,4) <= 0.0 && iSlash && iSlash <= 4)    {        set_pev(iEnt, pev_iuser4, 1 + iSlash)        Set_WeaponAnim(id, 1 + iSlash)                set_pdata_float(id, 83, 0.06)                if(!get_pcvar_num(cvar_fast_attack))             set_pdata_float(iEnt, 46, iSlash == 3 ? (g_check[id] == 5 ? 0.43 : 0.7) : 0.13,4);                set_pdata_float(iEnt, 47, iSlash == 3 ? (g_check[id] == 5 ? 0.43 : 0.7) : 0.13,4);        set_pdata_float(iEnt, 48, iSlash == 3 ? 1.4 : 1.0,4);                  set_pev(iEnt, pev_iuser1, 1)        set_pev(iEnt, pev_fuser4, get_gametime() + get_pdata_float(id, 83))        SendSound(id, CHAN_WEAPON, weapon_sound[5 + iSlash])        Create_Slash(id,iEnt,iSlash)                if(iSlash == 3)         {            g_slashend[id] = 1                        set_pev(iEnt, pev_fuser1, get_gametime() + (g_check[id] == 5 ? 0.43 : 0.5))            set_pev(iEnt, pev_iuser4, 0)        }    }        if(fSound && fSound < get_gametime())    {        SendSound(id,CHAN_VOICE,weapon_sound[g_check[id] == 5 ? 13 : 12])        set_pev(iEnt, pev_fuser1, 0.0)                if(g_check[id] == 5)         {            Set_WeaponAnim(id, 14)            SendSound(id,CHAN_ITEM,weapon_sound[20])            g_check[id] = 6                        set_pdata_float(iEnt, 46, 1.03,4)            set_pdata_float(iEnt, 47, 1.03,4)            set_pdata_float(iEnt, 48, 1.03,4)                        set_pev(iEnt, pev_fuser4, get_gametime()+1.7);            DPS_Special(id, 0, 2.0)        }    }        if(g_check[id] == 6 && get_pdata_float(iEnt, 46,4) <= 0.0)    {        set_pdata_float(iEnt, 46, 11.36,4)        set_pdata_float(iEnt, 47, 11.36,4)        set_pdata_float(iEnt, 48, 11.36,4)                g_check[id] = 7        set_pev(iEnt, pev_fuser1, get_gametime() + 10.6)        Set_WeaponAnim(id, 15)    }        // NANI?!    if(g_check[id] == 7 && fSound && fSound < get_gametime())    {        SendSound(id,CHAN_VOICE,weapon_sound[14])        set_pev(iEnt, pev_fuser1, 0.0)        g_check[id] = 0                DPS_Special(id, 1, 1.46)    }        DPS_RealSpecial(id, iEnt, fRange)        if(iButton & IN_ATTACK && get_pdata_float(iEnt, 46,4) <= 0.0)    {        g_mode[id] = 0        g_slashend[id] = 0                set_pev(iEnt, pev_iuser2, 1)        set_pev(iEnt, pev_iuser4, 0)                switch(iState)        {            case 0:            {                set_pdata_float(id, 83, 0.16)                set_pdata_float(iEnt, 46, 0.4,4);                                if(!get_pcvar_num(cvar_fast_attack))                     set_pdata_float(iEnt, 47, 0.4,4);                                    set_pdata_float(iEnt, 48, 1.0,4);                                set_pev(iEnt, pev_iuser1, 1)                set_pev(iEnt, pev_iuser3, 1)                set_pev(iEnt, pev_fuser4, get_gametime() + get_pdata_float(id, 83))                                Set_WeaponAnim(id, ANIM_STAB1)                SendSound(id, CHAN_WEAPON, weapon_sound[0])                                if(!g_check[id]) g_check[id] = 1                else if(g_check[id] == 2) g_check[id] = 3                else g_check[id] = 0            }            case 1:            {                set_pdata_float(id, 83, 0.16)                set_pdata_float(iEnt, 46, 0.83,4);                                if(!get_pcvar_num(cvar_fast_attack))                     set_pdata_float(iEnt, 47, 0.83,4);                                set_pdata_float(iEnt, 48, 1.5,4);                                set_pev(iEnt, pev_iuser1, 1)                set_pev(iEnt, pev_iuser3, 0)                set_pev(iEnt, pev_fuser4, get_gametime() + get_pdata_float(id, 83))                                Set_WeaponAnim(id, ANIM_STAB2)                SendSound(id, CHAN_WEAPON, weapon_sound[1])                                if(g_check[id] == 3) g_check[id] = 4                else g_check[id] = 0            }        }    }        if(iButton & IN_ATTACK2 && get_pdata_float(iEnt, 47) <= 0.0 && !iSlash)    {        g_mode[id] = 1                set_pdata_float(id, 83, 0.04)                if(!get_pcvar_num(cvar_fast_attack))             set_pdata_float(iEnt, 46, 0.13,4);                set_pdata_float(iEnt, 47, 0.13,4);        set_pdata_float(iEnt, 48, 0.5,4);                set_pev(iEnt, pev_iuser1, 1)        set_pev(iEnt, pev_iuser2, 0)        set_pev(iEnt, pev_iuser3, 0)        set_pev(iEnt, pev_iuser4, 1)        set_pev(iEnt, pev_fuser4, get_gametime() + get_pdata_float(id, 83))                Set_WeaponAnim(id, ANIM_SLASH1)        SendSound(id, CHAN_WEAPON, weapon_sound[5])                Create_Slash(id,iEnt,0)                if(g_check[id] == 1) g_check[id] = 2        else if(g_check[id] == 4) g_check[id] = 5        else g_check[id] = 0    }        iButton &= ~IN_ATTACK;    iButton &= ~IN_ATTACK2;    set_pev(id, pev_button, iButton);    return HAM_IGNORED} stock Create_Slash(id,iEnt,seq){    new Float:vecOrigin[3], Float:vecAngle[3];    GetGunPosition(id, vecOrigin);    pev(id, pev_v_angle, vecAngle);    vecAngle[0] = -vecAngle[0];        new pEntity = DPS_Entites(id,"models/dualswordfx.mdl",vecOrigin,vecOrigin,0.01,SOLID_NOT,seq)            // Set info for ent     Set_Entity_Mode(pEntity, 0)    set_pev(pEntity, pev_scale, 0.1);    set_pev(pEntity, pev_iuser1, iEnt);    set_pev(pEntity, pev_velocity, Float:{0.01,0.01,0.01});    set_pev(pEntity, pev_angles, vecAngle);    set_pev(pEntity, pev_nextthink, get_gametime()+0.01);} stock DPS_Special(id, seq, Float:fTime){    new Float:VecOrig[3], Float:VecAng[3]    pev(id, pev_origin, VecOrig)    pev(id, pev_angles, VecAng)        new iEfx = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))    set_pev(iEfx, pev_classname, "dps_entytyd");    set_pev(iEfx, pev_origin, VecOrig)    set_pev(iEfx, pev_frame, 0.0)    set_pev(iEfx, pev_animtime, get_gametime())    set_pev(iEfx, pev_framerate, 1.0)    set_pev(iEfx, pev_sequence, seq)    engfunc(EngFunc_SetModel, iEfx, "models/dualsword_skill.mdl")    dllfunc(DLLFunc_Spawn, iEfx)    Set_Entity_Mode(iEfx, 1)    set_pev(iEfx, pev_angles, VecAng)    set_pev(iEfx, pev_solid, SOLID_NOT)    set_pev(iEfx, pev_owner, id)    set_pev(iEfx, pev_velocity, Float:{0.01,0.01,0.01});    set_pev(iEfx, pev_fuser1, get_gametime() + fTime)    set_pev(iEfx, pev_nextthink, get_gametime() + 0.01)} stock DPS_RealSpecial(id, iEnt, Float:fRange){    new Float:fTimeEffect;    pev(iEnt, pev_fuser4, fTimeEffect);        if (g_check[id] == 7 && fTimeEffect && fTimeEffect <= get_gametime())    {        KnifeAttack_Global(id, false, get_pcvar_float(cvar_special_range)*2.0, 180.0, get_pcvar_float(cvar_damage_special), get_pcvar_float(cvar_knockback[2]))                    new Float:vecOrigin3[2][3], Float:vecOrigin[3];        pev(id, pev_origin, vecOrigin3[0]);        pev(id, pev_origin, vecOrigin);        xs_vec_copy(vecOrigin3[0], vecOrigin3[1]);                new Float:fFloat = random_float(fRange * -0.85, fRange * 0.85);        vecOrigin3[0][2] = vecOrigin3[1][2] = vecOrigin3[0][2] + random_float(-5.0, 65.0);                switch (random(3))        {            case 0:            {                vecOrigin3[0][0] += fFloat*random_float(-1.0, 1.0);                vecOrigin3[0][1] += fFloat*random_float(-1.0, 1.0);                                vecOrigin3[1][0] -= fFloat*random_float(-1.0, 1.0);                vecOrigin3[1][1] -= fFloat*random_float(-1.0, 1.0);            }            case 1:            {                vecOrigin3[0][0] += fFloat*random_float(-1.0, 1.0);                vecOrigin3[0][1] -= fFloat*random_float(-1.0, 1.0);                                vecOrigin3[1][0] -= fFloat*random_float(-1.0, 1.0);                vecOrigin3[1][1] += fFloat*random_float(-1.0, 1.0);            }            case 2:            {                vecOrigin3[0][0] -= fFloat*random_float(-1.0, 1.0);                vecOrigin3[0][1] += fFloat*random_float(-1.0, 1.0);                                vecOrigin3[1][0] += fFloat*random_float(-1.0, 1.0);                vecOrigin3[1][1] -= fFloat*random_float(-1.0, 1.0);            }            case 3:            {                vecOrigin3[0][0] -= fFloat*random_float(-1.0, 1.0);                vecOrigin3[0][1] -= fFloat*random_float(-1.0, 1.0);                                vecOrigin3[1][0] += fFloat*random_float(-1.0, 1.0);                vecOrigin3[1][1] += fFloat*random_float(-1.0, 1.0);            }        }                if (random_num(0,9) > 8)        {            new Float:vecAngle2[3];            vecAngle2[0] = random_num(0,1) ? random_float(-30.0, -15.0) : random_float(15.0, 30.0);            vecAngle2[1] = random_num(0,1) ? random_float(-180.0, 0.0) : random_float(0.0, 180.0);                        new pEntity = DPS_Entites(id,"models/dualsword_skillfx1.mdl",vecOrigin3[0],vecOrigin3[0],0.01,SOLID_NOT,0)              set_pev(pEntity, pev_angles, vecAngle2);            set_pev(pEntity, pev_velocity, Float:{0.01,0.01,0.01});            set_pev(pEntity, pev_iuser1, 1);            set_pev(pEntity, pev_iuser2, iEnt);            set_pev(pEntity, pev_frame, 0.0);            Set_Entity_Mode(pEntity, 2)            set_pev(pEntity, pev_fuser1, get_gametime()+0.53);            set_pev(pEntity, pev_fuser2, get_gametime()+0.5);            set_pev(pEntity, pev_fuser3, get_gametime()+0.31);            set_pev(pEntity, pev_oldorigin, vecOrigin);            set_pev(pEntity, pev_nextthink, get_gametime()+0.01);        }                new pEntity = DPS_Entites(id,"models/dualsword_skillfx2.mdl",vecOrigin3[0],vecOrigin3[1],500.0,SOLID_TRIGGER,0)         set_pev(pEntity, pev_iuser1, 2);        set_pev(pEntity, pev_iuser2, iEnt);        Set_Entity_Mode(pEntity, 2)        set_pev(pEntity, pev_frame, 0.0);        set_pev(pEntity, pev_oldorigin, vecOrigin);        set_pev(pEntity, pev_fuser1, get_gametime()+0.2);        set_pev(pEntity, pev_fuser2, get_gametime()+0.5);        set_pev(pEntity, pev_fuser3, get_gametime()+0.3);        set_pev(pEntity, pev_nextthink, get_gametime()+0.01);                set_pev(iEnt, pev_fuser4, get_gametime()+0.05);    }} stock DPS_Entites(id, models[], Float:Start[3], Float:End[3], Float:speed, solid, seq, move=MOVETYPE_FLY){    new pEntity = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));            // Set info for ent     set_pev(pEntity, pev_movetype, move);    set_pev(pEntity, pev_owner, id);    engfunc(EngFunc_SetModel, pEntity, models);    set_pev(pEntity, pev_classname, "dps_entytyd");    set_pev(pEntity, pev_mins, Float:{-1.0, -1.0, -1.0});    set_pev(pEntity, pev_maxs, Float:{1.0, 1.0, 1.0});    set_pev(pEntity, pev_origin, Start);    set_pev(pEntity, pev_gravity, 0.01);    set_pev(pEntity, pev_solid, solid);        static Float:Velocity[3];    Stock_Get_Speed_Vector(Start, End, speed, Velocity);    set_pev(pEntity, pev_velocity, Velocity);     new Float:vecVAngle[3]; pev(id, pev_v_angle, vecVAngle);    vector_to_angle(Velocity, vecVAngle)        if(vecVAngle[0] > 90.0) vecVAngle[0] = -(360.0 - vecVAngle[0]);    set_pev(pEntity, pev_angles, vecVAngle);        set_pev(pEntity, pev_rendermode, kRenderTransAdd);    set_pev(pEntity, pev_renderamt, 255.0);    set_pev(pEntity, pev_sequence, seq)    set_pev(pEntity, pev_animtime, get_gametime());    set_pev(pEntity, pev_framerate, 1.0)    return pEntity;} stock Set_Entity_Mode(iEnt, mode) set_pev(iEnt, pev_iuser3, mode)stock Get_Entity_Mode(iEnt) return pev(iEnt,pev_iuser3) stock SendSound(id, chan, sample[]) emit_sound(id, chan, sample, VOL_NORM, ATTN_NORM, 0, PITCH_NORM) stock Stock_Get_Speed_Vector(const Float:origin1[3],const Float:origin2[3],Float:speed, Float:new_velocity[3]){    xs_vec_sub(origin2, origin1, new_velocity)    new Float:num = floatsqroot(speed*speed / (new_velocity[0]*new_velocity[0] + new_velocity[1]*new_velocity[1] + new_velocity[2]*new_velocity[2]))    xs_vec_mul_scalar(new_velocity, num, new_velocity)}stock GetGunPosition(id, Float:vecSrc[3]){    new Float:vecViewOfs[3];    pev(id, pev_origin, vecSrc);    pev(id, pev_view_ofs, vecViewOfs);    xs_vec_add(vecSrc, vecViewOfs, vecSrc);}stock KnifeAttack_Global(id, bStab, Float:flRange, Float:fAngle, Float:flDamage, Float:flKnockBack){    new iHitResult    if(fAngle > 0.0) iHitResult = KnifeAttack2(id, bStab, Float:flRange, Float:fAngle, Float:flDamage, Float:flKnockBack)    else iHitResult = KnifeAttack(id, bStab, Float:flRange, Float:flDamage, Float:flKnockBack)     return iHitResult} stock KnifeAttack(id, bStab, Float:flRange, Float:flDamage, Float:flKnockBack, iHitgroup = -1, bitsDamageType = DMG_NEVERGIB | DMG_CLUB){    new Float:vecSrc[3], Float:vecEnd[3], Float:v_angle[3], Float:vecForward[3];    GetGunPosition(id, vecSrc);     pev(id, pev_v_angle, v_angle);    engfunc(EngFunc_MakeVectors, v_angle);     global_get(glb_v_forward, vecForward);    xs_vec_mul_scalar(vecForward, flRange, vecForward);    xs_vec_add(vecSrc, vecForward, vecEnd);     new tr = create_tr2();    engfunc(EngFunc_TraceLine, vecSrc, vecEnd, 0, id, tr);     new Float:flFraction; get_tr2(tr, TR_flFraction, flFraction);    if (flFraction >= 1.0) engfunc(EngFunc_TraceHull, vecSrc, vecEnd, 0, 3, id, tr);        get_tr2(tr, TR_flFraction, flFraction);     new iHitResult = RESULT_HIT_NONE;        if (flFraction < 1.0)    {        new pEntity = get_tr2(tr, TR_pHit);        iHitResult = RESULT_HIT_WORLD;                if (pev_valid(pEntity) && (IsPlayer(pEntity) || IsHostage(pEntity)))        {            if (CheckBack(id, pEntity) && bStab && iHitgroup == -1)                flDamage *= 1.0;             iHitResult = RESULT_HIT_PLAYER;        }         if (pev_valid(pEntity))        {            engfunc(EngFunc_MakeVectors, v_angle);            global_get(glb_v_forward, vecForward);             if (iHitgroup != -1)                set_tr2(tr, TR_iHitgroup, iHitgroup);             ExecuteHamB(Ham_TraceAttack, pEntity, id, flDamage, vecForward, tr, bitsDamageType);            ExecuteHamB(Ham_TakeDamage, pEntity, id, id, flDamage, bitsDamageType)            Stock_Fake_KnockBack(id, pEntity, flKnockBack)                        if (IsAlive(pEntity))            {                free_tr2(tr);                return iHitResult;            }        }    }    free_tr2(tr);    return iHitResult;} stock KnifeAttack2(id, bStab, Float:flRange, Float:fAngle, Float:flDamage, Float:flKnockBack, iHitgroup = -1, bNoTraceCheck = 0){    new Float:vecOrigin[3], Float:vecSrc[3], Float:vecEnd[3], Float:v_angle[3], Float:vecForward[3];    pev(id, pev_origin, vecOrigin);     new iHitResult = RESULT_HIT_NONE;    GetGunPosition(id, vecSrc);     pev(id, pev_v_angle, v_angle);    engfunc(EngFunc_MakeVectors, v_angle);     global_get(glb_v_forward, vecForward);    xs_vec_mul_scalar(vecForward, flRange, vecForward);    xs_vec_add(vecSrc, vecForward, vecEnd);     new tr = create_tr2();    engfunc(EngFunc_TraceLine, vecSrc, vecEnd, 0, id, tr);        new Float:EndPos2[3]    get_tr2(tr, TR_vecEndPos, EndPos2)        new Float:flFraction; get_tr2(tr, TR_flFraction, flFraction);    if (flFraction < 1.0)     {        iHitResult = RESULT_HIT_WORLD;        if(bStab) Stock_SakuraEffect(id, EndPos2)    }        new Float:vecEndZ = vecEnd[2];        new pEntity = -1;    while ((pEntity = engfunc(EngFunc_FindEntityInSphere, pEntity, vecOrigin, flRange)) != 0)    {        if (!pev_valid(pEntity))            continue;        if (id == pEntity)            continue;        if (!IsAlive(pEntity))            continue;        if (!CheckAngle(id, pEntity, fAngle))            continue;         GetGunPosition(id, vecSrc);        Stock_Get_Origin(pEntity, vecEnd);         vecEnd[2] = vecSrc[2] + (vecEndZ - vecSrc[2]) * (get_distance_f(vecSrc, vecEnd) / flRange);         xs_vec_sub(vecEnd, vecSrc, vecForward);        xs_vec_normalize(vecForward, vecForward);        xs_vec_mul_scalar(vecForward, flRange, vecForward);        xs_vec_add(vecSrc, vecForward, vecEnd);         engfunc(EngFunc_TraceLine, vecSrc, vecEnd, 0, id, tr);        get_tr2(tr, TR_flFraction, flFraction);         if (flFraction >= 1.0) engfunc(EngFunc_TraceHull, vecSrc, vecEnd, 0, 3, id, tr);        get_tr2(tr, TR_flFraction, flFraction);         if (flFraction < 1.0)        {            if (IsPlayer(pEntity) || IsHostage(pEntity))            {                iHitResult = RESULT_HIT_PLAYER;                if(bStab) Stock_SakuraEffect(id, vecEnd)                                if (CheckBack(id, pEntity) && bStab && iHitgroup == -1)                    flDamage *= 1.0;            }             if (get_tr2(tr, TR_pHit) == pEntity || bNoTraceCheck)            {                engfunc(EngFunc_MakeVectors, v_angle);                global_get(glb_v_forward, vecForward);                 if (iHitgroup != -1) set_tr2(tr, TR_iHitgroup, iHitgroup);                 ExecuteHamB(Ham_TraceAttack, pEntity, id, flDamage, vecForward, tr, DMG_NEVERGIB | DMG_CLUB);                ExecuteHamB(Ham_TakeDamage, pEntity, id, id, flDamage, DMG_NEVERGIB | DMG_CLUB)                                Stock_Fake_KnockBack(id, pEntity, flKnockBack)            }        }        free_tr2(tr);    }    return iHitResult;} stock Set_WeaponAnim(id, anim){    set_pev(id, pev_weaponanim, anim)        message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, {0, 0, 0}, id)    write_byte(anim)    write_byte(pev(id, pev_body))    message_end()} stock Stock_Set_Vis(iEnt, iVis = 1)    set_pev(iEnt, pev_effects, iVis == 1 ? pev(iEnt, pev_effects) & ~EF_NODRAW : pev(iEnt, pev_effects) | EF_NODRAW) stock Stock_Hook_Ent(ent, Float:TargetOrigin[3], Float:Speed, mode=0){    static Float:fl_Velocity[3],Float:EntOrigin[3],Float:distance_f,Float:fl_Time    pev(ent, pev_origin, EntOrigin)        if(!mode)    {        distance_f = get_distance_f(EntOrigin, TargetOrigin)        fl_Time = distance_f / Speed                    pev(ent, pev_velocity, fl_Velocity)                    fl_Velocity[0] = (TargetOrigin[0] - EntOrigin[0]) / fl_Time        fl_Velocity[1] = (TargetOrigin[1] - EntOrigin[1]) / fl_Time        fl_Velocity[2] = (TargetOrigin[2] - EntOrigin[2]) / fl_Time         if(vector_length(fl_Velocity) > 1.0) set_pev(ent, pev_velocity, fl_Velocity)        else set_pev(ent, pev_velocity, Float:{0.01, 0.01, 0.01})    } else {        static Float:fl_EntVelocity[3], Float:fl_Acc[3]        Stock_Directed_Vector(TargetOrigin, EntOrigin, fl_Velocity)        xs_vec_mul_scalar(fl_Velocity, Speed, fl_Velocity)                for(new i =0; i<3; i++)        {            if(fl_Velocity[i] > fl_EntVelocity[i])             {                fl_Acc[i] = fl_Velocity[i]-fl_EntVelocity[i]                fl_Acc[i] = floatmin(70.0, fl_Acc[i])                fl_EntVelocity[i] += fl_Acc[i]            }            else if(fl_Velocity[i] < fl_EntVelocity[i])            {                fl_Acc[i] = fl_EntVelocity[i]-fl_Velocity[i]                fl_Acc[i] = floatmin(70.0, fl_Acc[i])                fl_EntVelocity[i] -= fl_Acc[i]            }        }        set_pev(ent, pev_velocity, fl_EntVelocity)    }} stock Stock_Directed_Vector(Float:start[3],Float:end[3],Float:reOri[3]){       new Float:v3[3],i    for(i=0;i<3;i++) v3[i]=start[i]-end[i]     new Float:vl = vector_length(v3)    for(i=0;i<3;i++) reOri[i] = v3[i] / vl} stock Stock_Get_Postion(id,Float:forw,Float:right,Float:up,Float:vStart[]){    static Float:vOrigin[3], Float:vAngle[3], Float:vForward[3], Float:vRight[3], Float:vUp[3]    pev(id, pev_origin, vOrigin)    pev(id, pev_view_ofs,vUp)    xs_vec_add(vOrigin,vUp,vOrigin)    pev(id, pev_v_angle, vAngle)        engfunc(EngFunc_AngleVectors, vAngle, vForward, vRight, vUp)        vStart[0] = vOrigin[0] + vForward[0] * forw + vRight[0] * right + vUp[0] * up    vStart[1] = vOrigin[1] + vForward[1] * forw + vRight[1] * right + vUp[1] * up    vStart[2] = vOrigin[2] + vForward[2] * forw + vRight[2] * right + vUp[2] * up} stock IsPlayer(pEntity) return is_user_connected(pEntity) stock IsHostage(pEntity){    new classname[32]; pev(pEntity, pev_classname, classname, charsmax(classname))    return equal(classname, "hostage_entity")} stock IsAlive(pEntity){    if (pEntity < 1) return 0    return (pev(pEntity, pev_deadflag) == DEAD_NO && pev(pEntity, pev_health) > 0)} stock CheckBack(iEnemy,id){    new Float:anglea[3], Float:anglev[3]    pev(iEnemy, pev_v_angle, anglea)    pev(id, pev_v_angle, anglev)    new Float:angle = anglea[1] - anglev[1]     if (angle < -180.0) angle += 360.0    if (angle <= 45.0 && angle >= -45.0) return 1    return 0} stock CheckAngle(iAttacker, iVictim, Float:fAngle)  return(Stock_CheckAngle(iAttacker, iVictim) > floatcos(fAngle,degrees)) stock Float:Stock_CheckAngle(id,iTarget){    new Float:vOricross[2],Float:fRad,Float:vId_ori[3],Float:vTar_ori[3],Float:vId_ang[3],Float:fLength,Float:vForward[3]    Stock_Get_Origin(id, vId_ori)    Stock_Get_Origin(iTarget, vTar_ori)        pev(id,pev_angles,vId_ang)    for(new i=0;i<2;i++) vOricross[i] = vTar_ori[i] - vId_ori[i]        fLength = floatsqroot(vOricross[0]*vOricross[0] + vOricross[1]*vOricross[1])        if (fLength<=0.0)    {        vOricross[0]=0.0        vOricross[1]=0.0    } else {        vOricross[0]=vOricross[0]*(1.0/fLength)        vOricross[1]=vOricross[1]*(1.0/fLength)    }        engfunc(EngFunc_MakeVectors,vId_ang)    global_get(glb_v_forward,vForward)        fRad = vOricross[0]*vForward[0]+vOricross[1]*vForward[1]    return fRad   //->   RAD 90' = 0.5rad} stock Stock_Get_Origin(id, Float:origin[3]){    new Float:maxs[3],Float:mins[3]    if (pev(id, pev_solid) == SOLID_BSP)    {        pev(id,pev_maxs,maxs)        pev(id,pev_mins,mins)        origin[0] = (maxs[0] - mins[0]) / 2 + mins[0]        origin[1] = (maxs[1] - mins[1]) / 2 + mins[1]        origin[2] = (maxs[2] - mins[2]) / 2 + mins[2]    } else pev(id, pev_origin, origin)} public Stock_Fake_KnockBack(id, iVic, Float:iKb){    if(iVic > 32) return        new Float:vAttacker[3], Float:vVictim[3], Float:vVelocity[3], flags    pev(id, pev_origin, vAttacker)    pev(iVic, pev_origin, vVictim)    vAttacker[2] = vVictim[2] = 0.0    flags = pev(id, pev_flags)        xs_vec_sub(vVictim, vAttacker, vVictim)    new Float:fDistance    fDistance = xs_vec_len(vVictim)    xs_vec_mul_scalar(vVictim, 1 / fDistance, vVictim)        pev(iVic, pev_velocity, vVelocity)    xs_vec_mul_scalar(vVictim, iKb, vVictim)    xs_vec_mul_scalar(vVictim, 50.0, vVictim)    vVictim[2] = xs_vec_len(vVictim) * 0.15        if(flags &~ FL_ONGROUND)    {        xs_vec_mul_scalar(vVictim, 1.2, vVictim)        vVictim[2] *= 0.4    }    if(xs_vec_len(vVictim) > xs_vec_len(vVelocity)) set_pev(iVic, pev_velocity, vVictim)}    stock Float:Stock_Get_Body_Dmg(iBody){    switch (iBody)    {        case HIT_GENERIC: return 0.75        case 1: return 4.0        case 2: return 1.0        case 3: return 1.25        case 4,5,6,7: return 0.75        default: return 0.75    }    return 1.0} stock Stock_SakuraEffect(id, Float:vecOri[3]){    engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vecOri)    write_byte(TE_BLOODSPRITE)    engfunc(EngFunc_WriteCoord,vecOri[0])    engfunc(EngFunc_WriteCoord,vecOri[1])    engfunc(EngFunc_WriteCoord,vecOri[2])    write_short(ef_sakura[g_mode[id]?2:0])    write_short(ef_sakura[g_mode[id]?3:1])    write_byte(g_mode[id]?178:128)    write_byte(random_num(2,3))    message_end()} stock can_damage(id1, id2){    if(id1 <= 0 || id1 >= 33 || id2 <= 0 || id2 >= 33)        return 1            // Check team    return(get_pdata_int(id1, 114) != get_pdata_int(id2, 114))} 
Ačiū kad padedate pradedančiajam :)

Image

Softero
Jau po truputį tampa savu
Posts: 174
Joined: 2016 Jan 17 20:11
Skype: Einartas10

Re: zp extra items

Post by Softero »

nuo 860 iki 877 eilučių ištrinkite kodą, tačiau nebeišeis suskaldyti stiklo, bei kitų fun_breakable objektų (įskaitant dėžes plante). Paprasčiausia išeitis, jei įmanoma, būtų aptikti sprogimo eventą ir jį užblokuoti, tačiau neturiu žalio supratimo kaip. Tačiau jei norite, galiu padaryti sistemą, į kurią sukėlus objektų indeksus, peilis jų nebesusprogdintų. Norint įtraukti, užtektų pažiūrėti į dėžę ir paspausti mygtuką. Jei sudomino, susisiekite paštu arba per discord. Dėl kainos susitarsime.
cs1.6 pluginų , bei web sistemų kūrimas
discord: Softero#0457
Email: Einartas1000@gmail.com

Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests