Raised This Month: $51 Target: $400
 12% 

Subplugin Submission [ZP][Extra Item] Pet - Bat for humans


Post New Thread Reply   
 
Thread Tools Display Modes
Sempiternal
New Member
Join Date: Feb 2014
Old 02-26-2014 , 10:00   Re: [ZP][Extra Item] Pet - Bat for humans
Reply With Quote #41

Hi guys. I have a problem with the plugin. I want to use it on Zombie Advance 1.6.1 , but it doesn't work. When I try to jump with CTRL+JUMP it doesn't work and it's like I stuck on the ground for a second. What must be the settings to make it work?
Sempiternal is offline
K4rim
Senior Member
Join Date: Oct 2013
Location: Malaysia
Old 02-26-2014 , 15:00   Re: [ZP][Extra Item] Pet - Bat for humans
Reply With Quote #42

tested work fine here
Attached Files
File Type: sma Get Plugin or Get Source (zp_nietoperz.sma - 651 views - 9.0 KB)
K4rim is offline
Sempiternal
New Member
Join Date: Feb 2014
Old 03-08-2014 , 11:57   Re: [ZP][Extra Item] Pet - Bat for humans
Reply With Quote #43

well i have another request - can u make it to work with own cvars, not using the zombie force,height and countdown?
Sempiternal is offline
K4rim
Senior Member
Join Date: Oct 2013
Location: Malaysia
Old 03-09-2014 , 14:43   Re: [ZP][Extra Item] Pet - Bat for humans
Reply With Quote #44

Quote:
Originally Posted by Sempiternal View Post
well i have another request - can u make it to work with own cvars, not using the zombie force,height and countdown?
try,check cvar in it
Attached Files
File Type: sma Get Plugin or Get Source (zp_nietoperz.sma - 613 views - 9.8 KB)
K4rim is offline
norbee.16
Member
Join Date: Sep 2012
Location: Hungary
Old 03-15-2014 , 20:05   Re: [ZP][Extra Item] Pet - Bat for humans
Reply With Quote #45

[hu]
ALREADY_HAVE_BAT = [ZP] Mar van egy denevered!
BAT_ON_NEXT_SPAWN = [ZP] Kapsz egy denevert a kovetkezo ujraeledesnel.
GIVE_BAT = [ZP] Most mar van denevered! [ hossz ugras / kis gravity / allat barat ]
__________________
norbee.16 is offline
Send a message via MSN to norbee.16 Send a message via Skype™ to norbee.16
cr0w
Senior Member
Join Date: Mar 2014
Location: middle east
Old 09-17-2014 , 12:48   Re: [ZP][Extra Item] Pet - Bat for humans
Reply With Quote #46

Quote:
L 09/17/2014 - 20:11:14: [FAKEMETA] Invalid entity
L 09/17/2014 - 20:11:14: [AMXX] Displaying debug trace (plugin "zp_nietoperz.amxx")
L 09/17/2014 - 20:11:14: [AMXX] Run time error 10: native error (native "pev")
L 09/17/2014 - 20:11:14: [AMXX] [0] zp_nietoperz.sma::player_touch (line 150)
L 09/17/2014 - 20:11:14: [FAKEMETA] Invalid entity
L 09/17/2014 - 20:11:14: [AMXX] Displaying debug trace (plugin "zp_nietoperz.amxx")
L 09/17/2014 - 20:11:14: [AMXX] Run time error 10: native error (native "pev")
L 09/17/2014 - 20:11:14: [AMXX] [0] zp_nietoperz.sma::player_touch (line 150)
L 09/17/2014 - 20:11:14: [FAKEMETA] Invalid entity
L 09/17/2014 - 20:11:14: [AMXX] Displaying debug trace (plugin "zp_nietoperz.amxx")
L 09/17/2014 - 20:11:14: [AMXX] Run time error 10: native error (native "pev")
L 09/17/2014 - 20:11:14: [AMXX] [0] zp_nietoperz.sma::player_touc
__________________
the city is no fun
there is no sun
and its so dark
cr0w is offline
Send a message via Yahoo to cr0w Send a message via Skype™ to cr0w
cr0w
Senior Member
Join Date: Mar 2014
Location: middle east
Old 09-17-2014 , 23:53   Re: [ZP][Extra Item] Pet - Bat for humans
Reply With Quote #47

