Veteran Member
Join Date: Jul 2006
Location: France (95)
|
09-05-2011
, 01:10
Re: Half-Life Deathmatch Weapons, Items, Ammo Spawn Time And Eff
|
#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(PLUGIN, VERSION, AUTHOR)
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")
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(dest, msg_type, const Float:fVecOrigin[3] = {0.0,0.0,0.0}, player = 0 ) { engfunc(EngFunc_MessageBegin, dest, msg_type, fVecOrigin, player) }
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_ent, get_pcvar_num(spawn_ammo_eff_mode)) }
public spawn_item_eff(spawn_ent) { SpawnEffect(spawn_ent, get_pcvar_num(spawn_item_eff_mode)) }
public spawn_weapon_eff(spawn_ent) { SpawnEffect(spawn_ent, get_pcvar_num(spawn_weapon_eff_mode)) }
SpawnEffect(iEnt, iMode) { if( !iMode ) { return } new Float:origin[3], Arandom, Brandom, random pev(iEnt, pev_origin, origin)
Arandom = random_num(192,208) Brandom = random_num(251,0) random = random_num(Arandom,Brandom)
switch( iMode ) { case 1: { 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() } case 2: { MESSAGE_BEGIN(MSG_PVS,SVC_TEMPENTITY, origin) 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_TEMPENTITY, origin) 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.
__________________
Last edited by ConnorMcLeod; 09-05-2011 at 02:12.
|
|