Raised This Month: $ Target: $400
 0% 

VirusNade


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
bibu
Veteran Member
Join Date: Sep 2010
Old 07-22-2011 , 13:35   Re: VirusNade
Reply With Quote #2

You're in the scripting section. Post it next time in the suggestions one. Anyways, try this:

PHP Code:
/*    
    /////////////////////////////////////
       ///////// VIRUS SMOKEGRENADE ////////
      /////////////////////////////////////
    
    (c) Copyright 2008, anakin_cstrike
    This file is provided as is (no warranties). 
    
    --| Version |-- 1.3
    
    Changelog:
        * [ 1.3 ]
            - added screenshake
            - added infection command
        * [ 1.2 ]
            - changing player's angles at infection
            - added new model to smoke
            - changed method of setting player's health
        * [ 1.1 ]
            - removed cstrike module
        * [ 1.0 ]
            - first released
            
    --| Support |--  http://forums.alliedmods.net/showthread.php?t=78305
    
    --| Description |--
    
        * General
            - this is a 'new' smoke grenade...wich "contains" a virus
            - trail and dynamic light effects
            - the nade has a green glow
            - the nade has a new model
            - at explosion, if you are in the radius zone...you will be infected with the virus and every x seconds, your hp begins to decrease with y...
            also your screen starts to fade and an icon apears and flashes on the left of the screen...
            oh, and you'll glow in green for x seconds.
            - the smokegrenade has a explosion damage
            - you maxspeed wil be changed depending on the seconds that have passed after you've been infected
            - if you thuch/touched by a player that is infected...you will be infected too
            - if you kill a player with the smokenade, he will explode forming 3 red cylinders.
            - player infection can be announced
            - when a player is infected, his screen will go in a wierd angle

        * Antidote
            - you can buy an antidot for a specific amount of $ 
            - the antidote is taken in x seconds 
            - a bar appears on the players screen, and disappears when the antidote is taken
        
    --| Cvars |--
        - virusnade_plugin 1/0 -- enable/disable plugin (default 1)
        - virusnade_impactdamage -- damage for smokenade at impact (default 10)
        - virusnade_damageinterval -- interval in seconds for hp decreasing (default 3)
        - virusnade_intervaldamage -- damage done at interval seconds, every x seconds (default 5)
        - virusnade_glow 1/0 -- enable/disable glowing player when infected (default 1)
        - virusnade_glowduration -- duration in seconds for glow effect (default 2)
        - virusnade_trail1/0 -- enable/disable nade trail (default 1)
        - virusnade_touch 1/0 -- enable/disable infection at player touch (default 1)
        - virusnade_changespeed 1/0 -- enable/disable changing speed (default 1)
        - virusnade_announce 1/0 -- enable/disable player infection annoucement (default 1)
        - virusnade_antidote 1/0 -- enable/disable the possibility to buy antidote (default 1)
        - virusnade_antidotecost -- the cost for the antidote (default 1500)
        - virusnade_antidoteduration - duration in seconds before the antidote is taken (default 10)
        - virusnade_antidoteonlyknife 1/0 -- enable/disable option that allows the player to play only with the knife while taking the antidote (default 1)
        - virusnade_antidotebuyzone 1/0 -- enable/disable buying the antidote only in the buyzone (default 1)
        NEW! Version 1.2 new cvars:
        - virusnade_angles 1/0 -- enable/disable changing player's angles at infection (default 1 )
        - virusnade_newmodel 1/0 -- enable/disable changing smoke model (default 1 )
    
    --| Command |--
        - amx_infect <player> <hp> - infect a player with a specific amount of hp
        
    --| Module Required |--
        - Fakemeta
        
    --| Client Commands |--
        - say /antidote -- buy an antidote
        - say_team /antidote -- buy an antidote

*/

/********************************* Includes & Definitions *********************************/        

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

// -------------------------------------------------
new const PLUGIN[] =        "Virus SmokeNade"
#define VERSION         "1.3"
// -------------------------------------------------

#if cellbits == 32
    #define OFFSET_MAPZONE  235
#else
    #define OFFSET_MAPZONE  268
#endif

#define OFFSET_MONEY            115
#define OFFSET_BUYZONE            (1<<0)
#define fm_find_ent_in_sphere(%1,%2,%3) engfunc(EngFunc_FindEntityInSphere, %1, %2, %3)

