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

Build Dispenser


Post New Thread Reply   
 
Thread Tools Display Modes
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 02-13-2011 , 09:31   Re: Build Dispenser
Reply With Quote #21

that is pretty and awesome work , thanks for the plugin tuty.

Trading sandball , interesting (?
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
BillThailandUP
Member
Join Date: Jul 2010
Location: Thailand [Bangkok]
Old 02-16-2011 , 06:40  
Reply With Quote #22

someone make for zombie Plague please.

PHP Code:
#include < amxmodx >
#include < amxmisc >
#include < fakemeta >
#include < hamsandwich >
#include < cstrike >
#include < engine >
#include < fun >
#include < zombieplague >

#pragma semicolon 1

#define PLUGIN_VERSION        "#1.0.1"
#define BREAK_COMPUTER        6
#define HUD_DELAYTIME        0.2

;enum
{
    
STATUS_BUILDING,
    
STATUS_ACTIVE
};

new const 
gDamageSounds[ ][ ] = 
{
    
"debris/metal1.wav",
    
"debris/metal2.wav",
    
"debris/metal3.wav"
};

new const 
gDispenserClassname[ ] = "NiceDispenser:D";

new const 
gDispenserActive[ ] = "buttons/button9.wav";
new const 
gDispenserMdl[ ] = "models/dispenser.mdl";
new const 
gMetalGibsMdl[ ] = "models/computergibs.mdl";
new const 
gHealingSprite[ ] = "sprites/laserbeam.spr";

new 
gHealingBeam;
new 
gMetalGibs;
new 
gMaxPlayers;
new 
gHudSync;

new 
gCvarEnabled;
new 
gDispenserCost;
new 
gCvarDispenserHealth;
new 
gCvarBuildTime;
new 
gCvarReplenishRadius;
new 
gCvarSpinDispenser;
new 
gCvarMaxHealth;
new 
gCvarMaxArmor;

new 
Float:gDispenserOrigin33 ][ ];
new 
gBeamcolor33 ][ ];

new 
Float:flLastHudSent33 ];
new 
Float:gDispenserHealthOff33 ];

new 
bool:bDispenserBuild33 ];

new 
g_itemid;

public 
plugin_init( )
{
    
register_plugin"[ZP] Extra: Build Dispenser"PLUGIN_VERSION"tuty" );
    
g_itemid zp_register_extra_item("Build Dispenser"10ZP_TEAM_HUMAN);
    
    
register_event"TextMsg""EVENT_TextMsg""a""2&#Game_C""2&#Game_w""2&#Game_will_restart_in" );
    
register_logevent"LOG_RoundEnd"2"1=Round_End" );
    
    
RegisterHamHam_TakeDamage"info_target""bacon_TakeDamage");
    
RegisterHamHam_TraceAttack"info_target""bacon_TraceAttack" );
    
RegisterHamHam_Player_PreThink"player""bacon_PreThink" );
    
    
register_thinkgDispenserClassname"DispenserThink" );
    
register_clcmd"drop""CommandDispenserBuild" );
    
    
gCvarEnabled register_cvar"dispenser_enabled""1" );
    
gDispenserCost register_cvar"dispenser_cost""0" );
    
gCvarDispenserHealth register_cvar"dispenser_health""300" );
    
gCvarBuildTime register_cvar"dispenser_buildtime""5" );
    
gCvarReplenishRadius register_cvar"dispenser_radius""200" );
    
gCvarSpinDispenser register_cvar"dispenser_spin""1" );
    
gCvarMaxHealth register_cvar"dispenser_playermax_health""100" );
    
gCvarMaxArmor register_cvar"dispenser_playermax_armor""100" );
    
    
gMaxPlayers get_maxplayers( );
    
gHudSync CreateHudSyncObj( );
}

public 
zp_extra_item_selectedplayeritemid )
{
    if ( 
itemid == g_itemid )
    {
        
bDispenserBuildplayer ] = true;
    }
}

public 
zp_user_infected_postid )
{
    if ( 
zp_get_user_zombieid ) )
    {
        
bDispenserBuildid ] = false;
    }
}

public 
client_connectid )
{
    
bDispenserBuildid ] = false;
}

public 
plugin_precache( )
{    
    
gHealingBeam precache_modelgHealingSprite );
    
gMetalGibs precache_modelgMetalGibsMdl );
    
    
precache_modelgDispenserMdl );
    
precache_soundgDispenserActive );
    
    new 
i;
    for( 
0sizeof gDamageSoundsi++ )
    {
        
precache_soundgDamageSounds] );
    }
}

