Raised This Month: $51 Target: $400
 12% 

Help Grenade Think


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
LondoN
Senior Member
Join Date: Dec 2015
Location: Roman, Romania.
Old 01-21-2016 , 14:12   Help Grenade Think
Reply With Quote #1

Code:
#include < amxmodx >
#include < amxmisc >
#include < fakemeta >
#include < hamsandwich >
#include < engine >

new g_ExploSpr;
new SpriteLocation [ 64 ];
new MessageFade, MessageShake, MessageText;

const PEV_NADE_TYPE = pev_flTimeStepSound;
const PEV_NADE_SMOKE = 4444;

// zombieplague.inc
native zp_get_user_zombie ( id );

public plugin_init ( )
{
    register_plugin ( "Ultimate Smoke", "2.0", "LondoN eXtream" );
    
    RegisterHam ( Ham_Think, "grenade", "smoke_ult" );
    
    MessageFade = get_user_msgid ( "ScreenFade" );
    MessageShake = get_user_msgid ( "ScreenShake" );
    MessageText = get_user_msgid ( "SayText" );
    
    // Deactivate Flare
    set_cvar_string ( "zp_flare_enabled", "0" );
}

public plugin_precache ( )
{
    formatex ( SpriteLocation, sizeof ( SpriteLocation ) -1, "sprites/Smoke/smoke_explode.spr" );
    g_ExploSpr = engfunc ( EngFunc_PrecacheModel, SpriteLocation );
}

public smoke_ult ( entity )
{
    if ( !pev_valid ( entity ) )
        return HAM_IGNORED;
    
    new Float:dmgtime;
    pev ( entity, pev_dmgtime, dmgtime );
    if ( dmgtime > get_gametime ( ) )
        return HAM_IGNORED;
    
    if ( pev ( entity, PEV_NADE_TYPE ) != PEV_NADE_SMOKE )
        return PLUGIN_HANDLED;
    
    SQL_MakeSmoke ( entity );
    engfunc ( EngFunc_RemoveEntity, entity );
    return HAM_IGNORED;
}

public SQL_MakeSmoke ( entity )
{
    // --- Float's ---
    // ---------------
    new Float: Origin [ 3 ];
    new Float: FOrigin [ 3 ];
    new Float: Velocity [ 3 ];
    new Float: Distance;
    new Float: Damage;
    
    // --- Variables ---
    // -----------------
    new Special [ 3 ];
    new Name [ 32 ];
    
    // --- Other's ---
    // ---------------
    new Health;
    new Owner;
    new i;
    
    pev ( entity, pev_origin, Origin );
    FVecIVec ( Origin, Special );
    
    Owner = pev ( entity, pev_owner );
    
    if ( !pev_valid ( Owner ) || !is_user_connected ( Owner ) || !is_user_alive ( Owner ) ) {
        engfunc ( EngFunc_RemoveEntity, entity );
        return HAM_IGNORED;
    }
    
    
    engfunc ( EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, FOrigin, 0 );
    write_byte ( TE_SPRITETRAIL );                     // Sprite Effect
    engfunc ( EngFunc_WriteCoord, Special [ 0 ] );   // X
    engfunc ( EngFunc_WriteCoord, Special [ 1 ] );   // Y
    engfunc ( EngFunc_WriteCoord, Special [ 2 ] );   // Z
    engfunc ( EngFunc_WriteCoord, Special [ 0 ] );   // X
    engfunc ( EngFunc_WriteCoord, Special [ 1 ] );   // Y
    engfunc ( EngFunc_WriteCoord, Special [ 2 ] );   // Z
    write_short ( g_ExploSpr );                        // Sprite 
    write_byte ( 100 );                                 // Amount
    write_byte ( 1 );                                   // Life
    write_byte ( 2 );                                   // Witdh
    write_byte ( 60 );                                  // Speed
    write_byte ( 60 );                                  // Speed
    message_end ( );
    
    for ( i = 1; i <= get_maxplayers ( ); i++ ) {
        if ( !is_user_alive ( i ) && !zp_get_user_zombie ( i ) )
            return HAM_IGNORED;
        
        pev ( i, pev_origin, FOrigin );
        pev ( i, pev_velocity, Velocity );
        
        Distance = get_distance_f ( Origin, FOrigin )
        if ( Distance < 330 ) {
            Damage = float ( floatround ( 700.0 - Distance ) );
            Health = get_user_health ( i );
            
            // -- Velocity Set --
            // -------------------
            Velocity [ 0 ] += random_float ( -230.0, 230.0 );
            Velocity [ 1 ] += random_float ( -230.0, 230.0 );
            Velocity [ 2 ] += random_float ( 60.0, 129.0 );
            
            set_pev ( i, pev_velocity, Velocity );
            
            // -- Fade Screen --
            // ------------------
            message_begin ( MSG_ONE_UNRELIABLE, MessageFade, _, i );
            write_short ( 4096 );                  // ??
            write_short ( 4096 );                  // ??
            write_short ( 0x0000 );                // FFADE_IN
            write_byte ( 255 );                    // RED
            write_byte ( 0 );                      // GREEN
            write_byte ( 0 );                      // BLUE
            write_byte ( 220 );                    // ?
            message_end ( );
            
            
            // -- Shake Screen --
            // ------------------
            message_begin ( MSG_ONE_UNRELIABLE, MessageShake, _, i );
            write_short ( 4096 * 6 );
            write_short ( 4096 * random_num ( 4, 12 ) );
            write_short ( 4096 * random_num ( 4, 12 ) );
            message_end ( );
            
            // -- Take Damage --
            // -----------------
            if ( Health - Damage < 0 )
                ExecuteHamB ( Ham_Killed, i, Owner, 2 );
            else
                ExecuteHamB ( Ham_TakeDamage, i, entity, Owner, Damage, DMG_MORTAR );
            
            get_user_name ( i, Name, sizeof ( i ) -1 );
            ColorChat ( Owner, "!x04[Zombie OutStanding] !x03Damage to !x04%s !x03:: !x04%i", Name, Damage );
        }
    }
    
    return HAM_IGNORED;
}

stock ColorChat(const id, const input[], any:...) {
    new count = 1, players[32];
    static msg[191];
    vformat(msg, 190, input, 3);
    
    replace_all(msg, 190, "!x04", "^4");
    replace_all(msg, 190, "!x03", "^3");
    
    if(id) players[0] = id;
    else get_players(players, count, "ch"); {
        for(new i = 0; i < count; i++) {
            if(is_user_connected(players[i])) {
                message_begin(MSG_ONE_UNRELIABLE, MessageText, _, players[i]);
                write_byte(players[i]);
                write_string(msg);
                message_end();
            }
        }
    }
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1252\\ deff0\\ deflang1033{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par }
*/
compiling but doesn't work, why?
__________________
LondoN is offline
Old 01-21-2016, 14:39
addons_zz
This message has been deleted by addons_zz. Reason: wrong section
bakir123
Senior Member
Join Date: Jan 2015
Location: Palestine, Hebron
Old 01-22-2016 , 14:34   Re: Help Grenade Think
Reply With Quote #2

if you use it for zp 4.3 or zpa , it's will not work , because , you already have code for flare nade in zpa or 4,3 , so you need to remove code flare remove zp main code you are using , you can't active 2 flare on same time!
bakir123 is offline
Send a message via Skype™ to bakir123
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 00:14.


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