// radius for virus
#define radius    200.0

// angles - thanks v3x
#define ANGLE_MIN             25.0
#define ANGLE_MAX             50.0

// access needed to use the command
#define ACCESS                ADMIN_BAN
// comand this if you don't want an information message at infection by command
#define COMMAND_INFO

// new smoke models
#define V_MODEL         "models/v_virusnade.mdl"
#define W_MODEL            "models/w_virusnade.mdl"

// DONT CHANGE!
#define SMOKE_W_MODEL         "models/w_hegrenade.mdl"

enum g_NadeColors
{
    
Red,
    
Green,
    
Blue
};

new const 
g_Colorsg_NadeColors ] = { 0255};

/********************************* Global Variables *********************************/

new
toggle_plugintoggle_damagetoggle_intervaltoggle_intdamage,
toggle_glowdurationtoggle_antidottoggle_antidotcosttoggle_angles,
toggle_glowtoggle_announcetoggle_antidotdurtoggle_antidotknife,
toggle_trailtoggle_speedtoggle_touchtoggle_antidotzonetoggle_model;

new 
p_togglep_damagep_intp_dmgp_announcep_speed
p_glowdurp_anticostp_antidurp_anglesp_model;

new 
g_msgscreenfadeg_msgstatusicong_msgbartimeg_msgsaytext
g_msgscoreinfog_msgdeathmsgg_msgmoneyg_msghealthg_msgscreenshake;

new 
g_Timerpointer;

new 
g_trailg_explodeg_smoke;

new 
bool:g_Virused33 ], bool:g_Antidot33 ];
new 
g_Count33 ];


/********************************* Initialization *********************************/

public plugin_init()
{
    
register_pluginPLUGINVERSION"anakin_cstrike" );
    
    
/* Fakemeta Forwards */
    
register_forwardFM_Touch"fw_touch" );
    
register_forwardFM_EmitSound"fw_emitsound" );
    
register_forwardFM_SetModel"fw_setmodel");
    
register_forwardFM_PlayerPreThink"fw_prethink" );
    
    
/* Command */
    
register_concmd"amx_infect""infect_cmd"ACCESS"- <target> <hp> - infect player with x hp" );
    
    
/* Events */
    
register_event"CurWeapon""hook_curwpn""be""1=1""2!29" );
    
register_event"HLTV""hook_newround","a""1=0""2=0" );
    
register_event"ResetHUD""hook_reset""b" );
    
register_clcmd"say_team /antidote""antidote_cmd" );
    
register_clcmd"say /antidote""antidote_cmd" );
    
    
/* Cvars */
    
toggle_plugin register_cvar"virusnade_plugin""1" );
    
toggle_damage register_cvar(" virusnade_impactdamage""10" );
    
toggle_interval register_cvar"virusnade_damageinterval""3" );
    
toggle_intdamage register_cvar(" virusnade_intervaldamage""5" );
    
toggle_glow register_cvar"virusnade_glow""1" );
    
toggle_glowduration register_cvar"virusnade_glowduration""2" );
    
toggle_trail register_cvar"virusnade_trail""1" );
    
toggle_touch register_cvar"virusnade_touch""1" );
    
toggle_angles register_cvar"virusnade_angles""1" );
    
toggle_model register_cvar"virusnade_newmodel""1" );
    
toggle_speed register_cvar"virusnade_changespeed""1" );
    
toggle_announce register_cvar"virusnade_announce""1" );
    
toggle_antidot register_cvar"virusnade_antidote""1" );
    
toggle_antidotcost register_cvar"virusnade_antidotecost""1500" );
    
toggle_antidotdur register_cvar"virusnade_antidoteduration""10" );
    
toggle_antidotknife register_cvar"virusnade_antidoteonlyknife""1" );
    
toggle_antidotzone register_cvar"virusnade_antidotebuyzone""1" );
    
    
/* Messages */
    
g_msgscreenshake get_user_msgid"ScreenShake" );
    
g_msgscreenfade get_user_msgid"ScreenFade" );
    
g_msgstatusicon get_user_msgid"StatusIcon" );
    
g_msgscoreinfo get_user_msgid"ScoreInfo" );
    
g_msgdeathmsg get_user_msgid"DeathMsg" );
    
g_msgsaytext get_user_msgid"SayText" );
    