public 
CommandDispenserBuildid )
{
    if( !
is_user_aliveid ) || get_user_weaponid ) != CSW_KNIFE || get_pcvar_numgCvarEnabled ) != )
    {
        return 
PLUGIN_CONTINUE;
    }
    
    if( !( 
pevidpev_flags ) & FL_ONGROUND ) )
    {
        
client_printidprint_chat"[AMXX] You must be on ground to build a Dispenser!" );
        
        return 
PLUGIN_HANDLED;
    }

    if( 
bDispenserBuildid ] == true )
    {
        
client_printidprint_chat"[AMXX] You already have build a Dispenser!" );
        
        return 
PLUGIN_HANDLED;
    }

    new 
iMoney cs_get_user_moneyid );
    new 
iCost get_pcvar_numgDispenserCost );
    
    if( 
iMoney iCost )
    {
        
client_printidprint_chat"[AMXX] You don't have enough money to build a Dispenser... Need(%d$)"iCost );
        
        return 
PLUGIN_HANDLED;
    }

    new 
Float:flPlayerOrigin];
    
pevidpev_originflPlayerOrigin );
    
    new 
Float:flHealth floatget_pcvar_numgCvarDispenserHealth ) );

    new 
iEntity engfuncEngFunc_CreateNamedEntityengfuncEngFunc_AllocString"info_target" ) );
    
    if( !
pev_validiEntity ) )
    {
        return 
PLUGIN_HANDLED;
    }

    
set_peviEntitypev_classnamegDispenserClassname );
    
engfuncEngFunc_SetModeliEntitygDispenserMdl );
    
engfuncEngFunc_SetSizeiEntityFloat:{ -12.0, -10.0, -12.0 }, Float:{ 12.010.012.0 } );
    
set_peviEntitypev_originflPlayerOrigin );
    
set_peviEntitypev_solidSOLID_NOT );
    
set_peviEntitypev_movetypeMOVETYPE_TOSS );
    
set_peviEntitypev_healthflHealth );
    
set_peviEntitypev_takedamageDAMAGE_YES );
    
set_peviEntitypev_iuser2id );
    
set_peviEntitypev_iuser3STATUS_BUILDING );
    
set_peviEntitypev_nextthinkget_gametime( ) + 0.1 );

    
gDispenserOriginid ][ ] = flPlayerOrigin];
    
gDispenserOriginid ][ ] = flPlayerOrigin];
    
gDispenserOriginid ][ ] = flPlayerOrigin];
    
    
gDispenserHealthOffid ] = flHealth;
    
bDispenserBuildid ] = true;
    
    
set_taskfloatget_pcvar_numgCvarBuildTime ) ), "BuildDispenserSolid"iEntity );
    
cs_set_user_moneyidiMoney iCost);
    
client_printidprint_chat"[AMXX] Building a Dispenser right here..." );
    
    return 
PLUGIN_HANDLED;
}

public 
bacon_TakeDamageentidinflictoridattackerFloat:damagedamagebits )
{
    new 
szClassname32 ];
    
peventpev_classnameszClassnamecharsmaxszClassname ) );
    
    if( 
equalszClassnamegDispenserClassname ) )
    {
        new 
iOwner peventpev_iuser2 );

        if( 
peventpev_health ) <= 0.0 )
        {
            new 
szName32 ];
            
get_user_nameidattackerszNamecharsmaxszName ) );

            new 
Float:flOrigin];
            
peventpev_originflOrigin );
                
            
UTIL_BreakModelflOrigingMetalGibsBREAK_COMPUTER );
            
set_peventpev_flagspeventpev_flags ) | FL_KILLME );

            if( 
idattacker == iOwner )
            {
                
client_printiOwnerprint_chat"[AMXX] You have destroyed your Dispenser!" );
            }

            else
            {
                
client_printiOwnerprint_chat"[AMXX] %s destroyed your Dispenser!"szName );
            }

            
client_cmdiOwner"speak ^"vox/bizwarn computer destroyed^"" );
            
bDispenserBuildiOwner ] = false;
        }
        
        
gDispenserHealthOffiOwner ] = floatpeventpev_health ) );
        
emit_soundentCHAN_STATICgDamageSoundsrandom_num0charsmaxgDamageSounds ) ) ], VOL_NORMATTN_NORM0PITCH_NORM );    
    }
}

public 
bacon_TraceAttackiVictimiAttackerFloat:flDamageFloat:flDirection], iTriDamageBits )
{
    new 
szClassname32 ];
    