this problem is happening after install JetPack
__________________
the city is no fun
there is no sun
and its so dark
cr0w is offline
Send a message via Yahoo to cr0w Send a message via Skype™ to cr0w
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 09-18-2014 , 01:42   Re: [ZP][Extra Item] Pet - Bat for humans
Reply With Quote #48

Which Jet Pack plugin that you use?
zmd94 is offline
cr0w
Senior Member
Join Date: Mar 2014
Location: middle east
Old 09-20-2014 , 00:55   Re: [ZP][Extra Item] Pet - Bat for humans
Reply With Quote #49

i have disable jetpack but still have the problem . and now i found something !

when i take Bonus box ! the problem was happening and bug show on console !
PHP Code:
#include < amxmodx >
#include < fakemeta >
#include < hamsandwich >
#include < zombieplague >
#include < engine >
#include < fun >

new const PLUGIN_NAME[ ]         = "[ZP] Bonus Zombies Kill";
new const 
PLUGIN_VERSION[ ]         = "0.0.2";
new const 
PLUGIN_AUTHOR[ ]         = "Shurik";

const 
MAX_CLIENTS  32;
const 
PDATA_SAFE 2;
const 
OFFSET_CSMONEY 115;
const 
OFFSET_LINUX 5;
const 
OFFSET_AWM_AMMO  377 ;
const 
OFFSET_SCOUT_AMMO 378;
const 
OFFSET_PARA_AMMO 379;
const 
OFFSET_FAMAS_AMMO 380;
const 
OFFSET_M3_AMMO 381;
const 
OFFSET_USP_AMMO 382;
const 
OFFSET_FIVESEVEN_AMMO 383;
const 
OFFSET_DEAGLE_AMMO 384;
const 
OFFSET_P228_AMMO 385;
const 
OFFSET_GLOCK_AMMO 386;
const 
OFFSET_FLASH_AMMO 387;
const 
OFFSET_HE_AMMO 388;
const 
OFFSET_SMOKE_AMMO 389;
const 
OFFSET_C4_AMMO 390;


new const 
g_szClassName[ ]         = "ZombiesBBox";

const 
BONUS_MAX_HEALTH 100;
const 
BONUS_LIMIT_HEALTH 1000;

const 
BONUS_MAX_MONEY 5;

#define ZombiesBBox                 "models/presents.mdl" 
new const ZombiesBBox_Sound[ ]     = "zp_new/ammo_sound.wav";
new const 
g_sound_buyammo[ ]         = "zp_new/clip.wav"
new const g_sound_heal[ ]             = "zp_new/medkit.wav"


enum _:AmmoIds 

    
ammo_none
    
ammo_338magnum 1
    
ammo_762nato
    
ammo_556natobox
    
ammo_556nato
    
ammo_buckshot
    
ammo_45acp
    
ammo_57mm
    
ammo_50ae
    
ammo_357sig
    
ammo_9mm 
};

new 
g_iAmmoMaxAmmoIds ] = 

    -
1
    
30// 338magnum 
    
90// 762nato 
    
200// 556natobox 
    
90// 556nato 
    
32// buckshot 
    
100// 45acp 
    
100// 57mm 
    
35// 50ae 
    
52// 357sig 
    
120  // 9mm 
}; 

new const 
g_iAmmoWeaponSharedBitSumAmmoIds ] = 

    
0
    (
1<<CSW_AWP), 
    (
1<<CSW_SCOUT)|(1<<CSW_G3SG1)|(1<<CSW_AK47), 
    (
1<<CSW_M249), 
    (
1<<CSW_AUG)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_M4A1)|(1<<CSW_SG552), 
    (
1<<CSW_XM1014)|(1<<CSW_M3), 
    (
1<<CSW_MAC10)|(1<<CSW_UMP45)|(1<<CSW_USP), 
    (
1<<CSW_P90)|(1<<CSW_FIVESEVEN), 
    (
1<<CSW_DEAGLE), 
    (
1<<CSW_P228), 
    (
1<<CSW_MP5NAVY)|(1<<CSW_TMP)|(1<<CSW_ELITE)|(1<<CSW_GLOCK18
};

