View Single Post
Author Message
GAARA54
Veteran Member
Join Date: Oct 2009
Location: Everywhere
Old 12-30-2011 , 09:02   set speed in zp class
Reply With Quote #1

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

const OFFSET_LINUX 5
const OFFSET_PAINSHOCK 108 // ConnorMcLeod

new const zclassKFfleshpound_name[] = { "KF Flesh Pound" }
new const 
zclassKFfleshpound_info[] = { "Get Crazy on shooting" }
new const 
zclassKFfleshpound_model[] = { "KF_Flesh_Pound" }
new const 
zclassKFfleshpound_clawmodel[] = { "v_KF_fleshpound.mdl" }
const 
zclassKFfleshpound_health 4000
const zclassKFfleshpound_speed 160
const Float:zclassKFfleshpound_gravity 1.0
const Float:zclassKFfleshpound_knockback 0.3

new g_classKFfleshpound
new Float:normal_speed zclassKFfleshpound_speed

new Float:g_kf_crazyhp[33]
new 
bool:g_has_crazy[33] = false
new bool:g_painsfree[33] = false

new crazy_hpcvar_humanspdcrazy_speed

new const crazysound[] = "zombie_plague/KF_Flesh_Pound_crazy.wav"
new const gibslaysound[] = "zombie_plague/zp_gibslay.wav"

