AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] Remove bomb.. (https://forums.alliedmods.net/showthread.php?t=307551)

suhdude 05-14-2018 19:54

[HELP] Remove bomb..
 
I have looked in these threads and tried some of the code without any luck.

https://forums.alliedmods.net/showth...=40164?t=40164
https://forums.alliedmods.net/showthread.php?p=2289060
https://forums.alliedmods.net/showthread.php?p=1796448

Some code simply dropped the bomb and would not let me pick it up.
This is not an option as it will interfere with gameplay.
And other code did nothing although it compiled without errors.

How do I properly remove the bomb entity and hud from a player?

Thanks

iceeedr 05-14-2018 20:42

Re: [HELP] Remove bomb..
 
PHP Code:


public plugin_init() 
{
    
set_task(1.0"Removec4")
}

public 
Removec4()
{
    new 
iEnt = -1;

    while((
iEnt engfunc(EngFunc_FindEntityByString,iEnt,"classname","func_bomb_target")) > 0)
    {
        
set_pev(iEnt,pev_classname,"_func_bomb_target");
    }

    while((
iEnt engfunc(EngFunc_FindEntityByStringiEnt"classname""info_bomb_target" )) > 0)
    {
        
set_pev(iEnt,pev_classname,"_info_bomb_target");
    }



suhdude 05-15-2018 05:29

Re: [HELP] Remove bomb..
 
Quote:

Originally Posted by iceeedr (Post 2592213)
PHP Code:


public plugin_init() 
{
    
set_task(1.0"Removec4")
}

public 
Removec4()
{
    new 
iEnt = -1;

    while((
iEnt engfunc(EngFunc_FindEntityByString,iEnt,"classname","func_bomb_target")) > 0)
    {
        
set_pev(iEnt,pev_classname,"_func_bomb_target");
    }

    while((
iEnt engfunc(EngFunc_FindEntityByStringiEnt"classname""info_bomb_target" )) > 0)
    {
        
set_pev(iEnt,pev_classname,"_info_bomb_target");
    }



This only removes the plantzone correct?
Players still drop the bomb and it makes a noise when you pick it up.

Thanks.

iceeedr 05-15-2018 06:02

Re: [HELP] Remove bomb..
 
This removes the zone, c4 and hud. Test and see.

suhdude 05-15-2018 07:07

Re: [HELP] Remove bomb..
 
Quote:

Originally Posted by iceeedr (Post 2592243)
This removes the zone, c4 and hud. Test and see.

Thank you I should have tested it first.
I have one problem now, when the bomb explodes round is not over.
I have a function that automatically plants a bomb at the bomb site.

That is why I want to remove bomb, but team should also be able to win.


Thanks a ton!

suhdude 05-15-2018 07:33

Re: [HELP] Remove bomb..
 
SOLVED

//This removes bomb when it is dropped

Code:

public plugin_init()
{
    RegisterHam(Ham_Spawn, "weaponbox", "RemoveWeaponbox", 1)
}

public RemoveWeaponbox(ent)
{
    entity_set_int(ent, EV_INT_flags, FL_KILLME);
    call_think(ent);
}


CrazY. 05-15-2018 10:32

Re: [HELP] Remove bomb..
 
This will remove all weaponboxes. Check if the world model it's of the C4.

HamletEagle 05-15-2018 11:28

Re: [HELP] Remove bomb..
 
Quote:

Originally Posted by suhdude (Post 2592254)
SOLVED

//This removes bomb when it is dropped

Code:

public plugin_init()
{
    RegisterHam(Ham_Spawn, "weaponbox", "RemoveWeaponbox", 1)
}

public RemoveWeaponbox(ent)
{
    entity_set_int(ent, EV_INT_flags, FL_KILLME);
    call_think(ent);
}


No need to set FL_KILLME, calling think should be enough.

suhdude 05-16-2018 09:47

Re: [HELP] Remove bomb..
 
Quote:

Originally Posted by CrazY. (Post 2592275)
This will remove all weaponboxes. Check if the world model it's of the C4.

How would I do this in a good way..
I solved it using a variable, it is not nice but it works.

I'm guessing I should have used something like find_ent_by_model.

Quote:

Originally Posted by HamletEagle (Post 2592284)
No need to set FL_KILLME, calling think should be enough.

When I deleted that line, bomb was not removed from the ground.
You mean I don't need that line when I have found c4 ent specifically?

I would like to know why I get a tag mismatch when I try to change the planted bomb radar coordinates.

Code:

        origin[0] = 1108.650879
        origin[1] = 2571.609863
        origin[2] = 132.031250
        message_begin(MSG_ALL, get_user_msgid("BombDrop"), {0,0,0}, 1)
        write_coord(origin[0]);
        write_coord(origin[1]);
        write_coord(origin[2]);
        write_byte(1);
        message_end();


HamletEagle 05-16-2018 13:36

Re: [HELP] Remove bomb..
 
write_coord wants an integer, you are providing a float. Use EngFunc_WriteCoord.


All times are GMT -4. The time now is 03:57.

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