new const 
AMMOOFFSET[] = { -1OFFSET_P228_AMMO, -1OFFSET_SCOUT_AMMOOFFSET_HE_AMMOOFFSET_M3_AMMOOFFSET_C4_AMMOOFFSET_USP_AMMOOFFSET_FAMAS_AMMOOFFSET_SMOKE_AMMOOFFSET_GLOCK_AMMOOFFSET_FIVESEVEN_AMMOOFFSET_USP_AMMOOFFSET_FAMAS_AMMOOFFSET_FAMAS_AMMOOFFSET_FAMAS_AMMO,
 
OFFSET_USP_AMMOOFFSET_GLOCK_AMMOOFFSET_AWM_AMMOOFFSET_GLOCK_AMMOOFFSET_PARA_AMMOOFFSET_M3_AMMOOFFSET_FAMAS_AMMOOFFSET_GLOCK_AMMOOFFSET_SCOUT_AMMOOFFSET_FLASH_AMMOOFFSET_DEAGLE_AMMOOFFSET_FAMAS_AMMO,  OFFSET_SCOUT_AMMO, -1OFFSET_FIVESEVEN_AMMO }


//new g_pChance[ MAX_CLIENTS + 1 ];
new Float:g_vecOriginMAX_CLIENTS ][ ];

new 
g_pEntity;
new 
g_pMsgID_AmmoX;

new 
g_hamczbotscvar_botquota;

public 
plugin_precache( )
{
    
precache_modelZombiesBBox);
    
    
precache_sound(g_sound_buyammo);
    
precache_sound(g_sound_heal)

    
precache_soundZombiesBBox_Sound );
}


public 
plugin_init( )
{
    
register_pluginPLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR );
    
    
register_event("HLTV""eventHLTV""a""1=0""2=0");

    
RegisterHamHam_Killed"player""CBasePlayer__Killed_Post", .Post true );
    
RegisterHamHam_Touch"info_target""CBaseEntity__Touch_Pre", .Post false );

    
g_pMsgID_AmmoX get_user_msgid"AmmoX" );
    
cvar_botquota get_cvar_pointer"bot_quota" );
    
    
register_dictionary("zp_score.txt") ;
}

public 
eventHLTV( )    
{
    new 
entity = -1;
    
    while((
entity find_ent_by_class(entityg_szClassName)))
    {
        
remove_entity(entity);
    }
}

public 
CBasePlayer__Killed_PostpevVictim )
{
    if( !
zp_get_user_zombiepevVictim ) )
    {
        return 
HAM_IGNORED;
    }

    
//g_pChance[ pevVictim ] = random_num( 0 , 8 );

    //if( g_pChance[ pevVictim ] >= 4 )
    //{
    //    return HAM_IGNORED;
    //}

    
pevpevVictimpev_origing_vecOriginpevVictim ] );

    
CreateBBox(  g_vecOriginpevVictim ] );

    return 
HAM_IGNORED;
}


public 
CreateBBoxFloat:vOrigin] )
{
    
g_pEntity engfuncEngFunc_CreateNamedEntity engfuncEngFunc_AllocString,"info_target" ) );

    
    if( !
pev_validg_pEntity ) )
    {
        return;
    }

    
//vOrigin[ 0 ] += 25.0;

    
set_pevg_pEntitypev_classnameg_szClassName );
    
set_pevg_pEntitypev_modelZombiesBBox );

    
engfuncEngFunc_SetModelg_pEntityZombiesBBox );
    
engfuncEngFunc_SetSizeg_pEntityFloat:{ -1.0, -1.0, -1.0}, Float:{  2.5,  2.5,  2.5 });
    
engfuncEngFunc_SetOriging_pEntityvOrigin );    

    
set_pevg_pEntity pev_body random_num25 28 ) )
    
    
set_pevg_pEntitypev_solidSOLID_BBOX);
    
set_pevg_pEntitypev_movetypeMOVETYPE_TOSS);

    
UTIL_set_renderingg_pEntitykRenderFxGlowShellrandom_num255 ), random_num255 ), random_num255 ) , kRenderNormal15)

    
set_pevg_pEntitypev_nextthinkget_gametime() + 0.2);
}


public 
CBaseEntity__Touch_PrepEntity pPlayer )
{
    if( !
pev_validpEntity ) || !is_user_alivepPlayer ) || !UTIL_get_user_humanpPlayer ) )
    {
        return 
HAM_IGNORED;
    }

    static 
