Ginklu zoomai...

Šiame forume rašomi vartotojų klausimai/problemos su kuriomis jie susidūrė kuriant pluginus.
Post Reply
Froza
Jau po truputį tampa savu
Posts: 111
Joined: 2012 Jul 12 19:47

Ginklu zoomai...

Post by Froza »

Sveiki,

Norėjau pasiklausti koki yra scout, awp arba auto snipers ginklų pavadinimai...

Man šitam pluginui reikia pakeisti zoom'ą, kad būtu ne augo, o scouto ar ten kito panašaus zoom gun...

Code: Select all

#include <amxmodx>#include <fakemeta>#include <hamsandwich>#include <xs>#include <gunxpmod>#include <engine>#include <cstrike> new PLUGIN_NAME[]   = "UNLOCK : Scout"new PLUGIN_AUTHOR[]     = "xbatista"new PLUGIN_VERSION[]    = "1.0" new const WEAPON_V_MDL[] = "models/gunxpmod/v_scout.mdl";new const WEAPON_W_MDL[] = "models/gunxpmod/w_scout.mdl"; #define WEAPON_CSW CSW_SCOUTnew const weapon_n[] = "weapon_scout"; const m_pPlayer = 41;const m_flPrimaryAttack = 46; #define IsPlayer(%1)  ( 1 <= %1 <= g_maxplayers ) new g_hasZoom[33]; new damage_weapon, pCvarRof, weapon_recoil;new g_maxplayers;   new bool:g_Weapon[33]; new szClip, szAmmo;new Float:cl_pushangle[33][3]; public plugin_init() {    register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)    register_gxm_item("Scout", "+Aim +Rate +Power ( Scout )", 200)0    damage_weapon = register_cvar("gxm_damage_scout","0.7"); // damage multiplier    pCvarRof = register_cvar( "scout_rof", "0.090" ); // weapon rof , 0.090 - fast    weapon_recoil = register_cvar( "scout_recoil", "0.01" ); // weapon recoil     register_event("CurWeapon", "Event_CurWeapon", "be", "1=1");        RegisterHam( Ham_Weapon_PrimaryAttack, weapon_n, "Fwd_AttackSpeedPost" , 1 );    RegisterHam( Ham_Weapon_PrimaryAttack, weapon_n, "Fwd_AttackSpeedPre");         RegisterHam( Ham_Item_Deploy , weapon_n, "Fwd_AttackSpeedPost", 1 );     RegisterHam(Ham_TakeDamage, "player", "Ham_DamageWeapon");     register_forward( FM_CmdStart, "Fwd_CmdStart" );     g_maxplayers = get_maxplayers();}public gxm_item_enabled(id) {    g_Weapon[id] = true;}public client_connect(id) {    g_Weapon[id] = false;}public plugin_precache()  {    engfunc(EngFunc_PrecacheModel, WEAPON_V_MDL);    engfunc(EngFunc_PrecacheModel, WEAPON_W_MDL);} public Fwd_AttackSpeedPre(Ent){    new id = pev(Ent,pev_owner);    entity_get_vector( id, EV_VEC_punchangle, cl_pushangle[id]);}public Fwd_AttackSpeedPost( const Entity ){    static id ; id = get_pdata_cbase(Entity, m_pPlayer, 4)    if (g_Weapon[id] && IsPlayer(id) )    {        set_pdata_float( Entity, m_flPrimaryAttack, get_pcvar_float( pCvarRof ), 4 );         new Float:push[3];        entity_get_vector( id, EV_VEC_punchangle, cl_pushangle[id]);        xs_vec_sub( push, cl_pushangle[id], push);        xs_vec_mul_scalar( push, get_pcvar_float( weapon_recoil ), push);        xs_vec_add( push, cl_pushangle[id], push);        entity_set_vector( id, EV_VEC_punchangle, push);    }} public Ham_DamageWeapon(id, inflictor, attacker, Float:damage, damagebits) {    if ( !IsPlayer(attacker) || !g_Weapon[attacker] )            return HAM_IGNORED;      new weapon2 = get_user_weapon(attacker, _, _);    if( weapon2 == WEAPON_CSW)    {        SetHamParamFloat(4, damage * get_pcvar_float(damage_weapon));        return HAM_HANDLED;    }     return HAM_IGNORED;}public Event_CurWeapon(id) {    if ( !g_Weapon[id] || !is_user_alive(id) )    return PLUGIN_CONTINUE;     new Gun = read_data(2)      if( Gun == WEAPON_CSW)    {        entity_set_string(id, EV_SZ_viewmodel, WEAPON_V_MDL)    }     return PLUGIN_CONTINUE;} public Fwd_CmdStart( id, uc_handle, seed ){    if( !is_user_alive( id ) || !g_Weapon[id] )         return FMRES_IGNORED;     if( ( get_uc( uc_handle, UC_Buttons ) & IN_ATTACK2 ) && !( pev( id, pev_oldbuttons ) & IN_ATTACK2 ) )    {        new szWeapID = get_user_weapon( id, szClip, szAmmo )         if( szWeapID == WEAPON_CSW && !g_hasZoom[ id ])        {            g_hasZoom[ id ] = true            cs_set_user_zoom( id, CS_SET_AUGSG552_ZOOM, 1 )        }         else         {   if( g_hasZoom[ id ] )            {                g_hasZoom[ id ] = false                cs_set_user_zoom( id,  CS_RESET_ZOOM, 0 )            }        }         return FMRES_HANDLED;    }     return FMRES_IGNORED;}

