AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help me , Please . (https://forums.alliedmods.net/showthread.php?t=126745)

re333 05-13-2010 05:21

Help me , Please .
 
PHP Code:

#include <amxmodx>
#include <fun>
#include <fakemeta>
#include <hamsandwich>
#include <zombieplague>
#include <engine>

#define PLUGIN "[ZP] Class - Legendary Ghost"
#define VERSION "1.0"
#define AUTHOR "Scor,Petr"

// Zombie Attributes
new g_zclass_ghost
new const zclass_name[] = "Legendary Ghost" // name
new const zclass_info[] = "F1 tang hinh" // description
new const zclass_model[] = "zombie_ghost" // model
new const zclass_clawmodel[] = "v_Psycho.mdl" // claw model
const zclass_health 1000 // health
const zclass_speed 260 // speed
const Float:zclass_gravity 1.0 // gravity
const Float:zclass_knockback 1.0// knockback

new cvar_amount
new cvar_speed

new i_stealth_time_hud[33]
new 
g_cooldown[33]
new 
g_infections[33]
new 
Float:g_stealth_time[33]
new 
i_cooldown_time[33]
new 
g_maxplayers
new g_icon[33][16]
new 
boolg_ability[33] = false
new g_status

// --- config ------------------------ //
new Float:g_stealth_time_standart 5.0 //first stealth time
new Float:g_stealth_cooldown_standart 15.0 //cooldown time
new Float:g_defaultspeed 260.0 // default speed . [ 5c0r add it]
new const sound_ghost_stealth[] =  "zombie_plague/spells/zombie_ghost/stealth.wav" //stealth sound
new const sound_ghost_stealth_end[] =  "zombie_plague/spells/zombie_ghost/end_stealth.wav" //end stealth sound
// ----------------------------------- //



public plugin_init()
{    
    
register_plugin(PLUGINVERSIONAUTHOR)
     
register_cvar("zp_zclass_ghost_zombie",VERSION,FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY)
    
register_clcmd("ability1""use_ability_one")
    
register_concmd("ability1""use_ability_one")
    
register_forward(FM_PlayerPreThink"fw_PlayerPreThink")
    
register_logevent("roundStart"2"1=Round_Start")
    
g_maxplayers get_maxplayers()
    
cvar_amount register_cvar("zp_invis_amount""0")
    
cvar_speed register_cvar("zp_speed_ghost""350")
    
    
g_status get_user_msgid("StatusIcon")
}

public 
plugin_precache()
{
    
g_zclass_ghost zp_register_zombie_class(zclass_namezclass_info,  zclass_modelzclass_clawmodelzclass_healthzclass_speed,  zclass_gravityzclass_knockback)
    
precache_sound(sound_ghost_stealth)
    
precache_sound(sound_ghost_stealth_end)
}

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

public 
use_ability_one(id)
{
    if(
is_valid_ent(id) && is_user_alive(id) &&  zp_get_user_zombie(id) && !zp_get_user_nemesis(id) &&  zp_get_user_zombie_class(id) == g_zclass_ghost)
    {
        if(
g_cooldown[id] == 0)
        {
            
set_user_rendering(idkRenderFxGlowShell000,  kRenderTransAlpha0)
            
emit_sound(idCHAN_STREAMsound_ghost_stealth1.0,  ATTN_NORM0PITCH_NORM)
            
set_task(g_stealth_time[id],"ghost_make_visible",id)
            
set_task(g_stealth_cooldown_standart,"reset_cooldown",id)
            
g_cooldown[id] = 1
            
            i_cooldown_time
[id] =  floatround(g_stealth_cooldown_standart)
            
i_stealth_time_hud[id] = floatround(g_stealth_time[id])
            
            
set_task(1.0"ShowHUD"id__"a",i_cooldown_time[id])
            
set_task(1.0"ShowHUDstealthes"id__,  "a",i_stealth_time_hud[id])
            
g_ability[id] = true
            set_icon
(id)
            
set_task(5.0,"delete_icon",id)
        }
    }
}


public 
ShowHUD(id)
{
    if(
is_valid_ent(id) && is_user_alive(id))
    {
        
i_cooldown_time[id] = i_cooldown_time[id] - 1;
        
set_hudmessage(20010000.750.9201.01.10.00.0,  -1)
        
show_hudmessage(id"Stealth cooldown: %d",i_cooldown_time[id])
        }else{
        
remove_task(id)
    }
}

public 
ShowHUDstealthes(id)
{
    if(
is_valid_ent(id) && is_user_alive(id))
    {
        
i_stealth_time_hud[id] = i_stealth_time_hud[id] - 1;
        
set_hudmessage(2001000, -1.00.9201.01.10.00.0,  -1)
        
show_hudmessage(id"Stealth time: %d",i_stealth_time_hud[id])
        }else{
        
remove_task(id)
    }
}

public 
ghost_make_visible(id)
{
    if(
is_valid_ent(id) && zp_get_user_zombie(id) &&  !zp_get_user_nemesis(id) && zp_get_user_zombie_class(id) ==  g_zclass_ghost)
    {
        
set_user_rendering(idkRenderFxHologram000,  kRenderTransAlpha125)
        
emit_sound(idCHAN_STREAMsound_ghost_stealth_end1.0,  ATTN_NORM0PITCH_NORM)
    }
}

public 
reset_cooldown(id)
{
    if(
is_valid_ent(id) && zp_get_user_zombie(id) &&  !zp_get_user_nemesis(id) && zp_get_user_zombie_class(id) ==  g_zclass_ghost)
    {
        
g_cooldown[id] = 0
        
        
new text[100]
        
format(text,99,"^x04[ZP]^x01 Your ability ^x04Stealth^x01 is  ready.")
        
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_ghost) &&  !zp_get_user_nemesis(id))
    {
        
set_user_rendering(idkRenderFxHologram000,  kRenderTransAlpha125)
        
        new 
text[100]
        new 
note_cooldown floatround(g_stealth_cooldown_standart)
        new 
note_stealthtime floatround(g_stealth_time_standart)
        
format(text,99,"^x04[ZP]^x01 Your ability is ^x04Stealth^x01.  Cooldown:^x04 %d ^x01seconds. Stealth time: ^x04%d^x01  seconds.",note_cooldown,note_stealthtime)
        
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_stealth_cooldown_standart)
        
remove_task(id)
        
        
g_stealth_time[id] = g_stealth_time_standart
        g_cooldown
[id] = 0
        g_infections
[id] = 0
        g_ability
[id] = false
        client_cmd
(id,"bind F1 ability1")
    }
    
    if((
zp_get_user_zombie_class(infector) == g_zclass_ghost) &&  !zp_get_user_nemesis(infector))
    {
        
g_stealth_time[infector] = g_stealth_time[infector] + 1;
        
infections_hud(infector)
    }
}

