AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved respawn weapons (https://forums.alliedmods.net/showthread.php?t=299987)

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 0sizeof(weapon_ents); i++) {
        while ((
ent fm_find_ent_by_class(entweapon_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_nextthinkget_gametime()+1.0)

public 
fw_WeaponGaussThink(ent){
    if(
pev_valid(ent))
        return 
HAM_IGNORED
        
    DispatchSpawn
(ent)

    return 
HAM_IGNORED



abdobiskra 08-04-2017 03:29

Re: respawn weapons
 
bump

NiHiLaNTh 08-04-2017 04:52

Re: respawn weapons
 
When player picks up anything, the item does not get despawned. It simply becomes invisible (EF_NODRAW).

abdobiskra 08-04-2017 11:28

Re: respawn weapons
 
In fact, I do not have a clear idea of returning it if it is
Could you describe me more

PHP Code:

public fw_WeaponGaussThink(ent){
    if(!
pev_valid(ent))
        return 
HAM_IGNORED

    set_pev
(entpev_effectspev(entpev_effects) & ~EF_NODRAW)
    
//DispatchSpawn(ent)
    
    
return HAM_IGNORED




All times are GMT -4. The time now is 22:52.

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