AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [ZP] Invisible Zombie (Help) (https://forums.alliedmods.net/showthread.php?t=90199)

zombieplague 04-15-2009 07:27

[ZP] Invisible Zombie (Help)
 
Can anyone help me with this?

Can help me add this? :

Press E to be invisible , cooldown and how long will be the cooldown. I keep trying but it fail. :cry:

Here my code:

PHP Code:

/*================================================================================
 
 -----------------------------------
 -*- [ZP] Class : Invisible Zombie -*-
 -----------------------------------
 
 ~~~~~~~~~~~~~~~
 - Description -
 ~~~~~~~~~~~~~~~
 
 Press the key [E] to be Invisible.
 
================================================================================*/
#include <zombieplague>
#include <amxmodx>
#include <fakemeta>
#define PLUGIN "[ZP] Zombie Classes : Invisible Zombie"
#define VERSION "1.0"
#define AUTHOR "zombieplague"
new g_zclass_izombieg_invisible_amount
new const zclass_name[] = { "Invisible Zombie" }
new const 
zclass_info[] = { "Invisible" }
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 1.0
const Float:zclass_knockback 1.0
public plugin_init()
{
 
register_plugin(PLUGINVERSIONAUTHOR)
        
g_invisible_amount register_cvar("zp_izombie_invisibility""100")
 
register_forward(FM_AddToFullPack,"fw_addtofullpack",1)
}
public 
plugin_precache() 
{
 
g_zclass_izombie zp_register_zombie_class(zclass_namezclass_infozclass_modelzclass_clawmodelzclass_healthzclass_speedzclass_gravityzclass_knockback)
}
public 
zp_user_infected_post(playerinfector)
{
 if (
zp_get_user_zombie_class(player) == g_zclass_izombie)
 {
  
client_print(playerprint_chat"[ZP] To be Invisible press the key [E].")       
        }
}
 
public 
fw_addtofullpack(es_handle,e,ent,host,hostflags,player,pSet)
{
 if(!
is_user_alive(ent) || !is_user_alive(host))
  return 
FMRES_IGNORED
 
 
if(zp_get_user_zombie(ent) && zp_get_user_zombie_class(ent) == g_zclass_izombie)
 {
  
set_es(es_handleES_RenderModekRenderTransAlpha)
  
set_es(es_handleES_RenderAmtget_pcvar_num(g_invisible_amount))
 }
 return 
FMRES_IGNORED
}
stock fm_set_rendering(entityfx kRenderFxNone255255255render kRenderNormalamount 255
{
 
 
set_pev(entitypev_renderfxfx)
 
set_pev(entitypev_rendercolorRenderColor)
 
set_pev(entitypev_rendermoderender)
 
set_pev(entitypev_renderamtfloat(amount))
 return 
1


Here the example :

http://www.youtube.com/watch?v=Yu3WOjpYgoM

Anggara_nothing 04-15-2009 20:20

Re: [ZP] Invisible Zombie (Help)
 
PHP Code:

/*================================================================================
    
    -----------------------------------
    -*- [ZP] Class : Invisible Zombie -*-
    -----------------------------------
    
    ~~~~~~~~~~~~~~~
    - Description -
    ~~~~~~~~~~~~~~~
    
    Press the key [E] to be Invisible.
    
================================================================================*/

#include <amxmodx>
#include <zombieplague>
#include <fakemeta>

new g_activated[33];
new 
maxplayers;

// Zombie attribute
new g_zclass_izombieg_invisible_amount;

new const 
zclass_name[] = { "Invisible Zombie" }
new const 
zclass_info[] = { "Invisible" }
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 1.0
const Float:zclass_knockback 1.0

public plugin_init()
{
    
maxplayers get_maxplayers()
    static 
id;
    for (
id 1id <= maxplayersid++)
        
g_activated[id] = 0
    
    register_plugin
("[ZP] Zombie Classes : Invisible Zombie""1.0""zombieplague")
    
g_invisible_amount register_cvar("zp_izombie_invisibility""100")
    
register_forward(FM_CmdStart"CmdStart");
    
    
g_zclass_izombie zp_register_zombie_class(zclass_namezclass_infozclass_modelzclass_clawmodelzclass_healthzclass_speedzclass_gravityzclass_knockback)
}

public 
zp_user_infected_post(playerinfector)
{
    if (
zp_get_user_zombie_class(player) == g_zclass_izombie)
    {
        
client_print(playerprint_chat"[ZP] To be Invisible press the key [E].")       
    }
}
 
public 
CmdStart(ClientHandle)
{

    if(!
is_user_alive(Client) || !is_user_alive(Client))
        return 
FMRES_IGNORED
    
    
static ButtonsOldButtons;
    
Buttons get_uc(HandleUC_Buttons);
    
OldButtons pev(Clientpev_oldbuttons);

    if(
zp_get_user_zombie(Client) && zp_get_user_zombie_class(Client) == g_zclass_izombie)
    {
        if ((
Buttons IN_USE) && !(OldButtons IN_USE))
        {
            
g_activated[Client] = 1
            set_task
(get_pcvar_float(g_invisible_amount), "uninvisible"Client)
            
fm_set_rendering(ClientkRenderFxGlowShell,0,0,0,kRenderTransAlpha50)
        }
        else if(
g_activated[Client])
            
client_print(Clientprint_chat"[ZP] You're already invisible.")
            
    }
    
    return 
FMRES_IGNORED
}

public 
uninvisible(taskid)
{
    
fm_set_rendering(taskidkRenderFxNone0,0,0,kRenderNormal255)
    
g_activated[taskid] = 0
}

stock fm_set_rendering(entityfx kRenderFxNone255255255render kRenderNormalamount 255
{
    new 
Float:RenderColor[3];
    
RenderColor[0] = float(r);
    
RenderColor[1] = float(g);
    
RenderColor[2] = float(b);

    
set_pev(entitypev_renderfxfx);
    
set_pev(entitypev_rendercolorRenderColor);
    
set_pev(entitypev_rendermoderender);
    
set_pev(entitypev_renderamtfloat(amount));

    return 
1;




All times are GMT -4. The time now is 02:21.

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