AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   No C4 crash (https://forums.alliedmods.net/showthread.php?t=271933)

siriusmd99 09-20-2015 14:02

No C4 crash
 
I have the following script in the plugin:
PHP Code:

#include <fakemeta_util>

register_event("StatusIcon""GotBomb""be""1=1""1=2""2=c4")

public 
GotBomb(id){
    
fm_strip_user_gun(idCSW_C4)


I have basebuilder server and i use this to remove c4 given to zombies and it works well but sometimes server crashes with the error debugging this line
fm_strip_user_gun(id, CSW_C4)

I tried everything , to remove info_bomb_target and info_bomb_blablabla ,bomb was given to player at round start. ONly strip user gun removes properly c4 but it crashes server sometimes.

wickedd 09-20-2015 14:27

Re: No C4 crash
 
Read this thread.

siriusmd99 09-20-2015 14:52

Re: No C4 crash
 
Quote:

Originally Posted by wickedd (Post 2345265)

I have read it 100 times , did like that and doesnt work.Tried to delete info_bomb_target and another one entity because arkshine said that bomb wouldnt respawn if there is no info_bmb_target but bomb respawns.

HamletEagle 09-20-2015 14:57

Re: No C4 crash
 
Delete func_bomb_target & info_bomb_target entities, bomb won't be given again. When RestartRound is called there is a check for m_bMapHasBombTarget. If true GiveC4 is called, otherwise no one get the bomb. m_bMapHasBombTarget is filled like:
PHP Code:

if (UTIL_FindEntityByClassname(NULL"func_bomb_target") != NULL)
    {
        
m_bMapHasBombTarget true;
        
m_bMapHasBombZone   true;
    }
    else if (
UTIL_FindEntityByClassname(NULL"info_bomb_target") != NULL)
    {
        
m_bMapHasBombTarget true;
        
m_bMapHasBombZone   false;
    }
    else
    {
        
m_bMapHasBombTarget false;
        
m_bMapHasBombZone   false;
    } 

So you see, removing them make the trick.

siriusmd99 09-20-2015 15:05

Re: No C4 crash
 
Quote:

Originally Posted by HamletEagle (Post 2345280)
Delete func_bomb_target & info_bomb_target entities, bomb won't be given again. When RestartRound is called there is a check for m_bMapHasBombTarget. If true GiveC4 is called, otherwise no one get the bomb. m_bMapHasBombTarget is filled like:
PHP Code:

if (UTIL_FindEntityByClassname(NULL"func_bomb_target") != NULL)
    {
        
m_bMapHasBombTarget true;
        
m_bMapHasBombZone   true;
    }
    else if (
UTIL_FindEntityByClassname(NULL"info_bomb_target") != NULL)
    {
        
m_bMapHasBombTarget true;
        
m_bMapHasBombZone   false;
    }
    else
    {
        
m_bMapHasBombTarget false;
        
m_bMapHasBombZone   false;
    } 

So you see, removing them make the trick.

Show me how to delete these 2 targets because i tried but bomb is given .

HamletEagle 09-20-2015 15:07

Re: No C4 crash
 
No, the code is to show you that if you remove the entities the c4 won't be given, it's c++ code from cssdk. Just find all info_bomb_target and func_bomb_target entities and remove them.

siriusmd99 09-20-2015 15:11

Re: No C4 crash
 
Quote:

Originally Posted by HamletEagle (Post 2345287)
No, the code is to show you that if you remove the entities the c4 won't be given, it's c++ code from cssdk. Just find all info_bomb_target and func_bomb_target entities and remove them.

I tried with arkshine code from other topic but doesnt work.
Can you give me the right code?

I tried with plugin_cfg from this topic , from Alka's and ConnorMcLeod's posts but doesnt work :
https://forums.alliedmods.net/showthread.php?t=61685

wickedd 09-20-2015 15:38

Re: No C4 crash
 
PHP Code:

// Is map contain bomb targets?
    
if (fm_find_ent_by_class(-1"func_bomb_target") || fm_find_ent_by_class(-1"info_bomb_target"))
 
// How to remove bomb targets?
    
new target = -1classname[] = "func_bomb_target"
    
while ((target fm_find_ent_by_class(targetclassname)))
    
fm_remove_entity(target)
    
classname "info_bomb_target"
    
while ((target fm_find_ent_by_class(targetclassname)))
    
fm_remove_entity(target

That code removes the targets, so the bomb will not be given to a player.

Hartmann 09-20-2015 15:47

Re: No C4 crash
 
https://forums.alliedmods.net/showpo...43&postcount=5

siriusmd99 09-21-2015 05:42

Re: No C4 crash
 
Quote:

Originally Posted by Hartmann (Post 2345309)

I decided to put this to an apart plugin. It works , if i see no crash i will come with a post.


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

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