Raised This Month: $32 Target: $400
 8% 

Crow Zombie Problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
RobitaCoita
BANNED
Join Date: Oct 2012
Location: Europe, Romania
Old 02-19-2013 , 14:16   Crow Zombie Problem
Reply With Quote #1

I took Crow Zombie's fly and modified it to make it fly for x seconds and then cooldown x seconds but the problem is when I press the button to activate the fly ability, he is trying to fly but is not flying continue for x seconds.
If I remove coldown then I must to press buton continue for many times to make it fly is like have multiple jump. Please anyone help with this. Thank you.

PHP Code:
new g_zclass_crowcvar_fly_speed

new g_cooldown[33]
new 
Float:g_fly_time[33]
new 
i_cooldown_time[33]
new 
g_maxplayers
new g_infections[33]

new 
Float:g_flPlayerGravity33 ]

// Zombie Attributes
new const zclass_name[] = { "Crow" // name
new const zclass_info[] = { "Press E to fly" // description
new const zclass_model[] = { "zombimod_crow" // model
new const zclass_clawmodel[] = { "v_knife_crow.mdl" // claw model
const zclass_health 5000 // health
const zclass_speed 360 // speed
const Float:zclass_gravity 0.68 // gravity
const Float:zclass_knockback 0.0 // knockback


new Float:g_fly_time_standart 10.0 //first fly time
new Float:g_fly_cooldown_standart 20.0 //cooldown time


public plugin_init()
{
    
register_plugin("[ZP] Zombie Class: Crow""1.1""v3x, Roadrage, 93()|29!/<")
    
    
register_logevent("roundStart"2"1=Round_Start")
    
    
g_maxplayers get_maxplayers()    
    
    
register_clcmd("drop""use_ability_one")
}

public 
plugin_precache()
{
    
cvar_fly_speed register_cvar("zp_crow_fly_speed""360")
    
    
g_zclass_crow zp_register_zombie_class(zclass_namezclass_infozclass_modelzclass_clawmodelzclass_healthzclass_speedzclass_gravityzclass_knockback)
}

public 
roundStart(id)
{
    for (new 
1<= g_maxplayersi++)
    {
        
i_cooldown_time[i] = floatround(g_fly_cooldown_standart)
        
g_cooldown[i] = 0
        remove_task
(i)
    }
        
}

public 
client_connect(id)
{
    
remove_task(id)
}

public 
client_disconnect(id)
{
    
remove_task(id)
}

public 
use_ability_one(id)
{    
    if(
zp_get_user_zombie(id) && !zp_get_user_nemesis(id) && zp_get_user_zombie_class(id) == g_zclass_crow)
    {    
        if(
is_user_alive(id) && g_cooldown[id] == 0)
        {

            new 
Float:fAim[3], Float:fVelocity[3]
            
VelocityByAim(idget_pcvar_num(cvar_fly_speed), fAim)                
    
            
fVelocity[0] = fAim[0];
            
fVelocity[1] = fAim[1];
            
fVelocity[2] = fAim[2];
            
set_user_velocity(id fVelocity);
            
            
set_task(g_fly_time[id],"RemoveFly",id)
            
set_task(g_fly_cooldown_standart,"reset_cooldown",id)
            
g_cooldown[id] = 1
            
            i_cooldown_time
[id] = floatround(g_fly_cooldown_standart)
            
        }
    }
}

public 
RemoveFly(id)
{
    if(
zp_get_user_zombie(id) && !zp_get_user_nemesis(id) && zp_get_user_zombie_class(id) == g_zclass_crow)
    {
        
g_flPlayerGravityid ]  = zclass_gravity
        set_pev
idpev_gravityg_flPlayerGravity )
    }
}

public 
reset_cooldown(id)
{
    if(
zp_get_user_zombie(id) && !zp_get_user_nemesis(id) && zp_get_user_zombie_class(id) == g_zclass_crow)
    {
        
g_cooldown[id] = 0
        
        
new text[100]
        
format(text,99,"^x04[ZP]^x01 Your ability ^x04[Fly]^x01 is ready. Press ^x04G^x01")
        
message_begin(MSG_ONE,get_user_msgid("SayText"),{0,0,0},id
        
write_byte(id
        
write_string(text
        
message_end()
    }
}

public 
zp_user_infected_post(idinfector)
{
    if ((
zp_get_user_zombie_class(id) == g_zclass_crow) && !zp_get_user_nemesis(id))
    {
               
        
        new 
text[100]
        new 
note_cooldown floatround(g_fly_cooldown_standart)
        new 
note_flytime floatround(g_fly_time_standart)
        
format(text,99,"^x04[ZP]^x01 To use your ability press ^x04G^x01. Cooldown:^x04 %d ^x01seconds. Fly time: ^x04%d^x01 seconds.",note_cooldown,note_flytime)
        
message_begin(MSG_ONE,get_user_msgid("SayText"),{0,0,0},id
        
write_byte(id
        
write_string(text
        
message_end()
        
        
i_cooldown_time[id] = floatround(g_fly_cooldown_standart)
        
remove_task(id)
        
        
g_fly_time[id] = g_fly_time_standart
        g_cooldown
[id] = 0
        g_infections
[id] = 0
        
    
        g_fly_time
[infector] = g_fly_time[infector] + 1;
        
infections_hud(infector)
    }
}

public 
infections_hud(id)
{
    if (
is_user_alive(id) && (zp_get_user_zombie_class(id) == g_zclass_crow) && !zp_get_user_nemesis(id))
    {
        new 
i_fly_time floatround(g_fly_time[id])
        new 
text[100]
        
format(text,99,"^x04[ZP]^x01 Your fly time is^x04 %d ^x01seconds.",i_fly_time)
        
message_begin(MSG_ONE,get_user_msgid("SayText"),{0,0,0},id
        
write_byte(id
        
write_string(text
        
message_end() 
    }
}

// Set entity's rendering type (from fakemeta_util)
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))
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/ 
P.S.: Don't ask me to fix this, I am really a low scripter.
I really need help with this. I am able to pay or send a Boost SMS for your server 2€ worth.

Last edited by RobitaCoita; 02-19-2013 at 14:18.
RobitaCoita is offline
Send a message via Yahoo to RobitaCoita Send a message via Skype™ to RobitaCoita
Reply


Thread Tools
Display Modes

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 13:26.


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