Thread: [API Scripting Help] [TUT] ZP 5.0 Admin Only class
View Single Post
cr0w
Senior Member
Join Date: Mar 2014
Location: middle east
Old 09-24-2014 , 06:53   Re: [TUT] ZP 5.0 Admin Only class
Reply With Quote #24

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <zombieplague>

new g_zclass_bhzombie

new g_hasBhop33 ]
new 
pcvar_enabledpcvar_autojump

new bool:g_restorevel[33]
new 
Float:g_velocity[33][3]

new const 
zclass_name[] = { "BunnyHop Zombie" }
new const 
zclass_info[] = { "BunnyHop, Pain Shock Free" }
new const 
zclass_model[] = { "zombie_source" }
new const 
zclass_clawmodel[] = { "v_knife_zombie.mdl" }
const 
zclass_health 1500
const zclass_speed 250
const Float:zclass_gravity 0.9
const Float:zclass_knockback 0.0

public plugin_init()
{
        
register_plugin("[ZP] Class : BunnyHop Zombie""1.1""ƒa†es™")

    
register_event"DeathMsg""event_player_death""a" )

    
pcvar_enabled register_cvar"zp_bhzombie_bunnyhop_enabled""1" )
    
pcvar_autojump register_cvar"zp_bhzombie_autojump""1" )

    
register_forwardFM_PlayerPreThink"forward_prethink" )
}

public 
plugin_precache()
{
    
g_zclass_bhzombie zp_register_zombie_class(zclass_namezclass_infozclass_modelzclass_clawmodelzclass_healthzclass_speedzclass_gravityzclass_knockback)

    
register_forward(FM_PlayerPreThink"fw_PlayerPreThink")
    
register_forward(FM_PlayerPreThink"fw_PlayerPreThink_Post"1)
}

public 
zp_user_infected_post(idinfector)
{
    if (
zp_get_user_zombie_class(id) == g_zclass_bhzombie)
    {
        
g_hasBhopid ] = true

        pev
(idpev_velocityg_velocity[id])
    }
}

public 
client_connectid )
{
    
g_hasBhopid ] = false
}

public 
event_player_death()
{
    
g_hasBhopread_data) ] = false
}

public 
forward_prethinkid )
{
    if(!
is_user_alive(id) || !zp_get_user_zombie(id))
         return 
PLUGIN_CONTINUE

        
if (zp_get_user_zombie_class(id) != g_zclass_bhzombie)
        return 
PLUGIN_CONTINUE

    
if( get_pcvar_numpcvar_enabled ) )
    {
        
set_pevidpev_fuser20.0 )
        
        if( 
get_pcvar_numpcvar_autojump ) && pevidpev_button ) & IN_JUMP )
        {
            new 
szFlags pevidpev_flags )
            if( !( 
szFlags FL_WATERJUMP ) && pevidpev_waterlevel ) < && szFlags FL_ONGROUND )
            {
                new 
FloatszVelocity]
                
pevidpev_velocityszVelocity)
                
szVelocity] += 250.0
                set_pev
idpev_velocityszVelocity )
                
set_pevidpev_gaitsequence)
            }
        }
    }
        return 
FMRES_IGNORED
}

public 
fw_PlayerPreThink(id)
{    
    if ( !
is_user_alive(id) || !is_user_bot(id) || !zp_get_user_zombie(id) )
        return 
FMRES_IGNORED
    
    
if (zp_get_user_zombie_class(id) != g_zclass_bhzombie)
        return 
FMRES_IGNORED
        
    
if (pev(idpev_flags) & FL_ONGROUND)
    {
        
pev(idpev_velocityg_velocity[id])
        
        
g_restorevel[id] = true
    
}
    return 
FMRES_IGNORED
}

public 
fw_PlayerPreThink_Post(id)
{
    if (
zp_get_user_zombie_class(id) != g_zclass_bhzombie)
        return 
FMRES_IGNORED
        
    
if (g_restorevel[id])
    {
        
g_restorevel[id] = false

        
if (!(pev(idpev_flags) & FL_ONTRAIN))
        {
            new 
groundent pev(idpev_groundentity)
            
            if (
pev_valid(groundent) && (pev(groundentpev_flags) & FL_CONVEYOR))
            {    
                static 
Float:vecTemp[3]
                
                
pev(idpev_basevelocityvecTemp)
                
                
g_velocity[id][0] += vecTemp[0]
                
g_velocity[id][1] += vecTemp[1]
                
g_velocity[id][2] += vecTemp[2]
            }                

            
set_pev(idpev_velocityg_velocity[id])
            
            return 
FMRES_HANDLED
        
}
    }
    return 
FMRES_IGNORED

can some one make it admin only ?
__________________
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