Raised This Month: $ Target: $400
 0% 

Half-Life deathmatch weapons, items, ammo spawn time and effects


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Half-Life        Category:   Fun Stuff       
BodyBuilder
BANNED
Join Date: Jun 2011
Location: Europa-USA-Moon
Old 09-01-2011 , 09:52   Half-Life deathmatch weapons, items, ammo spawn time and effects
Reply With Quote #1

Half-Life deathmatch weapons, items, ammo spawn time and effects
video:http://www.youtube.com/watch?v=LD-kFHMBKUM

Scripting help:
ConnorMcLeod

Description:
this plugin speeds up the respawn time weapons, ammo, items


Needed Modules
:
hamsandwich
fakemeta
engine

Cvars:
Code:
//next think time float / default: 1.00
next_think_time

//next think effects 0-1 , off-on / default: 0
next_think_eff

//next think effects mode 1-TE_TELEPORT / 2-TE_IMPLOSION
next_think_eff_mode


Attached Files
File Type: sma Get Plugin or Get Source (spawn_time.sma - 1103 views - 2.6 KB)

Last edited by BodyBuilder; 01-19-2013 at 03:44.
BodyBuilder is offline
Old 09-01-2011, 09:53
BodyBuilder
This message has been deleted by BodyBuilder.
Old 09-01-2011, 10:05
gtpunkt
This message has been deleted by gtpunkt. Reason: done
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 09-01-2011 , 15:45   Re: Half-Life Deathmatch Weapons, Items, Ammo Spawn Time And Eff
Reply With Quote #2

nice, but i dont like the effect, add a render from invisible to fully visible.. will be more cool and use a random or custom color glow at the same time with fade in out effect
__________________
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
Old 09-02-2011, 00:10
BodyBuilder
This message has been deleted by BodyBuilder.
Old 09-02-2011, 00:12
BodyBuilder
This message has been deleted by BodyBuilder.
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 09-02-2011 , 15:26   Re: Half-Life Deathmatch Weapons, Items, Ammo Spawn Time And Eff
Reply With Quote #3

oh -.- but still dont like effects -.-
__________________
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-03-2011 , 01:55   Re: Half-Life Deathmatch Weapons, Items, Ammo Spawn Time And Eff
Reply With Quote #4

Some code is redundant, you could use private function instead, also you could use MSG_PVS instead of BROACAST.
This plugin could be interesting if you could set respawn time according to weapon type and ammo type.

Also :
PHP Code:
    set_pev(spawn_ent,pev_nextthink,get_gametime() + get_pcvar_float(ammo_spawn_time))

    if(
get_pcvar_num(spawn_ammo_eff_on_off)) 
    {
        
set_task(get_pcvar_float(ammo_spawn_time),"spawn_ammo_eff",spawn_ent)
    } 
You are retrieving twice ammo_spawn_time cvar value, you should cache the value into a variable instead.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 09-03-2011 at 02:00.
ConnorMcLeod is offline
Old 09-03-2011, 06:17
BodyBuilder
This message has been deleted by BodyBuilder.
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-03-2011 , 07:13   Re: Half-Life Deathmatch Weapons, Items, Ammo Spawn Time And Eff
Reply With Quote #5

Yes, it won't send message to players that can't see the item.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Old 09-03-2011, 08:30
BodyBuilder
This message has been deleted by BodyBuilder.
Old 09-03-2011, 08:31
BodyBuilder
This message has been deleted by BodyBuilder.
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-05-2011 , 00:25   Re: Half-Life Deathmatch Weapons, Items, Ammo Spawn Time And Eff
Reply With Quote #6

You have to pass origin in message_begin in order to MSG_PVS (viewable) or MSG_PAS (audible) to work.
Also, you can directly work with floats origins using EngFunc_MessageBegin et EngFunc_WriteCoord.

Code:
            message_begin(MSG_PVS,SVC_TEMPENTITY)             write_byte(TE_TELEPORT)             write_coord(floatround(origin[0]))             write_coord(floatround(origin[1]))             write_coord(floatround(origin[2]))             message_end()

->

Code:
MESSAGE_BEGIN(dest, msg_type, const Float:fVecOrigin[3] = {0.0,0.0,0.0}, player = 0 ) {     engfunc(EngFunc_MessageBegin, dest, msg_type, fVecOrigin, player) } #define WRITE_COORD(%0)   engfunc(EngFunc_WriteCoord, %0)
Code:
            MESSAGE_BEGIN(MSG_PVS, SVC_TEMPENTITY, origin)             write_byte( TE_TELEPORT )             WRITE_COORD( origin[0] )             WRITE_COORD( origin[1] )             WRITE_COORD( origin[2] )             message_end()
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 09-05-2011 at 00:30.
ConnorMcLeod is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-05-2011 , 01:10   Re: Half-Life Deathmatch Weapons, Items, Ammo Spawn Time And Eff
Reply With Quote #7

