Skocz do zawartości

Witamy w Nieoficjalnym polskim support'cie AMX Mod X

Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

Zdjęcie

[M24] Grenade New 1.0


  • Nie możesz napisać tematu
  • Zaloguj się, aby dodać odpowiedź
Brak odpowiedzi do tego tematu

#1 Adminek AMXX.PL

    Admin :)

  • Bot

Reputacja: 156
Profesjonalista

  • Postów:7 492
  • Lokalizacja:AMXX.PL
Offline

Napisano 18.06.2014 01:42


السلام عليكم ورحمة الله وبركاته.
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
.

http://perfect-soft.su/_ld/30/77668065.png" border="0" alt="" />



PHP Code:







/* Plugin generated by AMXX-Studio */



#include 

#include 

#include 

#include 



#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












https://forums.alliedmods.net/images/attach/sma.gif" alt="File Type: sma" width="16" height="16" border="0" style="vertical-align:baseline" />

http://www.amxmodx.org/plcompiler_vb.cgi?file_id=134607">Get Plugin or
https://forums.alliedmods.net/attachment.php?attachmentid=134607&d=1403052123">Get Source (M24_grenade.sma - 7.6 KB)

https://forums.alliedmods.net/images/attach/zip.gif" alt="File Type: zip" width="16" height="16" border="0" style="vertical-align:baseline" />


https://forums.alliedmods.net/attachment.php?attachmentid=134609&d=1403052578">m24(by driss).zip (168.3 KB)










Wyświetl pełny artykuł






Użytkownicy przeglądający ten temat: 0

0 użytkowników, 0 gości, 0 anonimowych