This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

[M24] Grenade New 1.0.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Drissdev1
Senior Member
Join Date: Jun 2014
Old 06-17-2014 , 20:08   [M24] Grenade New 1.0.
Reply With Quote #1

Today offer you (plugin) of my invention, and I hope that you like it receives.
Please accept my translation (Googel).


/// Cvar...
m24_remove_dropped 0 / On / Off
m24_smoke_grenades 1 / On / Off
.



PHP Code:
/* Plugin generated by AMXX-Studio */

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

#define VERSION "0.1"


const PEV_NADE_TYPE pev_flTimeStepSound
const NADE_TYPE_SMOKE 4444


/// Sound Greande M24.
new const g_soundexpl[] = "weapons/m24_exp1.wav"
////

new cvar_removedroppedcvar_smokegrenadesg_msgScreenShakeg_msgScreenFade
new g_trailSpr


new const Float:RADIUS 240.0

#define JUMP_EXP        500.0
#define JUMP_DAMAGE        20

#define PA_LOW  25.0
#define PA_HIGH 50.0

new g_index_gibsspriteexpl

public plugin_precache()
{

    
g_index_gibs precache_model("models/rockgibs.mdl")
    
g_trailSpr precache_model("sprites/laserbeam.spr")
    
spriteexpl precache_model("sprites/fexplo1.spr")
    
engfunc(EngFunc_PrecacheSoundg_soundexpl)
}

public 
plugin_init()
{
    
register_plugin("[M24] Grenade"VERSION"Driss")
    
    
register_forward(FM_SetModel"fw_SetModel")
    
RegisterHam(Ham_Think"grenade""fw_ThinkGrenade")

    
    
/// Cvar
    
cvar_removedropped register_cvar("m24_remove_dropped""0")
    
cvar_smokegrenades register_cvar("m24_smoke_grenades""1"// Cvar On/off :)

    
    
g_msgScreenFade get_user_msgid("ScreenFade")
    
g_msgScreenShake get_user_msgid("ScreenShake")
}

public 
fw_SetModel(entity, const model[])
{
    
// We don't care
    
if (strlen(model) < 8)
        return;
    
    
// Remove weapons?
    
if (get_pcvar_float(cvar_removedropped) > 0.0)
    {
        
// Get entity's classname
        
static classname[10]
        
pev(entitypev_classnameclassnamecharsmax(classname))
        
        
// Check if it's a weapon box
        
if (equal(classname"weaponbox"))
        {
            
// They get automatically removed when thinking
            
set_pev(entitypev_nextthinkget_gametime() + get_pcvar_float(cvar_removedropped))
            return;
        }
    }
    
    
// Narrow down our matches a bit
    
if (model[7] != 'w' || model[8] != '_')
        return;
    
    
// Get damage time of grenade
    
static Float:dmgtime
    pev
(entitypev_dmgtimedmgtime)
    
    
// Grenade not yet thrown
    
if (dmgtime == 0.0)
        return;
    
    else if (
model[9] == 's' && model[10] == 'm' && get_pcvar_num(cvar_smokegrenades)) // Flare
    
{
        
fm_set_rendering(entitykRenderFxGlowShell07010kRenderNormal16);
        
        
// And a colored trail
        
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
        
write_byte(TE_BEAMFOLLOW// TE id
        
write_short(entity// entity
        
write_short(g_trailSpr// sprite
        
write_byte(10// life
        
write_byte(10// width
        
write_byte(0// r
        
write_byte(70// g
        
write_byte(10// b
        
write_byte(200// brightness
        
message_end()
        
// Set grenade type on the thrown grenade entity
        
set_pev(entityPEV_NADE_TYPENADE_TYPE_SMOKE)
    }
}

// Ham Grenade Think Forward
public fw_ThinkGrenade(entityptd)
{
    
// Invalid entity
    
if (!pev_valid(entity)) return HAM_IGNORED;
    
    
// Get damage time of grenade
    
static Float:dmgtimeFloat:current_time
    pev
(entitypev_dmgtimedmgtime)
    
current_time get_gametime()
    
    
// Check if it's time to go off
    
if (dmgtime current_time)
        return 
HAM_IGNORED;
    
    
// Check if it's one of our custom nades
    
switch (pev(entityPEV_NADE_TYPE))
    {
        case 
NADE_TYPE_SMOKE// M24
        
{
            
bomb_Explode(entity)
            return 
HAM_SUPERCEDE;
        }

    }
    
    return 
HAM_IGNORED;
}

public 
bomb_Explode(Entity)
{
    if(
Entity 0)
        return
       
    static 
Float:Origin[3]
    
pev(Entitypev_originOrigin)
    
    
heart_explode(Entity)
    
make_metal_gibs(Entity)
    
      
    for(new 
victim 1victim <= get_maxplayers(); victim++)
    {
        if (!
is_user_alive(victim))
            continue
                  
        new 
Float:VictimOrigin[3]
        
pev(victimpev_originVictimOrigin)
                   
        new 
Float:Distance get_distance_f(OriginVictimOrigin)   
                   
        if(
Distance <= RADIUS)
        {
            static 
Float:NewSpeed

            NewSpeed 
JUMP_EXP * (1.0 - (Distance RADIUS))
                           
            static 
Float:Velocity[3]
            
get_speed_vector(OriginVictimOriginNewSpeedVelocity)
                           
            
set_pev(victimpev_velocityVelocity)
            
            new 
Float:fVec[3];
            
fVec[0] = random_float(PA_LOW PA_HIGH);
            
fVec[1] = random_float(PA_LOW PA_HIGH);
            
fVec[2] = random_float(PA_LOW PA_HIGH);
            
entity_set_vector(victimEV_VEC_punchangle fVec);
            
message_begin(MSG_ONE g_msgScreenShake , {0,0,0} ,victim)
            
write_short1<<14 );
            
write_short1<<14 );
            
write_short1<<14 );
            
message_end();

            
message_begin(MSG_ONE_UNRELIABLE g_msgScreenFade , {0,0,0} , victim);
            
write_short1<<10 );
            
write_short1<<10 );
            
write_short1<<12 );
            
write_byte225 );
            
write_byte);
            
write_byte);
            
write_byte125 );
            
message_end();

            
set_user_takedamage(victimJUMP_DAMAGE)

        }
    }
    
engfunc(EngFunc_RemoveEntityEntity)


public 
heart_explode(ent)
{
    static 
Float:flOrigin ]
    
pev entpev_originflOrigin )
    
    
engfunc(EngFunc_EmitSoundentCHAN_WEAPON,g_soundexpl1.0ATTN_NORM0PITCH_NORM)
    
