AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   What dose those codes do (https://forums.alliedmods.net/showthread.php?t=326551)

Supremache 08-05-2020 14:57

What dose those codes do
 
I was searching for codes those can remove c4 bomb from server and when i found one i get many problems so i got this code from zombie plague mod but it's not working with me and What dose those codes do.

zombieplague.ini file
Quote:

[Objective Entities] (and anything that would affect gameplay that needs to be removed)
CLASSNAMES = func_bomb_target , info_bomb_target , info_vip_start , func_vip_safetyzone , func_escapezone , hostage_entity , monster_scientist , func_hostage_rescue , info_hostage_rescue , env_fog , env_rain , env_snow , item_longjump , func_vehicle
PHP Code:

case SECTION_OBJECTIVE_ENTS:
            {
                if (
equal(key"CLASSNAMES"))
                {
                    
// Parse classnames
                    
while (value[0] != && strtok(valuekeycharsmax(key), valuecharsmax(value), ','))
                    {
                        
// Trim spaces
                        
trim(key)
                        
trim(value)
                        
                        
// Add to objective ents array
                        
ArrayPushString(g_objective_entskey)
                    }
                }
            } 



PHP Code:

new Array:g_objective_ents

g_objective_ents 
ArrayCreate(321)

// Prevent some entities from spawning
    
g_fwSpawn register_forward(FM_Spawn"fw_Spawn")

unregister_forward(FM_Spawng_fwSpawn)

// Entity Spawn Forward
public fw_Spawn(entity)
{
    
// Invalid entity
    
if (!pev_valid(entity)) return FMRES_IGNORED;
    
    
// Get classname
    
new classname[32], objective[32], size ArraySize(g_objective_ents)
    
pev(entitypev_classnameclassnamecharsmax(classname))
    
    
// Check whether it needs to be removed
    
for (new 0sizei++)
    {
        
ArrayGetString(g_objective_entsiobjectivecharsmax(objective))
        
        if (
equal(classnameobjective))
        {
            
engfunc(EngFunc_RemoveEntityentity)
            return 
FMRES_SUPERCEDE;
        }
    }
    
    return 
FMRES_IGNORED;



OciXCrom 08-05-2020 15:21

Re: What dose those codes do
 
They remove all entities with classnames specified in the list.

Supremache 08-05-2020 15:38

Re: What dose those codes do
 
Quote:

Originally Posted by OciXCrom (Post 2713131)
They remove all entities with classnames specified in the list.

I know so it can remove c4 bomb right ? "func_bomb_target , info_bomb_target"

OciXCrom 08-05-2020 16:30

Re: What dose those codes do
 
Those are the bomb sites, not the bomb itself. But, yes, removing those means you can't plant the bomb anywhere even if you obtain it.

Supremache 08-05-2020 17:54

Re: What dose those codes do
 
Quote:

Originally Posted by OciXCrom (Post 2713144)
Those are the bomb sites, not the bomb itself. But, yes, removing those means you can't plant the bomb anywhere even if you obtain it.

So it can't remove C4 bomb from t team

Shadows Adi 08-05-2020 17:56

Re: What dose those codes do
 
Try to detect the bomber from t side and stripweapons xd

Supremache 08-05-2020 21:49

Re: What dose those codes do
 
Quote:

Originally Posted by Shadows Adi (Post 2713155)
Try to detect the bomber from t side and stripweapons xd

I used those code for bb mod and it can remove c4 bomb from T team but those code are disableing logevent_roundend from mod, So why i getting this problem
I also have checked zombieplague mod "15k lines" to find the codes for remove c4 bomb and i didn't found it
PHP Code:

new maxplayers

public plugin_init() {
    
maxplayers get_maxplayers()
    
removeit()
}

public 
removeit() {
    new 
doneonce 0
    
new fbombt find_ent_by_class(-1"func_bomb_target")
    while(
fbombt maxplayers)
        {
        
entity_set_int(fbombtEV_INT_flagsFL_KILLME)
        
doneonce 1
        fbombt 
find_ent_by_class(fbombt"func_bomb_target")
    }
    if(
doneonce == 1)server_cmd("sv_restartround 1")
    new 
ibombt find_ent_by_class(-1"info_bomb_target")
    while(
ibombt maxplayers)
        {
        
entity_set_int(ibombtEV_INT_flagsFL_KILLME)
        
ibombt find_ent_by_class(ibombt"info_bomb_target")
    }    
    return 
PLUGIN_CONTINUE



DJEarthQuake 08-05-2020 23:20

Re: What dose those codes do
 
Quote:

Originally Posted by Supremache (Post 2713128)
I was searching for codes those can remove c4 bomb from server and when i found one i get many problems so i got this code

Code:
new const SzEnts_c4[][] = {"func_bomb_target", "info_bomb_target"}; public plugin_cfg() {  new Ent = -1;  for(new remove;remove < sizeof SzEnts_c4;++remove)  while((Ent = engfunc(EngFunc_FindEntityByString, Ent, "classname", SzEnts_c4[remove])) != 0)  {   if(pev_valid(Ent))   {    engfunc(EngFunc_RemoveEntity, Ent);    server_cmd("sv_restartround 1")   }  } }

Supremache 08-05-2020 23:37

Re: What dose those codes do
 
Quote:

Originally Posted by DJEarthQuake (Post 2713188)
Code:
new const SzEnts_c4[][] = {"func_bomb_target", "info_bomb_target"}; public plugin_cfg() {  new Ent = -1;  for(new remove;remove < sizeof SzEnts_c4;++remove)  while((Ent = engfunc(EngFunc_FindEntityByString, Ent, "classname", SzEnts_c4[remove])) != 0)  {   if(pev_valid(Ent))   {    engfunc(EngFunc_RemoveEntity, Ent);   }  } }

I will test it thx
Edit: it's working but only after second round so do you think i need to add it for spawn..

Like that ?!
PHP Code:

// Prevent some entities from spawning
    
g_fwSpawn register_forward(FM_Spawn"fw_Spawn")

unregister_forward(FM_Spawng_fwSpawn


DJEarthQuake 08-06-2020 06:38

Re: What dose those codes do
 
I added the much needed line to snip. Bots restarted round for me so I hardly noticed.


All times are GMT -4. The time now is 08:15.

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