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

[M24] Grenade New 1.0


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Admin Commands       
Drissdev1
Senior Member
Join Date: Jun 2014
Old 06-17-2014 , 20:42   [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 (ArabicMan)
Attached Files
File Type: sma Get Plugin or Get Source (M24_grenade.sma - 1290 views - 7.6 KB)
File Type: zip m24(by driss).zip (168.3 KB, 459 views)

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

What part of
Quote:
Originally Posted by YamiKaitou View Post
AMXX files removed, do not upload them again
did you not understand?
__________________
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 , 21:12   Re: [M24] Grenade New 1.0
Reply With Quote #3

Why pursuing me?
Drissdev1 is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 06-17-2014 , 21:21   Re: [M24] Grenade New 1.0
Reply With Quote #4

Quote:
Originally Posted by Drissdev1 View Post
Why pursuing me?
I'm not, I'm just relaying what I told you before that you ignored
__________________
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 , 21:24   Re: [M24] Grenade New 1.0
Reply With Quote #5

Well thanks for the information and sorry (google)
Drissdev1 is offline
ArabicMan
Veteran Member
Join Date: Feb 2014
Location: مصر
Old 06-18-2014 , 00:44   Re: [M24] Grenade New 1.0
Reply With Quote #6

Good job anyway .
ArabicMan is offline
yokomo
Surprise Ascot!
Join Date: May 2010
Location: Malaysia
Old 06-18-2014 , 03:12   Re: [M24] Grenade New 1.0
Reply With Quote #7

I'm sure you just copy paste and edit from ZP grenade.

This part of code is not needed:
PHP Code:
    // 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; 
        } 
    } 
Why need to remove dropped weaponbox?
__________________
Team-MMG CS1.6 Servers:
✅ MultiMod -- 103.179.44.152:27016
✅ Zombie Plague -- 103.179.44.152:27015
✅ Zombie Escape -- 103.179.44.152:27017
✅ Klassik Kombat -- 103.179.44.152:27018
✅ Boss-Battle -- 103.179.44.152:27019
yokomo is offline
EthicalHacker007
Veteran Member
Join Date: May 2014
Old 06-18-2014 , 03:43   Re: [M24] Grenade New 1.0
Reply With Quote #8

You should add a good description. From your current description, it seems to be some kind of smoke grenade?
__________________
EthicalHacker007 is offline
ezio_auditore
Senior Member
Join Date: May 2013
Old 06-18-2014 , 10:40   Re: [M24] Grenade New 1.0
Reply With Quote #9

Quote:
Originally Posted by EthicalHacker007 View Post
You should add a good description. From your current description, it seems to be some kind of smoke grenade?
What kind of Description is this
Without any description and your code only??
__________________
ezio_auditore is offline
Send a message via Skype™ to ezio_auditore
Dr Zayd
Senior Member
Join Date: Jun 2014
Location: forums.alliedmods.net
Old 06-26-2014 , 11:00   Re: [M24] Grenade New 1.0
Reply With Quote #10

Thanx I'll Add It To My Zombie PLague 1.6.1 haha
__________________
Invisible System | 100%
ـــــــــــــــــــــــــــــ
Anti setinfo check | Ez Plugin and lite
ـــــــــــــــــــــــــــــ
[ZP] Free VIP Menu | Free VIP menu | ZP-Mod |
Dr Zayd is offline
Old 08-17-2014, 21:26
Ghost Svng
This message has been deleted by YamiKaitou. Reason: spam
Old 08-17-2014, 22:59
GinNNy
This message has been deleted by hornet. Reason: Unecessary
Old 08-18-2014, 11:37
Ghost Svng
This message has been deleted by hornet. Reason: Spam
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 03:58.


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