peviVictimpev_classnameszClassnamecharsmaxszClassname ) );
    
    if( 
equalszClassnamegDispenserClassname ) )
    {
        new 
Float:flEndOrigin];
        
get_tr2iTrTR_vecEndPosflEndOrigin );
    
        
UTIL_SparksflEndOrigin );
    }
}    

public 
bacon_PreThinkid )
{
    if( 
get_pcvar_numgCvarEnabled ) != )
    {
        if( 
is_user_aliveid ) && bDispenserBuildid ] == true )
        {
            new 
Float:flGameTime get_gametime( );
            
            if( 
flGameTime flLastHudSentid ] > HUD_DELAYTIME )
            {
                
flLastHudSentid ] = flGameTime;

                
set_hudmessagegBeamcolorid ][ ], gBeamcolorid ][ ], gBeamcolorid ][ ], 0.00.2116.0HUD_DELAYTIME );
                
ShowSyncHudMsgidgHudSync">>>[ Dispenser ]<<<^n^nHealth Status: [%d]"floatroundgDispenserHealthOffid ] ) );
            }
        }
    }
}
            
public 
DispenserThinkiEnt )
{
    if( 
pev_validiEnt ) )
    {
        new 
iStatus peviEntpev_iuser3 );
        new 
iOwner peviEntpev_iuser2 );

        switch( 
iStatus )
        {
            case 
STATUS_BUILDING:
            {
                
set_renderingiEntkRenderFxDistort255255255kRenderTransAdd70 );
            }
            
            case 
STATUS_ACTIVE:
            {
                new 
id;
                for( 
id 1id <= gMaxPlayersid++ )
                {
                    if( 
is_user_aliveid ) && cs_get_user_teamid ) == cs_get_user_teamiOwner ) )
                    {
                        new 
Float:flOrigin], iOrigin1], iOrigin2];
                        
pevidpev_originflOrigin );
                        
                        
FVecIVecgDispenserOriginiOwner ], iOrigin1 );
                        
FVecIVecflOriginiOrigin2 );

                        if( 
get_distance_fgDispenserOriginiOwner ], flOrigin ) <= floatget_pcvar_numgCvarReplenishRadius ) ) )
                        {
                            
UTIL_GiveWeaponAmmoid );
                            
                            
// people will ask why i didn't used if and else if...
                            // because i want to recharge health and armor and ammo in same time if needed :D

                            
if( get_user_healthid ) < get_pcvar_numgCvarMaxHealth ) )
                            {
                                
set_user_healthidget_user_healthid ) + );
                            }
                            
                            if( 
get_user_armorid ) < get_pcvar_numgCvarMaxArmor ) )
                            {
                                
set_user_armoridget_user_armorid ) + );
                            }
                            
                            
UTIL_BeamEntsiOrigin1iOrigin2gBeamcoloriOwner ][ ], gBeamcoloriOwner ][ ], gBeamcoloriOwner ][ ] );
                        }
                    }
                }
            }
        }
        
        if( 
get_pcvar_numgCvarSpinDispenser ) == )
        {
            new 
Float:flAngles];
            
peviEntpev_anglesflAngles );
            
            
flAngles] += 1.0;
            
            
set_peviEntpev_anglesflAngles );
        }

        
set_peviEntpev_nextthinkget_gametime( ) + 0.1 );
    }
}

public 
BuildDispenserSolidiEntity )
{
    if( 
pev_validiEntity ) )
    {
        new 
iOwner peviEntitypev_iuser2 );

        switch( 
cs_get_user_teamiOwner ) )
        {
            case 
CS_TEAM_T:
            {
                
gBeamcoloriOwner ][ ] = 255gBeamcoloriOwner ][ ] = 0gBeamcoloriOwner ][ ] = 0;
                
set_renderingiEntitykRenderFxGlowShellgBeamcoloriOwner ][ ], gBeamcoloriOwner ][ ], gBeamcoloriOwner ][ ], kRenderNormal);
            }
        
            case 
CS_TEAM_CT:
            {
                
gBeamcoloriOwner ][ ] = 0gBeamcoloriOwner ][ ] = 0gBeamcoloriOwner ][ ] = 255;
                
set_renderingiEntitykRenderFxGlowShellgBeamcoloriOwner ][ ], gBeamcoloriOwner ][ ], gBeamcoloriOwner ][ ], kRenderNormal);
            }
        }

        
set_peviEntitypev_solidSOLID_BBOX );
        
set_peviEntitypev_iuser3STATUS_ACTIVE );
        
engfuncEngFunc_DropToFlooriEntity );
        
        
emit_soundiEntityCHAN_STATICgDispenserActiveVOL_NORMATTN_NORM0PITCH_NORM );
    }
}