Code: Select all

cs_set_user_zoom( id, CS_SET_AUGSG552_ZOOM, 1 )

InvIs
Gana aktyvus vartotojas
Posts: 421
Joined: 2011 Aug 13 11:12
Skype: pksoldierlt
Location: ATOSTOGOSE

Re: Ginklu zoomai...

Post by InvIs »

Code: Select all

cs_set_user_zoom(id,CS_SET_FIRST_ZOOM,1)cs_set_user_zoom(id,CS_SET_SECOND_ZOOM,1)
ISVYKES

Froza
Jau po truputį tampa savu
Posts: 111
Joined: 2012 Jul 12 19:47

Re: Ginklu zoomai...

Post by Froza »

Galėtu gal kas nors patvarkyti arba tvarkingai išimti zoom'ą (kad būtu tiesiog default), nes su dabartiniu kur padaryta buginasi. Reikia laikyti ir nutaikyti momentą kai zoom'as būna norimame priartinime, o jeigu paspaudi viena karta tiesiog atsistato atgal į default vaizdą be zoom.

Code: Select all

#include <amxmodx>#include <fakemeta>#include <hamsandwich>#include <xs>#include <gunxpmod>#include <engine>#include <cstrike> new PLUGIN_NAME[]   = "UNLOCK : Scout"new PLUGIN_AUTHOR[]     = "xbatista"new PLUGIN_VERSION[]    = "1.0" new const WEAPON_V_MDL[] = "models/gunxpmod/v_scout.mdl";new const WEAPON_W_MDL[] = "models/gunxpmod/w_scout.mdl"; #define WEAPON_CSW CSW_SCOUTnew const weapon_n[] = "weapon_scout"; const m_pPlayer = 41;const m_flPrimaryAttack = 46; #define IsPlayer(%1)  ( 1 <= %1 <= g_maxplayers ) new g_hasZoom[33]; new damage_weapon, pCvarRof, weapon_recoil;new g_maxplayers;   new bool:g_Weapon[33]; new szClip, szAmmo;new Float:cl_pushangle[33][3]; public plugin_init() {    register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)    register_gxm_item("Scout", "+Aim +Rate +Power ( Scout )", 200)0    damage_weapon = register_cvar("gxm_damage_scout","0.7"); // damage multiplier    pCvarRof = register_cvar( "scout_rof", "0.090" ); // weapon rof , 0.090 - fast    weapon_recoil = register_cvar( "scout_recoil", "0.01" ); // weapon recoil     register_event("CurWeapon", "Event_CurWeapon", "be", "1=1");        RegisterHam( Ham_Weapon_PrimaryAttack, weapon_n, "Fwd_AttackSpeedPost" , 1 );    RegisterHam( Ham_Weapon_PrimaryAttack, weapon_n, "Fwd_AttackSpeedPre");         RegisterHam( Ham_Item_Deploy , weapon_n, "Fwd_AttackSpeedPost", 1 );     RegisterHam(Ham_TakeDamage, "player", "Ham_DamageWeapon");     register_forward( FM_CmdStart, "Fwd_CmdStart" );     g_maxplayers = get_maxplayers();}public gxm_item_enabled(id) {    g_Weapon[id] = true;}public client_connect(id) {    g_Weapon[id] = false;}public plugin_precache()  {    engfunc(EngFunc_PrecacheModel, WEAPON_V_MDL);    engfunc(EngFunc_PrecacheModel, WEAPON_W_MDL);} public Fwd_AttackSpeedPre(Ent){    new id = pev(Ent,pev_owner);    entity_get_vector( id, EV_VEC_punchangle, cl_pushangle[id]);}public Fwd_AttackSpeedPost( const Entity ){    static id ; id = get_pdata_cbase(Entity, m_pPlayer, 4)    if (g_Weapon[id] && IsPlayer(id) )    {        set_pdata_float( Entity, m_flPrimaryAttack, get_pcvar_float( pCvarRof ), 4 );         new Float:push[3];        entity_get_vector( id, EV_VEC_punchangle, cl_pushangle[id]);        xs_vec_sub( push, cl_pushangle[id], push);        xs_vec_mul_scalar( push, get_pcvar_float( weapon_recoil ), push);        xs_vec_add( push, cl_pushangle[id], push);        entity_set_vector( id, EV_VEC_punchangle, push);    }} public Ham_DamageWeapon(id, inflictor, attacker, Float:damage, damagebits) {    if ( !IsPlayer(attacker) || !g_Weapon[attacker] )            return HAM_IGNORED;      new weapon2 = get_user_weapon(attacker, _, _);    if( weapon2 == WEAPON_CSW)    {        SetHamParamFloat(4, damage * get_pcvar_float(damage_weapon));        return HAM_HANDLED;    }     return HAM_IGNORED;}public Event_CurWeapon(id) {    if ( !g_Weapon[id] || !is_user_alive(id) )    return PLUGIN_CONTINUE;     new Gun = read_data(2)      if( Gun == WEAPON_CSW)    {        entity_set_string(id, EV_SZ_viewmodel, WEAPON_V_MDL)    }     return PLUGIN_CONTINUE;} public Fwd_CmdStart( id, uc_handle, seed ){    if( !is_user_alive( id ) || !g_Weapon[id] )         return FMRES_IGNORED;     if( ( get_uc( uc_handle, UC_Buttons ) & IN_ATTACK2 ) && !( pev( id, pev_oldbuttons ) & IN_ATTACK2 ) )    {        new szWeapID = get_user_weapon( id, szClip, szAmmo )         if( szWeapID == WEAPON_CSW && !g_hasZoom[ id ])        {            g_hasZoom[ id ] = true    cs_set_user_zoom(id,CS_SET_FIRST_ZOOM,1)    cs_set_user_zoom(id,CS_SET_SECOND_ZOOM,1)        }         else         {   if( g_hasZoom[ id ] )            {                g_hasZoom[ id ] = false                cs_set_user_zoom( id,  CS_RESET_ZOOM, 0 )            }        }         return FMRES_HANDLED;    }     return FMRES_IGNORED;

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests