Neveikia dmg

Šiame forume rašomi vartotojų klausimai/problemos su kuriomis jie susidūrė kuriant pluginus.
User avatar
nuodas159
Flooderis arba specialistas
Posts: 522
Joined: 2010 Sep 03 15:30
Skype: nuodas159
Location: SunCity

Re: Neveikia dmg

Post by nuodas159 »

Padariau ,nieko neveikia. Krc neiseis sutvarkyti speju...

Code: Select all

 #include <amxmodx>#include <engine>#include <gunxpmod>#include <hamsandwich>#include <fakemeta> #define PLUGIN  "Knife Knockback"#define VERSION "1.0"#define AUTHOR  "xbatista" #define IsPlayer(%1)  ( 1 <= %1 <= g_maxplayers ) new cvar_knock;const m_flNextSecondaryAttack = 47;const m_pPlayer = 41const m_flPrimaryAttack = 46;new bool:knf[33] new const KNIFE_MDL[] = "models/gunxpmod/v_baseballbat.mdl";     new g_maxplayersnew damage_knifenew bool:g_KNIFE[33]  public plugin_init(){    register_plugin(PLUGIN , VERSION , AUTHOR);    register_cvar("unlock_knife", VERSION, FCVAR_SERVER)    RegisterHam(Ham_TakeDamage, "player", "Ham_DamageKNIFE");     register_event("CurWeapon", "Event_CurWeaponKNIFE", "be", "1=1")    register_event("Damage" , "event_Damage" , "b" , "2>0");     register_gxm_item("BasseBall Bat", "Knife knockback, Power", 70)     damage_knife = register_cvar("gxm_damage_knife","7.0"); // damage multiplier     cvar_knock     = register_cvar("knife_power" , "13");    g_maxplayers = get_maxplayers();} public gxm_item_enabled(id) {    g_KNIFE[id] = true} public client_connect(id) {    g_KNIFE[id] = false} public Event_CurWeaponKNIFE(id){    if (!g_KNIFE[id])        return PLUGIN_CONTINUE;     new knife = read_data(2)       if( knife == CSW_KNIFE && get_user_team(id) == 2)    {    set_pev(id, pev_viewmodel2, KNIFE_MDL)    knf[id] = true    }    if( knife != CSW_KNIFE)               knf[id] = false    return PLUGIN_CONTINUE;} public event_Damage(id){    if(!is_user_alive(id))        return PLUGIN_CONTINUE;     new weapon , attacker = get_user_attacker(id , weapon);     if(!is_user_alive(attacker))        return PLUGIN_CONTINUE;     if (!g_KNIFE[attacker])        return PLUGIN_CONTINUE;     if(weapon == CSW_KNIFE)    {        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;} public Ham_DamageKNIFE(id, inflictor, attacker, Float:damage, damagebits){    if ( !(1 <= attacker <= g_maxplayers) || !g_KNIFE[attacker])            return HAM_IGNORED;     new weaponx = get_user_weapon(attacker, _, _);    if(knf[id] && weaponx == CSW_KNIFE && get_user_team(attacker) == 2)    {        SetHamParamFloat(4, damage * get_pcvar_float(damage_knife)); //Knife damage        return HAM_HANDLED;    }    return HAM_IGNORED;} // Stock by the one and only, Chronic :Pstock create_velocity_vector(victim,attacker,Float:velocity[3]){    if(!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;     velocity[0] = ( origin2[0] * (get_pcvar_float(cvar_knock) * 3000) ) / get_entity_distance(victim , attacker);    velocity[1] = ( origin2[1] * (get_pcvar_float(cvar_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;} public plugin_precache(){    engfunc(EngFunc_PrecacheModel, KNIFE_MDL);}
Image

addinol
Jau po truputį tampa savu
Posts: 144
Joined: 2010 Sep 05 15:20
Skype: kasparas94

Re: Neveikia dmg

Post by addinol »

KieC wrote:Manau tau neveikia todel nes cia pridares nesamoniu visokiu...

Ir dar manau kad vietoj [ new knf[33] ] turi buti ----> [ new bool: knf[33] ]....

new bool: turi reiksmes false ir true...
ir ne bool gali tureti true ir false reikšmes.

User avatar
nuodas159
Flooderis arba specialistas
Posts: 522
Joined: 2010 Sep 03 15:30
Skype: nuodas159
Location: SunCity

Re: Neveikia dmg

Post by nuodas159 »

Tai gal ,kas pades?
Image

KieC
O taip. Jis jau surinko 50 žinučių!
Posts: 93
Joined: 2011 Mar 01 16:42

Re: Neveikia dmg

Post by KieC »

Pataisiau ....
Last edited by KieC on 2011 May 11 20:17, edited 1 time in total.

User avatar
nuodas159
Flooderis arba specialistas
Posts: 522
Joined: 2010 Sep 03 15:30
Skype: nuodas159
Location: SunCity

Re: Neveikia dmg

Post by nuodas159 »

Meta error.
L 05/11/2011 - 20:57:41: [AMXX] Displaying debug trace (plugin "unlock_knife.amxx")
L 05/11/2011 - 20:57:41: [AMXX] Run time error 10: native error (native "RegisterHam")
L 05/11/2011 - 20:57:41: [AMXX] [0] unlock_knife.sma::plugin_init (line 27)

Ir istryniau as new pCvarRof2; nes mete error.
Image

KieC
O taip. Jis jau surinko 50 žinučių!
Posts: 93
Joined: 2011 Mar 01 16:42

Re: Neveikia dmg

Post by KieC »

Pataisysiu tuoj
Last edited by KieC on 2011 May 12 17:47, edited 2 times in total.

User avatar
nuodas159
Flooderis arba specialistas
Posts: 522
Joined: 2010 Sep 03 15:30
Skype: nuodas159
Location: SunCity

Re: Neveikia dmg

Post by nuodas159 »

Code: Select all

L 05/11/2011 - 22:55:13: [AMXX] Run time error 10: native error (native "RegisterHam")L 05/11/2011 - 22:55:13: [AMXX]    [0] unlock_knife.sma::plugin_init (line 27)
Sito neistaisei.
Image

KieC
O taip. Jis jau surinko 50 žinučių!
Posts: 93
Joined: 2011 Mar 01 16:42

Re: Neveikia dmg

Post by KieC »

Dabar turetu veikti

Code: Select all

#include <amxmodx>#include <engine>#include <gunxpmod>#include <hamsandwich>#include <fakemeta> #define PLUGIN  "Knife Knockback"#define VERSION "1.0"#define AUTHOR  "xbatista" #define IsPlayer(%1)  ( 1 <= %1 <= g_maxplayers ) new cvar_knock new const KNIFE_MDL[] = "models/gunxpmod/v_baseball_bat.mdl";    new g_maxplayersnew damage_knifenew bool:g_KNIFE[33] public plugin_init(){    register_plugin(PLUGIN , VERSION , AUTHOR);    register_cvar("unlock_knife", VERSION, FCVAR_SERVER)    RegisterHam(Ham_TakeDamage, "player", "Ham_DamageKNIFE")     register_event("CurWeapon", "Event_CurWeaponKNIFE", "be", "1=1")    register_event("Damage" , "event_Damage" , "b" , "2>0");     register_gxm_item("Axe", "Knife knockback, Power", 65)     damage_knife = register_cvar("gxm_damage_knife","12.0"); // damage multiplier     cvar_knock     = register_cvar("zp_knife_power" , "6");    g_maxplayers = get_maxplayers();}public gxm_item_enabled(id) {    g_KNIFE[id] = true}public client_connect(id) {    g_KNIFE[id] = false}public Event_CurWeaponKNIFE(id) {    if (!g_KNIFE[id])        return PLUGIN_CONTINUE;     new Gun = read_data(2)         if( Gun == CSW_KNIFE && get_user_team(id) == 2)    {        set_pev(id, pev_viewmodel2, KNIFE_MDL)    }    return PLUGIN_CONTINUE;}public event_Damage(id){    if(!is_user_alive(id))        return PLUGIN_CONTINUE;     new weapon , attacker = get_user_attacker(id , weapon);     if(!is_user_alive(attacker))        return PLUGIN_CONTINUE;     if (!g_KNIFE[attacker])        return PLUGIN_CONTINUE;     if(weapon == CSW_KNIFE && get_user_team(attacker) == 2)    {        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;}public Ham_DamageKNIFE(id, inflictor, attacker, Float:damage, damagebits) {    if ( !(1 <= attacker <= g_maxplayers) || !g_KNIFE[attacker])            return HAM_IGNORED;      new weaponx = get_user_weapon(attacker, _, _);    if( weaponx == CSW_KNIFE && get_user_team(attacker) == 2)    {        SetHamParamFloat(4, damage * get_pcvar_float(damage_knife)); //Knife damage        return HAM_HANDLED;    }    return HAM_IGNORED;}// Stock by the one and only, Chronic :Pstock create_velocity_vector(victim,attacker,Float:velocity[3]){    if(!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;     velocity[0] = ( origin2[0] * (get_pcvar_float(cvar_knock) * 3000) ) / get_entity_distance(victim , attacker);    velocity[1] = ( origin2[1] * (get_pcvar_float(cvar_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;}public plugin_precache(){    engfunc(EngFunc_PrecacheModel, KNIFE_MDL);} 
Last edited by KieC on 2011 May 12 17:54, edited 1 time in total.

User avatar
psychical
Viršininkas
Posts: 2094
Joined: 2011 Mar 12 22:19
Skype: tautvydas11
Location: Linksmakalnis
Contact:

Re: Neveikia dmg

Post by psychical »

KieC wrote:Dabar turetu veikti

Code: Select all

#include <amxmodx>#include <engine>#include <gunxpmod>#include <hamsandwich>#include <fakemeta> #define PLUGIN  "Knife Knockback"#define VERSION "1.0"#define AUTHOR  "xbatista" #define IsPlayer(%1)  ( 1 <= %1 <= g_maxplayers ) new cvar_knock new const KNIFE_MDL[] = "models/gunxpmod/v_baseball_bat.mdl";    new g_maxplayersnew damage_knifenew bool:g_KNIFE[33] public plugin_init(){    register_plugin(PLUGIN , VERSION , AUTHOR);    register_cvar("unlock_knife", VERSION, FCVAR_SERVER)    RegisterHam(Ham_TakeDamage, "player", "Ham_DamageKNIFE")     register_event("CurWeapon", "Event_CurWeaponKNIFE", "be", "1=1")    register_event("Damage" , "event_Damage" , "b" , "2>0");     register_gxm_item("Axe", "Knife knockback, Power", 65)     damage_knife = register_cvar("gxm_damage_knife","12.0"); // damage multiplier     cvar_knock     = register_cvar("zp_knife_power" , "6");    g_maxplayers = get_maxplayers();}public gxm_item_enabled(id) {    g_KNIFE[id] = true}public client_connect(id) {    g_KNIFE[id] = false}public Event_CurWeaponKNIFE(id) {    if (!g_KNIFE[id])        return PLUGIN_CONTINUE;     new Gun = read_data(2)         if( Gun == CSW_KNIFE && get_user_team(id) == 2)    {        set_pev(id, pev_viewmodel2, KNIFE_MDL)    }    return PLUGIN_CONTINUE;}public event_Damage(id){    if(!is_user_alive(id))        return PLUGIN_CONTINUE;     new weapon , attacker = get_user_attacker(id , weapon);     if(!is_user_alive(attacker))        return PLUGIN_CONTINUE;     if (!g_KNIFE[attacker])        return PLUGIN_CONTINUE;     if(weapon == CSW_KNIFE && get_user_team(attacker) == 2)    {        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;}public Ham_DamageKNIFE(id, inflictor, attacker, Float:damage, damagebits) {    if ( !(1 <= attacker <= g_maxplayers) || !g_KNIFE[attacker])            return HAM_IGNORED;      new weaponx = get_user_weapon(attacker, _, _);    if( weaponx == CSW_KNIFE && get_user_team(attacker) == 2)    {        SetHamParamFloat(4, damage * get_pcvar_float(damage_knife)); //Knife damage        return HAM_HANDLED;    }    return HAM_IGNORED;}// Stock by the one and only, Chronic :Pstock create_velocity_vector(victim,attacker,Float:velocity[3]){    if(!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;     velocity[0] = ( origin2[0] * (get_pcvar_float(cvar_knock) * 3000) ) / get_entity_distance(victim , attacker);    velocity[1] = ( origin2[1] * (get_pcvar_float(cvar_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;}public plugin_precache(){    engfunc(EngFunc_PrecacheModel, KNIFE_MDL);} 

ir vel:

Code: Select all

Gun == CSW_KNIFE && get_user_team(id) == 2
tai jugi jis visiems, ne tik mentams...

P.S. Kadangi supratau kur klaidos, istaisiau, duodu savo naudojama, cia beveik tas pats kodas, o gal ir tas pats :D

Code: Select all

#include <amxmodx>#include <engine>#include <gunxpmod>#include <hamsandwich>#include <fakemeta> #define PLUGIN  "Knife Knockback"#define VERSION "1.0"#define AUTHOR  "xbatista" #define IsPlayer(%1)  ( 1 <= %1 <= g_maxplayers ) new cvar_knock;const m_flNextSecondaryAttack = 47;const m_pPlayer = 41const m_flPrimaryAttack = 46; new const KNIFE_MDL[] = "models/gunxpmod/v_baseballbat.mdl";     new g_maxplayersnew damage_knifenew bool:g_KNIFE[33]  public plugin_init(){    register_plugin(PLUGIN , VERSION , AUTHOR);    register_cvar("unlock_knife", VERSION, FCVAR_SERVER)    RegisterHam(Ham_TakeDamage, "player", "Ham_DamageKNIFE");     register_event("CurWeapon", "Event_CurWeaponKNIFE", "be", "1=1")    register_event("Damage" , "event_Damage" , "b" , "2>0");     register_gxm_item("BasseBall Bat", "Knife knockback, Power", 60)     damage_knife = register_cvar("gxm_damage_knife","12.0"); // damage multiplier     cvar_knock     = register_cvar("zp_knife_power" , "12");    g_maxplayers = get_maxplayers();} public gxm_item_enabled(id) {    g_KNIFE[id] = true} public client_connect(id) {    g_KNIFE[id] = false} public Event_CurWeaponKNIFE(id) {    if (!g_KNIFE[id])        return PLUGIN_CONTINUE;     new Gun = read_data(2)         if( Gun == CSW_KNIFE)    {        set_pev(id, pev_viewmodel2, KNIFE_MDL)    }    return PLUGIN_CONTINUE;} public event_Damage(id){    if(!is_user_alive(id))        return PLUGIN_CONTINUE;     new weapon , attacker = get_user_attacker(id , weapon);     if(!is_user_alive(attacker))        return PLUGIN_CONTINUE;     if (!g_KNIFE[attacker])        return PLUGIN_CONTINUE;     if(weapon == CSW_KNIFE)    {        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;} public Ham_DamageKNIFE(id, inflictor, attacker, Float:damage, damagebits) {    if ( !(1 <= attacker <= g_maxplayers) || !g_KNIFE[attacker])            return HAM_IGNORED;      new weaponx = get_user_weapon(attacker, _, _);    if( weaponx == CSW_KNIFE)    {        SetHamParamFloat(4, damage * get_pcvar_float(damage_knife)); //Knife damage        return HAM_HANDLED;    }    return HAM_IGNORED;} // Stock by the one and only, Chronic :Pstock create_velocity_vector(victim,attacker,Float:velocity[3]){    if(!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;     velocity[0] = ( origin2[0] * (get_pcvar_float(cvar_knock) * 3000) ) / get_entity_distance(victim , attacker);    velocity[1] = ( origin2[1] * (get_pcvar_float(cvar_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;} public plugin_precache(){    engfunc(EngFunc_PrecacheModel, KNIFE_MDL);}
Last edited by psychical on 2011 May 12 17:57, edited 1 time in total.

KieC
O taip. Jis jau surinko 50 žinučių!
Posts: 93
Joined: 2011 Mar 01 16:42

Re: Neveikia dmg

Post by KieC »

Tu nesupranti kad as naudoji sita plugina jis kuo puikiausiai veikia

Gun == CSW_KNIFE && get_user_team(id) == 2
Ginklas = Peilis && gauti_zaidejo_komanda == 2

Tai cia yra kuri komanda tures peili turei komandai ir pakeis modely peilio kai nusipirksi upgrade..

-- 2011 Geg 12 18:05 --

Bet ant tavo to koda ira bereikalingu nenaudojanciu veiksmo eiluciu kaip:

const m_flNextSecondaryAttack = 47;
const m_pPlayer = 41
const m_flPrimaryAttack = 46;

bereikalingai naudoji. Vistiek jau tau jie nieko nedaro :DDD
Last edited by KieC on 2011 May 12 18:02, edited 3 times in total.

Locked

Who is online

Users browsing this forum: No registered users and 1 guest