public 
EVENT_TextMsg( )
{
    
UTIL_DestroyDispensers( );
}

public 
LOG_RoundEnd( )
{
    
UTIL_DestroyDispensers( );
}


/*         
    ~~~~~~~~~~~~~~~~~~~~~~~
        Stocks
    ~~~~~~~~~~~~~~~~~~~~~~~
*/


stock UTIL_DestroyDispensers( )
{
    new 
iEnt FM_NULLENT;
    
    while( ( 
iEnt find_ent_by_classiEntgDispenserClassname ) ) )
    {
        new 
iOwner peviEntpev_iuser2 );
        
        
bDispenserBuildiOwner ] = false;
        
set_peviEntpev_flagspeviEntpev_flags ) | FL_KILLME );
    }
}

stock UTIL_BreakModelFloat:flOrigin], modelflags )
{
    
engfuncEngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYflOrigin);
    
write_byteTE_BREAKMODEL );
    
engfuncEngFunc_WriteCoordflOrigin] );
    
engfuncEngFunc_WriteCoordflOrigin] );
    
engfuncEngFunc_WriteCoordflOrigin] );
    
write_coord16 );
    
write_coord16 );
    
write_coord16 );
    
write_coordrandom_num( -2020 ) );
    
write_coordrandom_num( -2020 ) );
    
write_coord10 );
    
write_byte10 );
    
write_shortmodel );
    
write_byte10 );
    
write_byte);
    
write_byteflags );
    
message_end( );
}

stock UTIL_BeamEntsiStart], iEnd], rg)
{
    
message_beginMSG_PVSSVC_TEMPENTITYiStart );
    
write_byteTE_BEAMPOINTS );
    
write_coordiStart] );
    
write_coordiStart] );
    
write_coordiStart] );
    
write_coordiEnd] );
    
write_coordiEnd] );
    
write_coordiEnd] );
    
write_shortgHealingBeam );
    
write_byte);
    
write_byte);
    
write_byte);
    
write_byte80 );
    
write_byte);
    
write_byte);
    
write_byte);
    
write_byte);
    
write_byte130 );
    
write_byte);
    
message_end( );
}

stock UTIL_GiveWeaponAmmoindex )
{
    new 
szCopyAmmoData40 ];
    
    switch( 
get_user_weaponindex ) )
    {
        case 
CSW_P228copyszCopyAmmoDatacharsmaxszCopyAmmoData ), "ammo_357sig" );
        case 
CSW_SCOUTCSW_G3SG1CSW_AK47copyszCopyAmmoDatacharsmaxszCopyAmmoData ), "ammo_762nato" );
        case 
CSW_XM1014CSW_M3copyszCopyAmmoDatacharsmaxszCopyAmmoData ), "ammo_buckshot" );
        case 
CSW_MAC10CSW_UMP45CSW_USPcopyszCopyAmmoDatacharsmaxszCopyAmmoData ), "ammo_45acp" );
        case 
CSW_SG550CSW_GALILCSW_FAMASCSW_M4A1CSW_SG552CSW_AUGcopyszCopyAmmoDatacharsmaxszCopyAmmoData ), "ammo_556nato" );
        case 
CSW_ELITECSW_GLOCK18CSW_MP5NAVYCSW_TMPcopyszCopyAmmoDatacharsmaxszCopyAmmoData ), "ammo_9mm" );
        case 
CSW_AWPcopyszCopyAmmoDatacharsmaxszCopyAmmoData ), "ammo_338magnum" );
        case 
CSW_M249copyszCopyAmmoDatacharsmaxszCopyAmmoData ), "ammo_556natobox" );
        case 
CSW_FIVESEVENCSW_P90copyszCopyAmmoDatacharsmaxszCopyAmmoData ), "ammo_57mm" );
        case 
CSW_DEAGLEcopyszCopyAmmoDatacharsmaxszCopyAmmoData ), "ammo_50ae" );
    }
    
    
give_itemindexszCopyAmmoData );
}

stock UTIL_SparksFloat:flOrigin] )
{
    
engfuncEngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYflOrigin);
    
write_byteTE_SPARKS );
    
engfuncEngFunc_WriteCoordflOrigin] );
    
engfuncEngFunc_WriteCoordflOrigin] );
    
engfuncEngFunc_WriteCoordflOrigin] );
    
message_end( );

how i can do ?
__________________
คนไทยเก่งเว้ย