zsClassname32 ];

    
pevpEntitypev_classnamezsClassnamecharsmaxzsClassname ) );

    if( !
equalzsClassnameg_szClassName ) )
    {
        return 
HAM_IGNORED;
    }

    switch ( 
pevpEntitypev_body) )
    {
        case 
25
        {
              
set_pevpPlayerpev_healthfloat(min(pev(pPlayerpev_health) + BONUS_MAX_HEALTHBONUS_LIMIT_HEALTH))) 
              
client_print(pPlayerprint_center"%L"LANG_PLAYER"KILLBONUS_HEATLH" )
              
engfuncEngFunc_EmitSoundpPlayerCHAN_ITEMg_sound_heal1.0ATTN_NORM0PITCH_NORM);
        }      
        case 
26
        {
             
zp_set_user_ammo_packspPlayer zp_get_user_ammo_packspPlayer ) + BONUS_MAX_MONEY);
             
client_print(pPlayerprint_center"%L"LANG_PLAYER"KILLBONUS_MONEY" )
             
engfuncEngFunc_EmitSoundpPlayerCHAN_ITEMZombiesBBox_Sound1.0ATTN_NORM0PITCH_NORM);
        }     
        case 
27
        { 
             
set_user_armor(pPlayer get_user_armorpPlayer ) + 100 );
             
client_print(pPlayerprint_center"%L"LANG_PLAYER"KILLBONUS_ARMOR" )
        }     
        case 
28
        {
             
UTIL_SetFullBpAmmopPlayer 
             
client_print(pPlayerprint_center"%L"LANG_PLAYER"KILLBONUS_AMMO" )
             
engfuncEngFunc_EmitSoundpPlayerCHAN_ITEMg_sound_buyammo1.0ATTN_NORM0PITCH_NORM);
        }  
    }

    
engfuncEngFunc_RemoveEntity pEntity );

    return 
HAM_IGNORED;
}    

stock UTIL_set_user_bpammopPlayerpWeapon pAmount )
{
    if ( 
pev_validpPlayer ) != PDATA_SAFE )
    {
        return;
    }

    
set_pdata_intpPlayer AMMOOFFSETpWeapon ] , pAmountOFFSET_LINUX);
}

stock UTIL_set_rendering(entityfx kRenderFxNone255255255render kRenderNormalamount 16)
{
    static 
Float:color[3];
    
color[0] = float(r);
    
color[1] = float(g);
    
color[2] = float(b);
    
    
set_pev(entitypev_renderfxfx);
    
set_pev(entitypev_rendercolorcolor);
    
set_pev(entitypev_rendermoderender);
    
set_pev(entitypev_renderamtfloat(amount));
}

stock UTIL_get_user_humanpPlayer )
{
    return ( !
zp_get_user_zombiepPlayer ) && !zp_get_user_nemesispPlayer ) && !zp_get_user_survivorpPlayer ) )
}

stock UTIL_SetFullBpAmmopPlayer 

        new 
iWeaponID iFullbpammoiAmmoId;
     
       
iWeaponID get_user_weaponpPlayer ); 
     
        for( new 
1AmmoIdsi++ ) 
        { 
            if( 
g_iAmmoWeaponSharedBitSum[i] & (1<<iWeaponID) ) 
            { 
                    
iAmmoId i
                    
iFullbpammo g_iAmmoMax[i]; 
                    break;
            } 
        } 
     
        if( !
iAmmoId 
    {
        return; 
         }

        
UTIL_set_user_bpammopPlayeriWeaponIDiFullbpammo ); 
     
        
message_beginMSG_ONE_UNRELIABLEg_pMsgID_AmmoX_pPlayer ); 
        
write_byteiAmmoId ); 
        
write_byteiFullbpammo ); 
        
message_end( ); 


public 
register_ham_czbotspPlayer )
{
    if( 
g_hamczbots || !is_user_connectedpPlayer ) || !get_pcvar_numcvar_botquota ) ) 
    {
        return;
    }
    
    
RegisterHamFromEntityHam_KilledpPlayer"CBasePlayer__Killed_Post");

    
g_hamczbots true;
}

public 
client_putinserverpPlayer )
{
    if( 
is_user_botpPlayer ) && !g_hamczbots && cvar_botquota 
    {
        
set_task0.1"register_ham_czbots"pPlayer );
    }