public 
infections_hud(id)
{
    if(
is_valid_ent(id) && zp_get_user_zombie(id) &&  !zp_get_user_nemesis(id) && zp_get_user_zombie_class(id) ==  g_zclass_ghost)
    {
        new 
i_stealth_time floatround(g_stealth_time[id])
        new 
text[100]
        
format(text,99,"^x04[ZP]^x01 Your stealth time is^x04 %d  ^x01seconds.",i_stealth_time)
        
message_begin(MSG_ONE,get_user_msgid("SayText"),{0,0,0},id
        
write_byte(id
        
write_string(text
        
message_end() 
    }
}

public 
zp_user_humanized_post(id)
{
    
set_user_rendering(idkRenderFxNone000kRenderTransAlpha,  255)
    
remove_task(id)
}

public 
zp_user_unfrozen(id)
{
    if(
is_valid_ent(id) && is_user_alive(id) &&  zp_get_user_zombie(id) && !zp_get_user_nemesis(id) &&  zp_get_user_zombie_class(id) == g_zclass_ghost)
    {
        
set_user_rendering(idkRenderFxHologram000,  kRenderTransAlpha125)
    }
}

public 
fw_PlayerPreThink(id player)
{
    if (!
is_user_alive(id) || !zp_get_user_zombie(id) ||  zp_get_user_nemesis(id) || zp_get_user_zombie_class(id) !=  g_zclass_ghost// Kiem sem co phai nemesis ko nua
        
return FMRES_IGNORED
    
    
if(zp_get_user_zombie(player) &&  zp_get_user_zombie_class(player) == g_zclass_ghost)
        
set_pev(playerpev_flTimeStepSound999)

    new 
button pev(idpev_button)
    if (
g_ability[id] )  
    {
        
set_user_rendering(idkRenderFxHologram0,0,0,  kRenderTransAlpha125)
        
set_user_maxspeed(idget_pcvar_float(cvar_speed))
    }
    else
    {
        
set_user_maxspeed(id,g_defaultspeed
    }
    if(
button&IN_ATTACK || button&IN_ATTACK2 ||  button&IN_BACK || button&IN_FORWARD || button&IN_RUN ||  button&IN_JUMP || button&IN_MOVELEFT || button&IN_MOVERIGHT  || button&IN_LEFT || button&IN_RIGHT)
        
set_user_rendering(idkRenderFxHologram0,0,0,  kRenderTransAlpha125)   
    else
        
set_user_rendering(idkRenderFxGlowShell000,  kRenderTransAlphaget_pcvar_num(cvar_amount))
    
    
    return 
FMRES_IGNORED
}

public 
set_icon(id)
{
    static 
color[3], sprite[16]
    
color = {250250250}
    
sprite "dmg_gas"
    
g_icon[id] = sprite
    
    message_begin
(MSG_ONEg_status, {000}, id)
    
write_byte(1)
    
write_string(g_icon[id])
    
write_byte(color[0])
    
write_byte(color[1])
    
write_byte(color[2])
    
message_end()
}

public 
delete_icon(id
{
    
message_begin(MSG_ONEg_status, {000}, id)
    
write_byte(0)
    
write_string(g_icon[id])
    
message_end()


Means except invisible while running , he can use ability to get Full Invisible too . and at this point , i'm wrong.

Tell me if anything is wrong ... :(
Thanks in advance . :crab:

Exolent[jNr] 05-13-2010 18:23

Re: Help me , Please .
 
Your topic title must be descriptive.
Fix it before posting again.


All times are GMT -4. The time now is 03:35.

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