g_msgbartime get_user_msgid"BarTime" );
    
g_msghealth get_user_msgid"Health" );
    
g_msgmoney get_user_msgid"Money" );
    
    
pointer get_cvar_pointer"amx_show_activity" );
}

/********************************* Precache *********************************/

public plugin_precache()
{
    
engfuncEngFunc_PrecacheModel,V_MODEL );
    
engfuncEngFunc_PrecacheModel,W_MODEL );
    
    
g_trail precache_model"sprites/laserbeam.spr" );
    
g_explode precache_model"sprites/shockwave.spr" );
    
g_smoke precache_model"sprites/steam1.spr" );
}

/********************************* Get Values *********************************/

public hook_newround()
{
    
p_toggle get_pcvar_numtoggle_plugin );
    
p_damage get_pcvar_numtoggle_damage );
    
p_dmg get_pcvar_numtoggle_intdamage );
    
p_int get_pcvar_numtoggle_interval );
    
p_announce get_pcvar_numtoggle_announce );
    
p_speed get_pcvar_numtoggle_speed );
    
p_glowdur get_pcvar_numtoggle_glowduration );
    
p_anticost get_pcvar_numtoggle_antidotcost );
    
p_antidur get_pcvar_numtoggle_antidotdur );
    
p_angles get_pcvar_numtoggle_angles );
    
p_model get_pcvar_numtoggle_model );
    
    
g_Timer p_antidur;
}
    
    
/********************************* Antidote *********************************/    

public antidote_cmdid )
{
    
// make sure the plugin is enabled
    
if( p_toggle != )
        return 
PLUGIN_HANDLED;
    
    
// check if buying antidote option is enabled
    
if( get_pcvar_numtoggle_antidot ) != 1)
    {
        print( 
id"You're not allowed to buy an antidote!" );
        return 
PLUGIN_HANDLED;
    }
    
    
// make sure the player is alive
    
if( !is_user_aliveid ) )
    {
        print( 
id"You must be alive to buy an antidote!" );
        return 
PLUGIN_HANDLED;
    }
    
    
// check if is in buyzone
    
if( !fm_get_user_buyzoneid ) && get_pcvar_numtoggle_antidotzone ) == 1)
    {
        print( 
id"You must be in Buyzone to buy an antidote!" );
        return 
PLUGIN_CONTINUE;
    }
    
    
// make sure he has enough money
    
new money fm_get_user_moneyid );
    if( 
money p_anticost )
    {
        print( 
id"Not enough money, you need $%d to buy an antidote!"p_anticost );
        
centerid"#Cstrike_TitlesTXT_Not_Enough_Money" );
        return 
PLUGIN_CONTINUE;
    }
    
    
// check if is infected
    
if( !g_Virusedid ] )
    {
        print( 
id"You're not infected with the virus!" );
        return 
PLUGIN_CONTINUE;
    }
    
    
// check if he allready bought an antidote
    
if( g_Antidotid ] )
    {
        print( 
id"You've already bought the antidote!" );
        
centerid"#Cstrike_TitlesTXT_Cannot_Carry_Anymore" );
        return 
PLUGIN_HANDLED;
    }
    
    
g_Timer p_antidur;
    
g_Antidotid ] = true;
    
    
// remove flashing icon, set a normal 
    
Iconid1"dmg_gas"0255);
    
set_task1.0"countdown",id+12345,_,_,"b");
    
fm_set_user_moneyidmoney 1500,); // remove money
    
    // create a bar
    
message_beginMSG_ONEg_msgbartime_id );
    
write_shortp_antidur );
    
message_end();
    
    print( 
id"You've bought an antidote for $%d !"p_anticost );
    
    return 
PLUGIN_CONTINUE;
}

/********************************* Infect Command *********************************/

public infect_cmdidlevelcid )
{
    if( !
cmd_accessidlevelcid) )
        return 
PLUGIN_HANDLED;
        
    new 
arg32 ], arg2], name32 ], FloatfAngle];
    
read_argv1argsizeof arg );
    
read_argv2arg2sizeof arg2 );
    
get_user_nameidnamesizeof name );
    
    new 
str_to_numarg2 );
    new 
point get_pcvar_numpointer );
    
    new 
target cmd_targetidarg);
    if( !
target )
        return 
PLUGIN_HANDLED;
    if( 
g_Virusedtarget ] || task_existstarget 123 ) )
        return 