__________________
the city is no fun
there is no sun
and its so dark

Last edited by cr0w; 09-20-2014 at 00:57.
cr0w is offline
Send a message via Yahoo to cr0w Send a message via Skype™ to cr0w
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 09-20-2014 , 01:26   Re: [ZP][Extra Item] Pet - Bat for humans
Reply With Quote #50

Try:

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <zombieplague>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN "ZP: Bat"
#define VERSION "1.0"
#define AUTHOR "Sn!ff3r"

#define fm_precache_model(%1)         engfunc(EngFunc_PrecacheModel,%1)
#define fm_precache_sound(%1)         engfunc(EngFunc_PrecacheSound,%1)
#define fm_remove_entity(%1)         engfunc(EngFunc_RemoveEntity, %1)
#define fm_drop_to_floor(%1)         engfunc(EngFunc_DropToFloor,%1)
#define fm_find_ent_by_class(%1,%2)     engfunc(EngFunc_FindEntityByString, %1, "classname", %2)
#define fm_set_user_gravity(%1,%2)     set_pev(%1,pev_gravity,%2)

#define PET_FLAG             pev_flTimeStepSound
#define PET_KILLED             389

static const pet_model[] = "models/stukabat.mdl"
static const pet_sounds[][] = { "bullchicken/bc_die1.wav""bullchicken/bc_die2.wav""bullchicken/bc_die3.wav""bullchicken/bc_idle1.wav""bullchicken/bc_pain3.wav" }
static const 
pet_idle 13
static const pet_run 13
static const pet_die 5
static const pet_cost 5
static const Float:pet_idle_speed 0.5
static const Float:pet_run_speed 13.0
static const Float:player_gravity 0.8

new item_id
new item_pet[33]
new 
item_have[33]
new 
item_at_spawn[33]
new 
Float:item_leaptime[33]

new 
maxplayers

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("DeathMsg","DeathMsg","a")
    
register_event("HLTV","HLTV""a","1=0""2=0")
    
    
register_forward(FM_Think,"FM_Think_hook")
    
register_forward(FM_PlayerPreThink"FM_PlayerPreThink_hook")
    
    
RegisterHam(Ham_Spawn"player""player_spawn"1)    
    
RegisterHam(Ham_Touch"info_target""player_touch")    
    
    
register_dictionary("zombieaddons.txt")
    
    
item_id zp_register_extra_item("Bat"pet_costZP_TEAM_HUMAN)
    
    
maxplayers get_maxplayers()
}

public 
plugin_precache()
{
    new 
0
    
    
for(0sizeof pet_soundsi++)
        
fm_precache_sound(pet_sounds[i])
    
    
fm_precache_model(pet_model)    
}

public 
HLTV()
{
    new 
entid = -1
    
while((entid fm_find_ent_by_class(entid"zp_bat")))
    {
        if(
pev(entid,PET_FLAG) == PET_KILLED)
        {
            
fm_remove_entity(entid)
        }        
    }    
}

public 
DeathMsg() 
{
    new 
id read_data(2)
    
    if(
item_have[id])
    {
        
kill_pet(id)    
    }
}

public 
zp_user_infected_post(id,infector)
{
    if(
item_have[id])
    {
        
kill_pet(id)    
    }
}

public 
kill_pet(id)
{
    if(
pev_valid(item_pet[id]))
    {
        
set_pev(item_pet[id],pev_sequence,pet_die)
        
set_pev(item_pet[id],pev_gaitsequence,pet_die)
        
set_pev(item_pet[id],pev_framerate,1.0)
        
        
set_pev(item_pet[id],PET_FLAG,PET_KILLED)
        
        
fm_drop_to_floor(item_pet[id])
        
        
item_have[id] = 0
    
}    
    
item_pet[id] = 0
}

public 
zp_extra_item_selected(playeritemid)
{    
    if(
itemid == item_id)
    {
        
create_pet(player)        
    }
}

public 
player_spawn(player)
{
    if(
is_user_alive(player))
    {
        if(
item_have[player])
        {
            
set_task(get_cvar_float("zp_delay") + 1.0,"new_round_gravity",player)
        }
        
        else if(
item_at_spawn[player])
        {
            
create_pet(player)
            
item_at_spawn[player] = 0
        
}
    }    
}