Last edited by ConnorMcLeod; 03-05-2011 at 18:37. Reason: put php tags
BillThailandUP is offline
Send a message via MSN to BillThailandUP
Mini_Midget
Veteran Member
Join Date: Jan 2006
Location: It's a mystery.
Old 02-16-2011 , 21:04   Re: Build Dispenser
Reply With Quote #23

Request help in the scripting help forum or try and ask someone in the Zombie Plague forum.
__________________
It's a mystery.
Mini_Midget is offline
juan2394
Member
Join Date: Sep 2010
Old 02-16-2011 , 21:38   Re: Build Dispenser
Reply With Quote #24

Exelent idea! good work
juan2394 is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 02-17-2011 , 10:07   Re: Build Dispenser
Reply With Quote #25

Quote:
Originally Posted by Vechta View Post
Already exist?
Who f*ck*ng cares, i'm gonna do this for my server, not for the zp subforum.
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
Pote911
Junior Member
Join Date: Jan 2009
Location: Lithuania
Old 04-03-2011 , 09:40   Re: Build Dispenser
Reply With Quote #26

Can you add please same ?
dispenser_team_attack (default: 1) — Teammates can destroy dispenser

And can you add the hud message , when you aim on dispenser your teammates (show dispenser Hp and owner)
like on sentry guns plugin
__________________
Pote911 is offline
Send a message via MSN to Pote911 Send a message via Yahoo to Pote911 Send a message via Skype™ to Pote911
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-03-2011 , 13:35   Re: Build Dispenser
Reply With Quote #27

Code seems ok.

Approved.

Optional changes but strongly recommended :
  • About spin, you better use pev_avelocity on z axis. So you let the engine doing the job and the movement will be more smooth.
  • Use the multilingual system.
  • Use a constant to define 32, like const MaxPlayers = 32. For readability and better understanding.
  • You use engine module, so use create_entity directly. More short/readable/efficient.
  • In DispenserThink(), you use FVecIVec UTIL_BeamEnts(), simply use EngFunc_WriteCoord to allow float like the other message.
  • Fix your indention in UTIL_IsVisible().
__________________
Arkshine is offline
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 11-08-2011 , 14:52   Re: Build Dispenser
Reply With Quote #28

[*]About spin, you better use pev_avelocity on z axis. So you let the engine doing the job and the movement will be more smooth.
[i like the model animation]
[*]Use the multilingual system. [soon]
[*]Use a constant to define 32, like const MaxPlayers = 32. For readability and better understanding. [done]
[*]You use engine module, so use create_entity directly. More short/readable/efficient. [done]
[*]In DispenserThink(), you use FVecIVec UTIL_BeamEnts(), simply use EngFunc_WriteCoord to allow float like the other message. [done]
[*]Fix your indention in UTIL_IsVisible(). [done]
__________________
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
shubhamgulati12
Senior Member
Join Date: Oct 2010
Location: Inida The Holy Place!!
Old 04-22-2012 , 08:37   Re: Build Dispenser
Reply With Quote #29

My Server laggs horrible in between i mean to say that pings go from 30 to 200 and all gets lagged
and when i change map everything back to normal same number of players still.
and 1 more bug i noticed is that the dispenser sometimes goes inside the floor making me horribly amazed because it goes slowly slowly infront of us after building inside the floor
makes feel lolness
but it is a problem because the played who made cannot make new until previous one is destroyed
and cant locate it making impossible to take hp and armor

Here is the logs:
L 04/18/2012 - 18:49:59: [CSTRIKE] Invalid player 2
L 04/18/2012 - 18:49:59: [AMXX] Displaying debug trace (plugin "BuildDispenser.amxx")
L 04/18/2012 - 18:49:59: [AMXX] Run time error 10: native error (native "cs_get_user_team")
L 04/18/2012 - 18:49:59: [AMXX] [0] BuildDispenser.sma:ispenserThink (line 260)


Any Solutions for it , please let me know..
__________________

Join Free File hosting - http://db.tt/VvebKSSW
[Free 2 GB cloud storage]

Last edited by shubhamgulati12; 10-15-2012 at 09:16.
shubhamgulati12 is offline
Dr Zayd
Senior Member
Join Date: Jun 2014
Location: forums.alliedmods.net
Old 09-11-2014 , 10:02   Re: Build Dispenser
Reply With Quote #30

Nice Plugin
__________________
Invisible System | 100%
ـــــــــــــــــــــــــــــ
Anti setinfo check | Ez Plugin and lite
ـــــــــــــــــــــــــــــ
[ZP] Free VIP Menu | Free VIP menu | ZP-Mod |
Dr Zayd is offline
Reply


Thread Tools
Display Modes

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 01:42.


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