public plugin_precache()
{
    
//Register Plugin
    
register_plugin("[ZP] Class: KF Flesh Pound""1.0""GAARA54")
    
    
//Register Class
    
g_classKFfleshpound zp_register_zombie_class(zclassKFfleshpound_namezclassKFfleshpound_infozclassKFfleshpound_modelzclassKFfleshpound_clawmodelzclassKFfleshpound_healthzclassKFfleshpound_speedzclassKFfleshpound_gravityzclassKFfleshpound_knockback)
    
    
//Precache Gibslay Sound
    
precache_sound(gibslaysound)
    
precache_sound(crazysound)
    
    
//Cvars
    
crazy_hp register_cvar("zp_crazy_hpreduce""500.0"// How many hp Flesh Pound need to lose to get crazy
    
crazy_speed register_cvar("zp_kf_crazy_speed""460.0")
    
cvar_humanspd register_cvar("zp_human_speed""240.0")
    
    
// HamSandWich
    
RegisterHam(Ham_TakeDamage"player""KF_fleshpound_takedamage")
}

public 
zp_round_started()
{
    for(new 
1<= get_maxplayers(); i++)
    {
        
g_has_crazy[i] = false
        g_painsfree
[i] = false
        g_kf_crazyhp
[i] = 0.0
    
}
}

public 
zp_user_humanized_post(id)
{
    
set_user_maxspeed(idget_pcvar_float(cvar_humanspd))
    
fm_set_rendering(idkRenderFxGlowShell000kRenderNormal25)
    
g_painsfree[id] = false
}

public 
zp_user_infected_post(idinfector)
{
    if (
zp_get_user_zombie_class(id) == g_classKFfleshpound && !zp_get_user_nemesis(id))
    {
        
client_printcolor(id"^4[ZP]^1 You get Flesh Pound class, you will get crazy when will receive^4 %d damage"get_pcvar_num(crazy_hp))
        
g_has_crazy[id] = false
        g_kf_crazyhp
[id] = 0.0
    
}
}

public 
zp_user_infect_attempt(victiminfectornemesis)
{
    if(!
is_user_alive(infector))
        return 
PLUGIN_CONTINUE
        
    
if(!infector || nemesis)
        return 
PLUGIN_CONTINUE

    
if (zp_get_user_zombie_class(infector) == g_classKFfleshpound && !zp_get_user_nemesis(infector))
    {
        if (
g_has_crazy[infector] == true)
        {
            
killexplode(victim)
            return 
ZP_PLUGIN_HANDLED
        
}
    }
    return 
PLUGIN_CONTINUE
}
        

public 
KF_fleshpound_takedamage(victimweaponattackerFloat:damagedamagebits)
{
    if(!
is_user_alive(victim))
        return
        
    if (!
zp_get_user_zombie(attacker) && zp_get_user_zombie(victim) && zp_get_user_zombie_class(victim) == g_classKFfleshpound && !zp_get_user_nemesis(victim))
    {
        
g_painsfree[victim] = false
        
        
if (g_kf_crazyhp[victim] >= get_pcvar_float(crazy_hp))
        {
            if (
g_has_crazy[victim] == true)
            {
                return
            }
            else
            {
                
fleshpound_getcrazy(victim)
                
client_print(victimprint_chat"123"// проверка, сработало или нет
            
}
        }
        
        
g_kf_crazyhp[victim]+=damage
    
}
}

public 
fleshpound_getcrazy(victim)
{
    if(!
is_user_alive(victim))
        return
        
    
emit_sound(victimCHAN_BODYcrazysound1.0ATTN_NORM0PITCH_NORM)
    
g_kf_crazyhp[victim] = 0.0
    g_has_crazy
[victim] = true
    g_painsfree
[victim] = true
    set_pdata_float
(victimOFFSET_PAINSHOCK1.0OFFSET_LINUX)
    
    
fm_set_user_maxspeed(victimget_pcvar_float(crazy_speed))
    
fm_set_rendering(victimkRenderFxGlowShell25500kRenderNormal255)
    
    
    
set_task(8.0"uncrazy"victim)
}

public 
uncrazy(victim)
{
    if(!
is_user_alive(victim))
        return
        
    
client_print(victimprint_chat"task complete"// проверка, сработало или нет
    
g_has_crazy[victim] = false
    g_painsfree
[victim] = false
    g_kf_crazyhp
[victim] = 0.0
    
    
    fm_set_user_maxspeed
(victimnormal_speed)
    
fm_set_rendering(victimkRenderFxGlowShell000kRenderNormal25)
}

public 
killexplode(victim)
{
    
SetHamParamInteger(32)
    
emit_sound(victimCHAN_BODYgibslaysound1.0ATTN_NORM0PITCH_NORM)
}

stock client_printcolor(const id, const input[], any:...)
{
    new 
iCount 1iPlayers[32]
    static 
szMsg[191]

    
vformat(szMsgcharsmax(szMsg), input3)
    
replace_all(szMsg190"/g""^4")
    
replace_all(szMsg190"/y""^1")
    
replace_all(szMsg190"/ctr""^1")
    
replace_all(szMsg190"/w""^0")

    if(
idiPlayers[0] = id
    
else get_players(iPlayersiCount"ch")
    for (new 
0iCounti++)
    {
        if(
is_user_connected(iPlayers[i]))
        {
            
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _iPlayers[i])
            
write_byte(iPlayers[i])
            
write_string(szMsg)
            
message_end()
        }
    }
}

stock fm_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 fm_set_user_maxspeed(indexFloat:speed = -1.0
{
    
engfunc(EngFunc_SetClientMaxspeedindexspeed);
    
set_pev(indexpev_maxspeedspeed);

    return 
1;

Hi all, i making zp class Flesh Pound

how i can set speed in this functions ?

PHP Code:
public fleshpound_getcrazy(victim)
{
    if(!
is_user_alive(victim))
        return
        
    
emit_sound(victimCHAN_BODYcrazysound1.0ATTN_NORM0PITCH_NORM)
    
g_kf_crazyhp[victim] = 0.0
    g_has_crazy
[victim] = true
    g_painsfree
[victim] = true
    set_pdata_float
(victimOFFSET_PAINSHOCK1.0OFFSET_LINUX)
    
    
fm_set_user_maxspeed(victimget_pcvar_float(crazy_speed))
    
fm_set_rendering(victimkRenderFxGlowShell25500kRenderNormal255)
    
    
    
set_task(8.0"uncrazy"victim)
}

public 
uncrazy(victim)
{
    if(!
is_user_alive(victim))
        return
        
    
client_print(victimprint_chat"task complete"// проверка, сработало или нет
    
g_has_crazy[victim] = false
    g_painsfree
[victim] = false
    g_kf_crazyhp
[victim] = 0.0
    
    
    fm_set_user_maxspeed
(victimnormal_speed)
    
fm_set_rendering(victimkRenderFxGlowShell000kRenderNormal25)

i try ~ 5 methods

fm_set_user_speed
set_user_max_speed

and other

any doesn't work !!
WTF ?
help please
__________________

Last edited by GAARA54; 12-30-2011 at 09:10.
GAARA54 is offline