Quote:
Originally Posted by BodyBuilder
I do not understand the English language


just show my how use






You have to pass origin in message_begin in order to MSG_PVS (viewable) or MSG_PAS (audible) to work.
Also, you can directly work with floats origins using EngFunc_MessageBegin et EngFunc_WriteCoord.

Code:
message_begin(MSG_PVS,SVC_TEMPENTITY)
write_byte(TE_TELEPORT)
write_coord(floatround(origin[0]))
write_coord(floatround(origin[1]))
write_coord(floatround(origin[2]))
message_end()



->

Code:
MESSAGE_BEGIN(dest, msg_type, const Float:fVecOrigin[3] = {0.0,0.0,0.0}, player = 0 )
{
engfunc(EngFunc_MessageBegin, dest, msg_type, fVecOrigin, player)
}

#define WRITE_COORD(%0) engfunc(EngFunc_WriteCoord, %0)


Code:
MESSAGE_BEGIN(MSG_PVS, SVC_TEMPENTITY, origin)
write_byte( TE_TELEPORT )
WRITE_COORD( origin[0] )
WRITE_COORD( origin[1] )
WRITE_COORD( origin[2] )
message_end()



__________________
...

PHP Code:
#include amxmodx
#include engine
#include fakemeta
#include hamsandwich

#define PLUGIN "Half-Life Deathmatch Weapons, Items, Ammo Spawn Time And Eff"
#define VERSION "1.0"
#define AUTHOR "BodyBuilder"

#define WRITE_COORD(%0)   engfunc(EngFunc_WriteCoord, %0)

new 
ammo_spawn_time,
spawn_ammo_eff_on_off,
spawn_ammo_eff_mode,
item_spawn_time,
spawn_item_eff_on_off,
spawn_item_eff_mode,
weapon_spawn_time,
spawn_weapon_eff_on_off,
spawn_weapon_eff_mode
    
new const spawn_ammo[][] = 
{
    
"ammo_357",
    
"ammo_9mmAR",
    
"ammo_9mmbox",
    
"ammo_9mmclip",
    
"ammo_ARgrenades",
    
"ammo_buckshot",
    
"ammo_crossbow",
    
"ammo_gaussclip",
    
"ammo_glockclip",
    
"ammo_mp5clip",
    
"ammo_mp5grenades",
    
"ammo_rpgclip"
}

new const 
spawn_item[][] = 
{
    
"item_battery",
    
"item_healthkit",
    
"item_longjump"
}

new const 
spawn_weapon[][] = 
{
    
"weapon_hornetgun",
    
"weapon_python",
    
"weapon_357",
    
"weapon_crossbow",
    
"weapon_snark",
    
"weapon_tripmine",
    
"weapon_satchel",
    
"weapon_handgrenade",
    
"weapon_9mmAR",
    
"weapon_gauss",
    
"weapon_mp5",
    
"weapon_rpg",
    
"weapon_egon",
    
"weapon_shotgun"
}

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)


    for(new 
0sizeof(spawn_ammo); a++)
    
RegisterHam(Ham_Respawn,spawn_ammo[a],"spawn_ammo_time",1)


    for(new 
0sizeof(spawn_item); b++)
    
RegisterHam(Ham_Respawn,spawn_item[b],"spawn_item_time",1)


    for(new 
0sizeof(spawn_weapon); c++)
    
register_touch(spawn_weapon[c],"worldspawn","spawn_weapon_time")


    
ammo_spawn_time register_cvar("ammo_spawn_time","1.15")
    
spawn_ammo_eff_on_off register_cvar("spawn_ammo_eff_on_off","1")
    
spawn_ammo_eff_mode register_cvar("spawn_ammo_eff_mode","3")


    
item_spawn_time register_cvar("item_spawn_time","1.15")
    
spawn_item_eff_on_off register_cvar("spawn_item_eff_on_off","1")
    
spawn_item_eff_mode register_cvar("spawn_item_eff_mode","2")


    
weapon_spawn_time register_cvar("weapon_spawn_time","1.15")
    
spawn_weapon_eff_on_off register_cvar("spawn_weapon_eff_on_off","1")
    
spawn_weapon_eff_mode register_cvar("spawn_weapon_eff_mode","1")
}

