Raised This Month: $ Target: $400
 0% 

Christmas tree


Post New Thread Reply   
 
Thread Tools Display Modes
lazarev
Veteran Member
Join Date: Sep 2008
Old 12-29-2009 , 15:14   Re: Christmas tree
Reply With Quote #11

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

new const MODEL[ ] = "models/xmas/xmas_tree.mdl";
new const 
MODEL_CT[ ] = "models/player/xmas_ct/xmas_ct.mdl";
new const 
MODEL_T[ ] = "models/player/xmas_t/xmas_t.mdl";

new 
g_szConfigFile128 ];

public 
plugin_init( ) {
    
register_plugin"Christmas tree spawner + snow + santa models""1.2""xPaw & Juice" );
    
    
register_clcmd"say /tree""CmdTreeMenu" );
    
    
RegisterHamHam_Spawn"player""HamPlayerSpawnPost");
}

public 
plugin_precache( ) {
    
precache_modelMODEL );
    
precache_modelMODEL_CT );
    
precache_modelMODEL_T );
    
    
create_entity"env_snow" );
}

public 
plugin_cfg( ) {
    new 
szMapName32 ];
    
get_mapnameszMapName31 );
    
strtolowerszMapName );
    
    
formatexg_szConfigFile127"addons/amxmodx/data/trees" );
    
    if( !
dir_existsg_szConfigFile ) ) {
        
mkdirg_szConfigFile );
        
        
formatg_szConfigFile127"%s/%s.txt"g_szConfigFileszMapName );
        
        return;
    }
    
    
formatg_szConfigFile127"%s/%s.txt"g_szConfigFileszMapName );
    
    if( !
file_existsg_szConfigFile ) )
        return;
    
    
LoadTrees( );

}

public 
HamPlayerSpawnPostid ) {
    if ( 
is_user_aliveid ) ) {
        switch( 
cs_get_user_teamid ) ) {
            case 
CS_TEAM_CTcs_set_user_modelid"xmas_ct" );
            case 
CS_TEAM_Tcs_set_user_modelid"xmas_t" );
        }
    }
}

public 
CmdSpawnTreeid ) {
    if( !
accessidADMIN_MAP ) ) return PLUGIN_HANDLED;
    
    new 
Float:vOrigin];
    
entity_get_vectoridEV_VEC_originvOrigin );
    
    
CreateTreevOrigin )
    
    return 
PLUGIN_HANDLED;
}

public 
CmdSpawnRemoveid ) {
    if( !
accessidADMIN_MAP ) ) return PLUGIN_HANDLED;
    
    new 
Float:vOrigin], szClassName10 ], iEntity = -1iDeleted;
    
entity_get_vectoridEV_VEC_originvOrigin );
    
    while( ( 
iEntity find_ent_in_sphereiEntityvOrigin100.0 ) ) > ) {
        
entity_get_stringiEntityEV_SZ_classnameszClassName);
        
        if( 
equalszClassName"env_tree" ) ) {
            
remove_entityiEntity );
            
            
iDeleted++;
        }
    }
    
    if( 
iDeleted )
        
SaveTrees( );
    
    
console_printid"[AMXX] Deleted %i trees.%s"iDeletediDeleted == " You need to stand in tree to remove it" "" );
    
    return 
PLUGIN_HANDLED;
}

public 
CmdTreeMenuid )
{
    if( !
accessidADMIN_MAP ) ) return PLUGIN_HANDLED;
    
ShowTreeMenuid );
    
    return 
PLUGIN_HANDLED;
}

ShowTreeMenuid )
{
    new 
menu menu_create"Tree Menu""TreeMenu" );
    
    
menu_additemmenu"Create Tree""1"ADMIN_MAP );
    
menu_additemmenu"Delete Tree""2"ADMIN_MAP );
    
menu_additemmenu"Save Menu""3"ADMIN_MAP );
    
    
menu_displayidmenu );
}

ShowSaveMenuid )
{
    new 
menu menu_create"Save Tree Menu""SaveMenu" );
    
    
menu_additemmenu"Load Saved Trees""1"ADMIN_MAP );
    
menu_additemmenu"Remove All Trees""2"ADMIN_MAP );
    
menu_additemmenu"Save Trees^n""3"ADMIN_MAP );
    
menu_additemmenu"Back""4"ADMIN_MAP );
    
    
menu_displayidmenu );
}

public 
TreeMenuidmenuitem )
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroymenu );
        return;
    }
    
    new 
_accessinfo], callback;
    
menu_item_getinfomenuitem_accessinfosizeof(info) - 1__callback );
    
menu_destroymenu );
    
    switch( 
str_to_num(info) )
    {
        case 
1:
        {
            
CmdSpawnTreeid );
            
ShowTreeMenuid );
        }
        case 
2:
        {
            
CmdSpawnRemoveid );
            
ShowTreeMenuid );
        }
        case 
3:
        {
            
ShowSaveMenuid );
        }
    }
}

public 
SaveMenuidmenuitem )
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroymenu );
        return;
    }
    
    new 
_accessinfo], callback;
    
menu_item_getinfomenuitem_accessinfosizeof(info) - 1__callback );
    