PLUGIN_HANDLED;
    new 
name232 ];
    
get_user_nametargetname2sizeof name2 );
    new 
hp get_user_healthtarget );
    
    
g_Virusedtarget ] = true;
    
fm_set_user_healthtargetfloathp ) );
    
set_taskfloatp_int ), "virus"target+123__"b" );
    
    if( 
p_angles == )
    {
        
fAngle] = random_floatANGLE_MIN ANGLE_MAX );
        
fAngle] = random_floatANGLE_MIN ANGLE_MAX );
        
fAngle] = random_floatANGLE_MIN ANGLE_MAX );
            
        
set_pevtargetpev_punchanglefAngle );
    }
                
    if( 
get_pcvar_numtoggle_glow ) == )
    {
        
// glow player
        
RendertargetkRenderFxGlowShellg_ColorsRed ], g_ColorsGreen ], g_ColorsBlue ], kRenderNormal20 );
        
set_taskfloatp_glowdur ), "glow_normal"target );
    }
    
    
// screenfade
    
Fadetarget, (1<<10), (1<<10), (1<<12), g_ColorsRed ], g_ColorsGreen ], g_ColorsBlue ], 75 );
    
// screenshake
    
Shaketarget, (1<<13), (1<<13), (1<<13) );
    
// set an icon on the left of the player's screen
    
Icontarget2"dmg_gas"g_ColorsRed ], g_ColorsGreen ], g_ColorsBlue ] );
    
    if( 
p_announce == )
    {
        
// anounce infection
        
set_hudmessage020000.050.2506.03.0 )
        
show_hudmessage0"%s has been infected with the virus!"name2 );
    }
    
    
#if defined COMMAND_INFO
        
print( 0"ADMIN %s: Infected %s"point == "" namename2 );
    
#endif
    
log_amx"ADMIN %s: Infected %s"namename2 );
    
    return 
PLUGIN_HANDLED;
}

/********************************* Spreading Virus >:) *********************************/
    
public fw_emitsoundEntChannel, const Sound[], Float:VolumeFloat:AttenuationFlagsPitch )    
{
    
// make sure the plugin is enabled
    
if( p_toggle != )
        return 
FMRES_IGNORED;
    
// make sure was a smokenade    
    
if( !equaliSound"weapons/sg_explode.wav" ) )
        return 
FMRES_IGNORED;
        
    static 
    
Float:origin], Float:iorigin], Float:fAngle],
    
name32 ], ownertotalhpi;
    
pevEntpev_originorigin );
    
owner pevEntpev_owner );
    
    
Lightorigin ); // makes a nice light effect
    
RenderEntkRenderFxNone25525525515 ); //set the glow back to normal
    
    
while( ( fm_find_ent_in_sphereioriginradius ) ) != )
    {
        if( !
is_user_alive) )
            continue;
        
// check if is allready infected    
        
if( g_Virused])
            continue;
            
        
pevipev_originiorigin );    
        
g_Virused] = true;    
        
        
hp get_user_health);
        
// check if hp is less or equal to nade damage
        
if( hp <= p_damage )
        {
            
Killowner); // kill the player
            
            // explode effects
            
Smokeiorigin );
            
Cylinderiorigin );
            
            
// lets make a nice screenfade
            
Fadei, (6<<10), (5<<10), (1<<12), g_ColorsRed ], g_ColorsGreen ], g_ColorsBlue ], 175 );
            
            continue;
        } else {
            
            
total hp p_damage;    
            
fm_set_user_healthifloattotal ) ); //inflict damage
            
            // screenfade
            
Fadei, (1<<10), (1<<10), (1<<12), g_ColorsRed ], g_ColorsGreen ], g_ColorsBlue ], 75 );
            
// screenshake
            
Shakei, (1<<13), (1<<13), (1<<13) );
            
            if( 
p_angles == )
            {
                
fAngle] = random_floatANGLE_MIN ANGLE_MAX );
                
fAngle] = random_floatANGLE_MIN ANGLE_MAX );
                
fAngle] = random_floatANGLE_MIN ANGLE_MAX );
            
                
set_pevipev_punchanglefAngle );
            }
                
            if( 
get_pcvar_numtoggle_glow ) == )
            {
                
// glow player
                
RenderikRenderFxGlowShellg_ColorsRed ], g_ColorsGreen ], g_ColorsBlue ], kRenderNormal20 );
                
set_taskfloatp_glowdur ), "glow_normal");
                
                
// set an icon on the left of the player's screen
                
Iconi2"dmg_gas"g_ColorsRed ], g_ColorsGreen ], g_ColorsBlue ] );
            }
            
set_taskfloatp_int ), "virus"i+123__"b" );
            
            if( 
p_announce == )
            {
                
// anounce infection
                
get_user_nameiname31 );
                
set_hudmessage020000.050.2506.03.0 )
                
show_hudmessage0"%s has been infected with the virus!"name );
            }
        }
    }
    
    return 
FMRES_IGNORED;
}

/********************************* SetModel Forward *********************************/    

public fw_setmodelentmodel[] )
{
    
// make sure the plugin is enabled
    
if( p_toggle != )
        return 
FMRES_IGNORED;
    
// make sure was is a smokenade        
    
if( !equalimodelSMOKE_W_MODEL ) )
        return 
FMRES_IGNORED;
    
// glow nade
    
RenderentkRenderFxGlowShell,g_ColorsRed ], g_ColorsGreen ], g_ColorsBlue ] ,kRenderNormal15 );
    if( 
get_pcvar_num(toggle_trail ) == )
        
Followentg_trail105g_ColorsRed ], g_ColorsGreen ], g_ColorsBlue ], 175 ); // set the trail
    
    
if( p_model == )
    {
        static 
classname32 ];
        
peventpev_classnameclassnamesizeof classname );
    
        if( !
strcmpclassname"weaponbox" ) || !strcmpclassname"armoury_entity" ) || !strcmpclassname"grenade" ) )
        {
            
engfuncEngFunc_SetModelentW_MODEL );
            return 
FMRES_SUPERCEDE;
        }
    }
    
    return 
FMRES_IGNORED;
}

/********************************* PreThink *********************************/    

public fw_prethinkid )
{
    
// make sure the plugin is enabled
    
if( p_toggle != )
        return 
FMRES_IGNORED;
    
// must be alive    
    
if( !is_user_aliveid ) )
        return 
FMRES_IGNORED;
    
// check if is infected    
    
if( !g_Virusedid ] )
        return 
FMRES_IGNORED;
    
// stop if the changing speed cvar is disabled    
    
if( p_speed != )
        return 
FMRES_IGNORED;
        
    if( 
g_Countid ] >= Speedid200.0 );
    else if( 
g_Countid ] >= 10 Speedid150.0 );
    else if( 
g_Countid ] >= 15 Speedid100.0 );
    
    return 
FMRES_IGNORED;
}

/********************************* Touch Stuff *********************************/
    
public fw_touchtouchedtoucher )
{
    
// make sure the plugin is enabled
    
if( p_toggle != )
        return 
FMRES_IGNORED;
    
// make sure the touch option is enabled    
    
if( get_pcvar_numtoggle_touch ) != 1)
        return 
FMRES_IGNORED;
    
    static 
    
dclass32 ], rclass32 ], 
    
dname32 ], rname32 ],
    
Float:fAngle];
    
    
// get class and name
    
pevtouchedpev_classnamedclasssizeof dclass );
    
pevtoucherpev_classnamerclasssizeof rclass );
    
get_user_nametoucheddnamesizeof dname );
    
get_user_nametoucherrnamesizeof rname );
    
    if( 
equalidclass"player" ) && equalirclass"player" ) )
    {
        if( 
g_Virusedtoucher ] )
        {
            if( !
g_Virusedtouched ] )
            {
                
g_Virusedtouched ] = true;
                
                
// create a screenfade
                
Fadetoucher, (1<<10), (1<<10), (1<<12), g_ColorsRed ], g_ColorsGreen ], g_ColorsBlue ], 75 );
                
Icontoucher,2"dmg_gas"g_ColorsRed ], g_ColorsGreen ], g_ColorsBlue ] );
                
                if( 
p_angles == )
                {
                    
fAngle] = random_floatANGLE_MIN ANGLE_MAX );
                    
fAngle] = random_floatANGLE_MIN ANGLE_MAX );
                    
fAngle] = random_floatANGLE_MIN ANGLE_MAX );
            
                    
set_pevtouchedpev_punchanglefAngle );
                }
                
                