MESSAGE_BEGIN(destmsg_type, const Float:fVecOrigin[3] = {0.0,0.0,0.0}, player 
{
    
engfunc(EngFunc_MessageBegindestmsg_typefVecOriginplayer)
}

public 
spawn_ammo_time(spawn_ent)
{
    
set_pev(spawn_ent,pev_nextthink,get_gametime() + get_pcvar_float(ammo_spawn_time))

    if(
get_pcvar_num(spawn_ammo_eff_on_off)) 
    {
        
set_task(get_pcvar_float(ammo_spawn_time),"spawn_ammo_eff",spawn_ent)
    }
    return 
spawn_ent
}

public 
spawn_item_time(spawn_ent)
{
    
set_pev(spawn_ent,pev_nextthink,get_gametime() + get_pcvar_float(item_spawn_time))


    if(
get_pcvar_num(spawn_item_eff_on_off)) 
    {
        
set_task(get_pcvar_float(item_spawn_time),"spawn_item_eff",spawn_ent)
    }
    return 
spawn_ent
}

public 
spawn_weapon_time(spawn_ent)
{
    
set_pev(spawn_ent,pev_nextthink,get_gametime() + get_pcvar_float(weapon_spawn_time))

    if(
get_pcvar_num(spawn_weapon_eff_on_off)) 
    {
        
set_task(get_pcvar_float(weapon_spawn_time),"spawn_weapon_eff",spawn_ent)
    }
}

public 
spawn_ammo_eff(spawn_ent)
{
    
SpawnEffect(spawn_entget_pcvar_num(spawn_ammo_eff_mode))
}

public 
spawn_item_eff(spawn_ent)
{
    
SpawnEffect(spawn_entget_pcvar_num(spawn_item_eff_mode))
}

public 
spawn_weapon_eff(spawn_ent)
{
    
SpawnEffect(spawn_entget_pcvar_num(spawn_weapon_eff_mode))
}

SpawnEffect(iEntiMode)
{
    if( !
iMode )
    {
        return
    }
    new 
Float:origin[3], ArandomBrandomrandom
    pev
(iEntpev_originorigin)

    
Arandom random_num(192,208)
    
Brandom random_num(251,0)
    
random random_num(Arandom,Brandom)

    switch( 
iMode )
    {
        case 
1:
        {
            
MESSAGE_BEGIN(MSG_PVS,SVC_TEMPENTITYorigin)
            
write_byte(TE_TELEPORT)
            
WRITE_COORD(origin[0])
            
WRITE_COORD(origin[1])
            
WRITE_COORD(origin[2])
            
message_end()
        }
        case 
2:
        {
            
MESSAGE_BEGIN(MSG_PVS,SVC_TEMPENTITYorigin)
            
write_byte(TE_IMPLOSION)
            
WRITE_COORD(origin[0])
            
WRITE_COORD(origin[1])
            
WRITE_COORD(origin[2])
            
write_byte(50)
            
write_byte(random)
            
write_byte(10
            
message_end()
        }
        case 
3:
        {
            
MESSAGE_BEGIN(MSG_PVS,SVC_TEMPENTITYorigin)
            
write_byte(TE_PARTICLEBURST)
            
WRITE_COORD(origin[0])
            
WRITE_COORD(origin[1])
            
WRITE_COORD(origin[2])
            
write_short(50)
            
write_byte(random)
            
write_byte(10)
            
message_end()
        }
    }



Quote:
Originally Posted by BodyBuilder
how use imode ?

what better ?
engine -> register_touch
hamsandwich -> Ham_Touch
???


STOP PM ME THANKS.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 09-05-2011 at 02:12.
ConnorMcLeod is offline
Old 09-05-2011, 05:24
BodyBuilder
This message has been deleted by BodyBuilder.
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 09-05-2011 , 10:05   Re: Half-Life Deathmatch Weapons, Items, Ammo Spawn Time And Eff
Reply With Quote #8

MM one cuestion ,

Code:
for(new a = 0; a < sizeof(spawn_ammo); a++)                  RegisterHam(Ham_Respawn,spawn_ammo[a],"spawn_ammo_time",1)             for(new b = 0; b < sizeof(spawn_item); b++)         RegisterHam(Ham_Respawn,spawn_item[b],"spawn_item_time",1)             for(new c = 0; c < sizeof(spawn_weapon); c++)         register_touch(spawn_weapon[c],"worldspawn","spawn_weapon_time")

Can be this ?

Code:
        static i,j,k         for( i = 0, j = 0, k = 0; i < sizeof(spawn_ammo), j < sizeof(spawn_item), k < sizeof(spawn_weapon); k++, i++, j++)     {         RegisterHam( Ham_Respawn, spawn_ammo[ i ], "spawn_ammo_time" , 1)         RegisterHam( Ham_Respawn, spawn_item[ j ],"spawn_item_time", 1)         register_touch( spawn_weapon[ k ], "worldspawn", "spawn_weapon_time" )     }
__________________
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
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 09-05-2011 , 11:12   Re: Half-Life Deathmatch Weapons, Items, Ammo Spawn Time And Eff
Reply With Quote #9

No. spawn_ammo, spawn_item and spawn_weapon may have different sizes and that's why they need separate loops.
__________________
hleV is offline
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 09-05-2011 , 11:24   Re: Half-Life Deathmatch Weapons, Items, Ammo Spawn Time And Eff
Reply With Quote #10

Oh ok.
__________________
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
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 22:26.


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