engfunc(EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYflOrigin0)
    
write_byte(TE_SPRITE)
    
engfunc(EngFunc_WriteCoordflOrigin[0]+random_float(-5.05.0))
    
engfunc(EngFunc_WriteCoordflOrigin[1]+random_float(-5.05.0))
    
engfunc(EngFunc_WriteCoordflOrigin[2]+50.0)
    
write_short(spriteexpl)
    
write_byte(30)
    
write_byte(200)
    
message_end()    
}


public 
make_metal_gibs(ent)
{
    static 
Float:flOrigin[3]
    
pev(entpev_originflOrigin)
    
    
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
    
write_byte(TE_BREAKMODEL)
    
engfunc(EngFunc_WriteCoordflOrigin[0])
    
engfunc(EngFunc_WriteCoordflOrigin[1])
    
engfunc(EngFunc_WriteCoordflOrigin[2])
    
engfunc(EngFunc_WriteCoord150)
    
engfunc(EngFunc_WriteCoord150)
    
engfunc(EngFunc_WriteCoord150)
    
engfunc(EngFunc_WriteCoordrandom_num(-50,50))
    
engfunc(EngFunc_WriteCoordrandom_num(-50,50))
    
engfunc(EngFunc_WriteCoordrandom_num(-50,50))
    
write_byte(30)
    
write_short(g_index_gibs)
    
write_byte(random_num(2030))
    
write_byte(20)
    
write_byte(0x04//0x02 - metal
    
message_end()
}


stock get_speed_vector(const Float:origin1[3],const Float:origin2[3],Float:speedFloat:new_velocity[3])
{
    
new_velocity[0] = origin2[0] - origin1[0]
    
new_velocity[1] = origin2[1] - origin1[1]
    
new_velocity[2] = origin2[2] - origin1[2]
    new 
Float:num floatsqroot(speed*speed / (new_velocity[0]*new_velocity[0] + new_velocity[1]*new_velocity[1] + new_velocity[2]*new_velocity[2]))
    
new_velocity[0] *= num
    new_velocity
[1] *= num
    new_velocity
[2] *= num

    
return 1
}    

stock set_user_takedamage(indexdamage)
{
    if(!
is_user_alive(index))
        return

    new 
vec[3]
    
FVecIVec(get_target_origin_f(index), vec)

    
message_begin(MSG_ONEget_user_msgid("Damage"), _index)
    
write_byte(0)
    
write_byte(damage)
    
write_long(DMG_CRUSH)
    
write_coord(vec[0]) 
    
write_coord(vec[1])
    
write_coord(vec[2])
    
message_end()

    if(
pev(indexpev_health) - 20.0 <= 0)
        
ExecuteHamB(Ham_Killedindexindex1)
    else 
ExecuteHamB(Ham_TakeDamageindex0indexfloat(damage), DMG_BLAST)
}

stock Float:get_target_origin_f(index)
{
    new 
Float:orig[3]
    
pev(indexpev_originorig)

    if(
index get_maxplayers())
    {
        new 
Float:mins[3], Float:maxs[3]
        
pev(indexpev_minsmins)
        
pev(indexpev_maxsmaxs)
        
        if(!
mins[2]) orig[2] += maxs[2] / 2
    
}
    return 
orig
}

// 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))
}
/// Thanks ([SIZE="5"]ArabicMan[/SIZE]) 
Attached Files
File Type: sma Get Plugin or Get Source (M24_grenade.sma - 619 views - 7.6 KB)
File Type: zip m24(by driss).zip (168.3 KB, 93 views)

Last edited by YamiKaitou; 06-17-2014 at 20:25.
Drissdev1 is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 06-17-2014 , 20:26   Re: [M24] Grenade New 1.0.
Reply With Quote #2

AMXX files removed, do not upload them again

Is this a plugin release or a request?
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Drissdev1
Senior Member
Join Date: Jun 2014
Old 06-17-2014 , 20:31   Re: [M24] Grenade New 1.0.
Reply With Quote #3

Free (plugin)
Drissdev1 is offline
Drissdev1
Senior Member
Join Date: Jun 2014
Old 06-17-2014 , 20:35   Re: [M24] Grenade New 1.0.
Reply With Quote #4

Unfortunately I had to put it here
(New Plugin Submissions)
Drissdev1 is offline
Reply



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 15:35.


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