View Single Post
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