| abdobiskra |
08-01-2017 07:58 |
respawn weapons
Hi
in Hl1 players can pickup the weapons
my question how i can control the time of respawn ?
PHP Code:
new const weapon_ents[][] = {
"item_airtank", "item_antidote", "item_battery",
"item_healthkit", "item_longjump", "item_security",
"item_sodacan", "item_suit", "ammo_357",
"ammo_9mmAR", "ammo_9mmbox", "ammo_9mmclip",
"ammo_ARgrenades", "ammo_buckshot", "ammo_crossbow",
"ammo_egonclip", "ammo_gaussclip", "ammo_glockclip",
"ammo_mp5clip", "ammo_mp5grenades", "ammo_rpgclip",
"weapon_357", "weapon_9mmAR", "weapon_9mmhandgun",
"weapon_crossbow", "weapon_crowbar", "weapon_egon",
"weapon_gauss", "weapon_glock", "weapon_handgrenade",
"weapon_hornetgun", "weapon_mp5", "weapon_python",
"weapon_rpg", "weapon_satchel", "weapon_shotgun",
"weapon_snark", "weapon_tripmine", "weapon_quantumdestabilizer",
"monster_barney", "monster_scientist", "monster_snark",
"monster_tripmine", "monster_satchel", "weaponbox"
};
public plugin_init() {
set_task(0.1, "Function",_,_, _, "b")
}
public Function()
{
//client_print(0, print_chat, " spawned")
new ent = 0; for (new i = 0; i < sizeof(weapon_ents); i++) {
while ((ent = fm_find_ent_by_class(ent, weapon_ents[i])) > 0) {
if (pev_valid(ent)) {
DispatchSpawn(ent)
}
}
}
}
and othere simple way :
PHP Code:
public plugin_init() {
RegisterHam(Ham_Spawn, "weapon_gauss","fw_WeaponGaussSpawn", 1)
RegisterHam(Ham_Think, "weapon_gauss","fw_WeaponGaussThink")
}
public fw_WeaponGaussSpawn(ent)
set_pev(ent,pev_nextthink, get_gametime()+1.0)
public fw_WeaponGaussThink(ent){
if(pev_valid(ent))
return HAM_IGNORED
DispatchSpawn(ent)
return HAM_IGNORED
}
|