// glow player
                
if( get_pcvar_numtoggle_glow ) == )
                {
                    
RendertouchedkRenderFxGlowShellg_ColorsRed ], g_ColorsGreen ], g_ColorsBlue ], kRenderNormal20 );
                    
set_taskfloatp_glowdur ), "glow_normal",touched );
                }
                
set_taskfloatp_int ), "virus"touched+123__,"b" );
                
                
// anounce infection
                
if( p_announce == )
                {
                    
set_hudmessage020000.050.2506.03.0 );
                    
show_hudmessage0"%s has take the virus^n from %s"dnamername );
                }
            }
        }
    }
    
    return 
FMRES_IGNORED;
}

/********************************* Curent Weapon stuff *********************************/    

public hook_curwpnid )
{
    
// make sure the plugin is enabled
    
if( p_toggle != )
        return 
PLUGIN_CONTINUE;    
    if( !
is_user_aliveid ) )
        return 
PLUGIN_CONTINUE;
    
    if( 
p_model == )
    {
        new 
wID read_data);
        if( 
wID == CSW_HEGRENADE )
            
set_pevidpev_viewmodel2V_MODEL );
    }
    
    
// allow player to play only with the knife    
    
if( g_Antidotid ] && get_pcvar_numtoggle_antidotknife ) == 1)
        
engclient_cmdid"weapon_knife" );
    
    return 
PLUGIN_CONTINUE;
}

/********************************* Antidote task *********************************/    

public countdowntask )
{
    new 
id task 12345;
    
    if( !
is_user_connectedid ) )
        return 
0;
        
    
set_hudmessage025500.020.2006.02.0 );
    
show_hudmessageid"Taking antidote: %d",g_Timer );
    
g_Timer--;
    
    if( 
g_Timer <= )
    {
        
// remove decreasing task
        
if( task_existsid+12345 ) )
            
remove_taskid+12345 );
        
        
g_Antidotid ] = false;
        
g_Virusedid ] = false;
        
        
Iconid0"dmg_gas",0);
        
Speedid280.0 ); // set speed back to normal
        
remove_taskid+123 );
        
        
set_hudmessage025500.020.2006.03.0 );
        
show_hudmessageid"Antidote taken!" );
        
        return 
0;
    }
    return 
0;
}

// normal glow */
public glow_normalid RenderidkRenderFxNone000kRenderNormal255 );

/********************************* Virus Effect *********************************/    

public virustask )
{
    new 
index task-123;
    
g_Countindex ]++;
    
    
// get player's health
    
new hp get_user_healthindex );
    new 
total hp p_dmg;
    
    
// get player's name
    
new name32 ];
    
get_user_nameindexname31 );
    
    if( 
total <= )
    {
        
user_killindex );
        
Iconindex0"dmg_gas"00);
        
        
Speedindex280.0 );
        
g_Countindex ] = 0;
        
        
// anounce player death
        
if( p_announce == )
        {
            
set_hudmessage020000.050.2506.03.0) ;
            
show_hudmessage0"%s was truck down by the virus!"name );
        }
    } else
        
is_user_aliveindex ) ? fm_set_user_healthindexfloattotal ) ) : remove_taskindex ); //remove hp
    
    
Fadeindex, (1<<10), (1<<10), (1<<12), g_ColorsRed ], g_ColorsGreen ], g_ColorsBlue ], 35 );
    
    
// change speed
    
if( p_speed == )
    {
        if( 
g_Countindex ] >= 5Speedindex200.0 );
        else if( 
g_Countindex ] >= 10Speedindex150.0 );
        else if( 
g_Countindex ] >= 15Speedindex100.0 );
    }
}

/********************************* Reset Hud *********************************/    

public hook_resetid )
{
    
g_Virusedid]  = false;
    
Iconid0"dmg_gas" ,00);
    
    if( 
task_existsid+123 ) )
    {
        
remove_taskid+123 );
        
        
Speedid280.0 );
        
g_Countid ] = 0;
    }
}

/********************************* Effects *********************************/    

public LightFloat:forigin] )
{
    
message_beginMSG_BROADCAST,SVC_TEMPENTITY );
    
write_byteTE_DLIGHT );
    
write_coordfloatroundforigin] ) ); 
    
write_coordfloatroundforigin] ) ); 
    
write_coordfloatroundforigin] ) ); 
    