public 
player_touch(this,idother)
{    
    if(!
this || !idother)
        return 
HAM_IGNORED

        
if(!pev_valid(idother) || !pev_valid(this))
                return 
HAM_IGNORED
    
    
new classname[32]
    
pev(this,pev_classname,classname,31)
    if(
equal(classname,"zp_bat") && is_a_player(idother) && !item_have[idother] && !zp_get_user_zombie(idother))
    {
        if(
pev(this,PET_FLAG) == PET_KILLED)
        {
            
remove_pet(this)
            
create_pet(idother)                
        }
    }    
    return 
HAM_IGNORED
}

public 
new_round_gravity(id)
{
    
fm_set_user_gravity(id,player_gravity)    
}

public 
create_pet(id)
{
    if(
item_have[id])
    {
        
client_print(id,print_chat,"%L",LANG_PLAYER,"ALREADY_HAVE_BAT")
        return 
PLUGIN_HANDLED
    
}
    else if(!
is_user_alive(id))
    {
        
client_print(id,print_chat,"%L",LANG_PLAYER,"BAT_ON_NEXT_SPAWN")
        
item_at_spawn[id] = 1
        
return PLUGIN_HANDLED
    
}    
    else
    {
        
item_pet[id] = engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString,"info_target"))
        
set_pev(item_pet[id],pev_classname,"zp_bat")
        
        
engfunc(EngFunc_SetModel,item_pet[id],pet_model)
        
        new 
Float:origin[3]
        
pev(id,pev_origin,origin)            
        
        
set_pev(item_pet[id],pev_origin,origin)
        
set_pev(item_pet[id],pev_solid,SOLID_TRIGGER)
        
set_pev(item_pet[id],pev_movetype,MOVETYPE_FLY)
        
set_pev(item_pet[id],pev_owner,33)
        
set_pev(item_pet[id],pev_nextthink,1.0)
        
set_pev(item_pet[id],pev_sequence,0)
        
set_pev(item_pet[id],pev_gaitsequence,0)
        
set_pev(item_pet[id],pev_framerate,1.0)
        
        
fm_set_user_gravity(id,player_gravity)        
        
        
engfunc(EngFunc_EmitSound,item_pet[id],CHAN_AUTO,pet_sounds[random_num(0,sizeof pet_sounds 1)],1.01.20PITCH_NORM)    
        
        
client_print(id,print_chat,"%L",LANG_PLAYER,"GIVE_BAT")        
        
        
item_have[id] = 1
    
}
    return 
PLUGIN_HANDLED
}

public 
FM_Think_hook(ent)
{
    for(new 
0<= maxplayersi++)
    {
        if(
ent == item_pet[i])
        {
            static 
Float:origin[3]
            static 
Float:origin2[3]
            static 
Float:velocity[3]
            
pev(ent,pev_origin,origin2)
            
get_offset_origin_body(i,Float:{50.0,0.0,0.0},origin)
            
            if(
get_distance_f(origin,origin2) > 300.0)
            {
                
set_pev(ent,pev_origin,origin)
            }
            
            else if(
get_distance_f(origin,origin2) > 80.0)
            {
                
get_speed_vector(origin2,origin,250.0,velocity)
                
set_pev(ent,pev_velocity,velocity)
                if(
pev(ent,pev_sequence) != pet_run || pev(ent,pev_framerate) != pet_run_speed)
                {
                    
set_pev(ent,pev_sequence,pet_run)
                    
set_pev(ent,pev_gaitsequence,pet_run)
                    
set_pev(ent,pev_framerate,pet_run_speed)
                }
            }
            
            else if(
get_distance_f(origin,origin2) < 75.0)
            {
                if(
pev(ent,pev_sequence) != pet_idle || pev(ent,pev_framerate) != pet_idle_speed)
                {
                    
set_pev(ent,pev_sequence,pet_idle)
                    
set_pev(ent,pev_gaitsequence,pet_idle)
                    
set_pev(ent,pev_framerate,pet_idle_speed)
                }
                
set_pev(ent,pev_velocity,Float:{0.0,0.0,0.0})
            }
            
pev(i,pev_origin,origin)
            
origin[2] = origin2[2]
            
entity_set_aim(ent,origin)            
            
set_pev(ent,pev_nextthink,1.0)
            break
        }
    }
}