menu_destroymenu );
    
    switch( 
str_to_numinfo ) )
    {
        case 
1:
        {
            
RemoveAllTrees( );
            
LoadTrees( );
            
ShowSaveMenuid );
        }
        case 
2:
        {
            
RemoveAllTrees( );
            
ShowSaveMenuid );
        }
        case 
3:
        {    
            
SaveTrees( );
            
ShowSaveMenuid );
        }
        case 
4:
        {
            
ShowTreeMenuid );
        }
    }
}

CreateTree( const Float:vOrigin] ) {
    new 
iEntity create_entity"info_target" );
    
    if( !
iEntity )
        return 
0;
    
    
entity_set_stringiEntityEV_SZ_classname"env_tree" );
    
entity_set_intiEntityEV_INT_solidSOLID_BBOX );
    
entity_set_intiEntityEV_INT_movetypeMOVETYPE_NONE );
    
    
entity_set_sizeiEntityFloat:{ -1.0, -1.0, -1.0 }, Float:{ 1.01.036.0 } );
    
entity_set_originiEntityvOrigin );
    
entity_set_modeliEntityMODEL );
    
    
drop_to_flooriEntity );
    
    return 
iEntity;
}

SaveTrees( ) {
    if( 
file_existsg_szConfigFile ) )
        
delete_fileg_szConfigFile );
    
    new 
iFile fopeng_szConfigFile"wt" );
    
    if( !
iFile )
        return;
    
    new 
Float:vOrigin], iEntity;
    
    while( ( 
iEntity find_ent_by_classiEntity"env_tree" ) ) > ) {
        
entity_get_vectoriEntityEV_VEC_originvOrigin );
        
        
fprintfiFile"%f %f %f^n"vOrigin], vOrigin], vOrigin] );
    }
    
    
fcloseiFile );
}

LoadTrees( ) {
    new 
iFile fopeng_szConfigFile"rt" );
    
    if( !
iFile )
        return;
    
    new 
Float:vOrigin], x16 ], y16 ], z16 ], szDatasizeof) + sizeof) + sizeof) + ];
    
    while( !
feofiFile ) ) {
        
fgetsiFileszDatacharsmaxszData ) );
        
trimszData );
        
        if( !
szData] )
            continue;
        
        
parseszDatax15y15z15 );
        
        
vOrigin] = str_to_float);
        
vOrigin] = str_to_float);
        
vOrigin] = str_to_float);
        
        
CreateTreevOrigin );
    }
    
    
fcloseiFile );
}

RemoveAllTrees( ) {
    new 
iEntity = -1;
        
    while( ( 
iEntity find_ent_by_class(iEntity"env_tree") ) )
        
remove_entityiEntity );

lazarev is offline
Leutrim220
New Member
Join Date: Sep 2010
Old 11-12-2010 , 15:09   Re: Christmas tree
Reply With Quote #12

lazarev ! What to write to get the menu upp /tree wont work !!
Leutrim220 is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 11-12-2010 , 15:12   Re: Christmas tree
Reply With Quote #13

Quote:
Originally Posted by Leutrim220 View Post
lazarev ! What to write to get the menu upp /tree wont work !!
Make sure you have the "map" admin flag (flag "f").
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
kanqz
Member
Join Date: Apr 2010
Location: Portugal
Old 11-26-2011 , 07:38   Re: Christmas tree
Reply With Quote #14

hi. You can edit the plugin to get santa hat T + CT; Tree and Snow man?
__________________
kanqz is offline
mirko1122
New Member
Join Date: Dec 2012
Old 12-03-2012 , 03:09   Re: Christmas tree
Reply With Quote #15

can u put it in amxx format?
mirko1122 is offline
Send a message via AIM to mirko1122 Send a message via Yahoo to mirko1122 Send a message via Skype™ to mirko1122
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 12-03-2012 , 08:08   Re: Christmas tree
Reply With Quote #16

Quote:
Originally Posted by mirko1122 View Post
can u put it in amxx format?
No, but you can. Just compile it yourself
__________________
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
mirko1122
New Member
Join Date: Dec 2012
Old 12-03-2012 , 11:51   Re: Christmas tree
Reply With Quote #17

didn't know it was this simple to compile
mirko1122 is offline
Send a message via AIM to mirko1122 Send a message via Yahoo to mirko1122 Send a message via Skype™ to mirko1122
mirko1122
New Member
Join Date: Dec 2012
Old 12-06-2012 , 16:03   Re: Christmas tree
Reply With Quote #18

reliable channel overflowed error, kicks players out after sometime,does anyone know what is the problem
mirko1122 is offline
Send a message via AIM to mirko1122 Send a message via Yahoo to mirko1122 Send a message via Skype™ to mirko1122
treesen
New Member
Join Date: Jul 2021
Old 07-12-2021 , 11:21   Re: Christmas tree
Reply With Quote #19

Is there an updated version of this?.

Last edited by treesen; 07-12-2021 at 11:22.
treesen is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-12-2021 , 20:41   Re: Christmas tree
Reply With Quote #20

Why do you think this plugin needs an updated version??
__________________
fysiks 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 17:49.


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