write_byte60 );
    
write_byte);
    
write_byte185 );
    
write_byte);
    
write_byte) ;
    
write_byte60 );
    
message_end();
}

/* Smoke Effect */

public SmokeFloat:forigin] )
{
    
message_beginMSG_BROADCASTSVC_TEMPENTITY );
    
write_byteTE_SMOKE );
    
write_coordfloatroundforigin] ) );
    
write_coordfloatroundforigin] ) );
    
write_coordfloatroundforigin] ) );
    
write_shortg_smoke );
    
write_byterandom_num3040 ) );
    
write_byte);
    
message_end();
}
/* Explode stuff */

public CylinderFloat:forigin] )
{
    new 
origin];
    
FVecIVecforiginorigin );    
    
    
CreateCylinderorigin550g_explode00660002100175);
    
CreateCylinderorigin700g_explode00660002350150);
    
CreateCylinderorigin850g_explode0066001525515100);
}

/********************************* Usefull stocks  *********************************/    
/*********************************                 *********************************/

/* Usefull and less code xD - Cylinder */
CreateCylinderorigin], addradspritestartfrateframeratelifewidthamplituderedgreenbluebrightnessspeed )
{
    
message_beginMSG_BROADCASTSVC_TEMPENTITY );
    
write_byteTE_BEAMCYLINDER );
    
write_coordorigin] );
    
write_coordorigin] );
    
write_coordorigin] );
    
write_coordorigin] );
    
write_coordorigin] );
    
write_coordorigin] + addrad );
    
write_shortsprite );
    
write_bytestartfrate );
    
write_byteframerate );
    
write_byte(life );
    
write_bytewidth );
    
write_byteamplitude );
    
write_bytered );
    
write_bytegreen );
    
write_byteblue );
    
write_bytebrightness );
    
write_bytespeed );
    
message_end();
}

/* Kill player, update score, money */
Killkillervictim )
{
    
user_silentkillvictim );
    
    new 
kteam get_user_teamkiller );
    new 
vteam get_user_teamvictim );
    new 
kmoney fm_get_user_moneykiller );
    new 
kfrags;
    
    
// remove money if teamkill
    
if( kteam == vteam )
    {
        
kfrags get_user_fragskiller ) - 1;
        
fm_set_user_moneykillerkmoney 300);
    } else {
        
kfrags get_user_fragskiller ) + 1;
        
fm_set_user_moneykillerkmoney 300); // otherwise give kill bonus
    
}
    
    new 
vfrags get_user_fragsvictim );
    new 
kdeaths get_user_deathskiller );
    new 
vdeaths get_user_deathsvictim );
    
    
// update score
    
message_beginMSG_ALLg_msgscoreinfo );
    
write_bytekiller );
    
write_shortkfrags );
    
write_shortkdeaths );
    
write_short);
    
write_shortkteam );
    
message_end();
    
    
message_begin (MSG_ALLg_msgscoreinfo );
    
write_bytevictim );
    
write_shortvfrags+);
    
write_shortvdeaths );
    
write_short);
    
write_shortvteam );
    
message_end();
    
    
// set a death message
    
message_beginMSG_ALLg_msgdeathmsg, { 00}, );
    
write_bytekiller );
    
write_bytevictim );
    
write_byte);
    
write_string"virusnade" );
    
message_end();
    
    
Logkillervictim"virusnade" );
}

/* Log Kill */
Logkillervictimweapond[] )
{
    new 
Buffer256 ];
    new 
kname32 ], vname32 ];
    new 
kteam16 ], vteam16 ];
    new 
kauth32 ], vauth32 ];
    new 
kidvid;
    
    
// killer info
    
get_user_namekillerkname31 );
    
get_user_teamkillerkteam,15 );
    
get_user_authidkillerkauth,31 );
    
kid get_user_useridkiller );
    
    
// victim info
    
get_user_namevictimvname31 );
    
get_user_teamvictimvteam15 );
    
get_user_authidvictimvauth31 );
    
vid get_user_useridvictim );
    
    
// teamkill message
    
(killer == victim
    ?
        
formatBuffersizeof Buffer 1"^"%s<%d><%s><%s>^" committed suicide with ^"%s^""vnamevidvteamvauthweapond )
    :
        
formatBuffersizeof Buffer 1"^"%s<%d><%s><%s>^" killed ^"%s<%d><%s><%s>^" with ^"%s^""knamekidkteamkauthvnamevidvteamvauthweapond );
    
    
log_message"%s"Buffer );
}

/* Fakemeta Rendering */
Renderindexfx kRenderFxNone255255255render kRenderNormalamount 16 )
{
    
set_pevindexpev_renderfxfx );
    
    new 
Float:RenderColor];
    
RenderColor] = float);  
    
RenderColor] = float);  
    
RenderColor] = float); 
    
    
set_pevindexpev_rendercolorRenderColor );
    
set_pevindexpev_rendermoderender );  
    
set_pevindexpev_renderamtfloatamount ) );
    
    return 
1
}

/* Set a BeamFollow */
Followentityindexlifewidthredgreenbluealpha )
{
    
message_beginMSG_BROADCASTSVC_TEMPENTITY );
    
write_byteTE_BEAMFOLLOW );
    
write_shortentity );
    
write_shortindex );
    
write_bytelife );
    
write_bytewidth );
    
write_bytered );
    
write_bytegreen );
    
write_byteblue );
    
write_bytealpha );
    
message_end();
}

/* An usefull and advanced print stock */
print( id, const message[], { FloatSqlResult}:... )
{
    new 
Buffer128 ],Buffer2128 ];
    new 
players32 ], indexnumi;
    
    
formatexBuffer2sizeof Buffer2 1"%s",message );
    
vformatBuffersizeof Buffer 1Buffer2);
    
get_playersplayersnum"c" );
    
    if( 
id )
    {
        if( !
is_user_connectedid ))
            return;
            
        
message_beginMSG_ONEg_msgsaytext_id );
        
write_byteid );
        
write_stringBuffer );
        
message_end();
    
    } else {
        
        for( 
0num;i++ )
        {
            
index players];
            if( !
is_user_connectedindex )) 
                continue;
                
            
message_beginMSG_ONEg_msgsaytext_index );
            
write_byteindex );
            
write_stringBuffer );
            
message_end();
        }
    }
}

/* ScreenFade */
Fadeindexdurationholdtimeflagsredgreen ,bluealpha )
{
    
message_beginMSG_ONEg_msgscreenfade, { 00}, index );
    
write_shortduration );
    
write_shortholdtime );
    
write_shortflags );
    
write_bytered );
    
write_bytegreen );
    
write_byteblue) ;
    
write_bytealpha );
    
message_end();
}

/* Status Icon */
Iconindexmode 2, const sprite[], red 0green 255blue )
{
    
message_beginMSG_ONEg_msgstatusicon, { 00}, index );
    
write_bytemode );
    
write_stringsprite ); 
    
write_bytered );
    
write_bytegreen ); 
    
write_byteblue ); 
    
message_end();
}

/* ScreenShake */
Shakeindexamplitudedurationfrequency )
{
    
message_beginMSG_ONEg_msgscreenshake, { 00}, index );
    
write_shortamplitude );
    
write_shortduration );
    
write_shortfrequency );
    
message_end();
}

/* Center message */
centerindex, const message[] )
{
    if( !
is_user_connectedindex ) ) 
        return 
0;
    
    
client_printindexprint_center"%s"message );
    
    return 
1;
}

/* Get & Set user money */
fm_get_user_moneyindex )
{
    new 
money get_pdata_intindexOFFSET_MONEY );
    
    return 
money;
}
fm_set_user_moneyindexmoneyflash )
{
    
set_pdata_intindexOFFSET_MONEYmoney );
    
    
message_beginMSG_ONEg_msgmoney, {000}, index );
    
write_longmoney );
    
write_byteflash );
    
message_end();
    
    return 
1;
}

/* Get user buyzone */
fm_get_user_buyzoneindex )
{
    if( 
get_pdata_intindexOFFSET_MAPZONE ) & OFFSET_BUYZONE )
        return 
1;
    
    return 
0;
}

/* Set user health */
fm_set_user_healthindexFloathp )
{
    
message_beginMSG_ONEg_msghealth, {0,0,0}, index );
    
write_bytefloatroundhp ) );
    
message_end();
    
    
set_pevindexpev_healthhp );
}

/* Set user maxspeed */
SpeedindexFloat:speed set_pevindexpev_maxspeedspeed ); 
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
 



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 00:58.


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