public 
FM_PlayerPreThink_hook(id)
{
    if (!
is_user_alive(id))
        return
    
    if(
allowed_leap(id))
    {
        static 
Float:velocity[3]
        
velocity_by_aim(idget_cvar_num("zp_leap_force"), velocity)
        
        
velocity[2] = get_cvar_float("zp_leap_height")
        
        
set_pev(idpev_velocityvelocity)
        
        
item_leaptime[id] = get_gametime()
    }
}

public 
allowed_leap(id)
{    
    if(
zp_get_user_zombie(id))
        return 
false
    
    
if(!item_have[id])
        return 
false
    
    
if (!(pev(idpev_flags) & FL_ONGROUND) || fm_get_speed(id) < 80)
        return 
false
    
    
static buttons
    buttons 
pev(idpev_button)
    
    if (!
is_user_bot(id) && (!(buttons IN_JUMP) || !(buttons IN_DUCK)))
        return 
false
    
    
if (get_gametime() - item_leaptime[id] < get_cvar_float("zp_leap_cooldown"))
        return 
false
    
    
return true
}

public 
is_a_player(ent)
{
    if(
ent && ent 33)
        return 
true
    
    
return false
}

public 
remove_pet(ent
{
    if(
pev_valid(ent)) 
    {
        
fm_remove_entity(ent)
    }
}

// Get entity's speed (from fakemeta_util)
stock fm_get_speed(entity)
{
    static 
Float:velocity[3]
    
pev(entitypev_velocityvelocity)
    
    return 
floatround(vector_length(velocity));
}
stock get_offset_origin_body(ent,const Float:offset[3],Float:origin[3])
{
    if(!
pev_valid(ent))
        return 
0;
    
    new 
Float:angle[3]
    
pev(ent,pev_angles,angle)
    
    
pev(ent,pev_origin,origin)
    
    
origin[0] += floatcos(angle[1],degrees) * offset[0]
    
origin[1] += floatsin(angle[1],degrees) * offset[0]
    
    
origin[1] += floatcos(angle[1],degrees) * offset[1]
    
origin[0] += floatsin(angle[1],degrees) * offset[1]
    
    return 
1;
}

stock get_speed_vector(const Float:origin1[3],const Float:origin2[3],Float:speedFloat:new_velocity[3])
{
    
new_velocity[0] = origin2[0] - origin1[0]
    
new_velocity[1] = origin2[1] - origin1[1]
    
new_velocity[2] = origin2[2] - origin1[2]
    new 
Float:num floatsqroot(speed*speed / (new_velocity[0]*new_velocity[0] + new_velocity[1]*new_velocity[1] + new_velocity[2]*new_velocity[2]))
    
new_velocity[0] *= num
    new_velocity
[1] *= num
    new_velocity
[2] *= num
    
    
return 1;
}

stock entity_set_aim(ent,const Float:origin2[3],bone=0)
{
    if(!
pev_valid(ent))
        return 
0;
    
    static 
Float:origin[3]
    
origin[0] = origin2[0]
    
origin[1] = origin2[1]
    
origin[2] = origin2[2]
    
    static 
Float:ent_origin[3], Float:angles[3]
    
    if(
bone)
        
engfunc(EngFunc_GetBonePosition,ent,bone,ent_origin,angles)
    else
        
pev(ent,pev_origin,ent_origin)
    
    
origin[0] -= ent_origin[0]
    
origin[1] -= ent_origin[1]
    
origin[2] -= ent_origin[2]
    
    static 
Float:v_length
    v_length 
vector_length(origin)
    
    static 
Float:aim_vector[3]
    
aim_vector[0] = origin[0] / v_length
    aim_vector
[1] = origin[1] / v_length
    aim_vector
[2] = origin[2] / v_length
    
    
static Float:new_angles[3]
    
vector_to_angle(aim_vector,new_angles)
    
    
new_angles[0] *= -1
    
    
if(new_angles[1]>180.0new_angles[1] -= 360
    
if(new_angles[1]<-180.0new_angles[1] += 360
    
if(new_angles[1]==180.0 || new_angles[1]==-180.0new_angles[1]=-179.999999
    
    set_pev
(ent,pev_angles,new_angles)
    
set_pev(ent,pev_fixangle,1)
    
    return 
1;


Last edited by wicho; 09-20-2014 at 01:30.
wicho is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:08.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode