Raised This Month: $32 Target: $400
 8% 

Solved C4 Force plant


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
loiraolhosazul
Member
Join Date: May 2020
Old 02-26-2021 , 22:29   C4 Force plant
Reply With Quote #1

I didn't find anything in the forum about 'force the plant of c4' I found a function in reapi 'rg_plant_bomb' but I don't want to use it, how would this function be using the standard modules, fakemeta, engine etc ..

I want to force the plant

Last edited by loiraolhosazul; 02-27-2021 at 12:42.
loiraolhosazul is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-26-2021 , 22:33   Re: C4 Force plant
Reply With Quote #2

Is this when the last player alive has the bomb? Does the player need to be teleported to the bomb site?

Or do you only want to know how to initiate a force-plant when at the bombsite?
__________________
Bugsy is offline
loiraolhosazul
Member
Join Date: May 2020
Old 02-26-2021 , 23:06   Re: C4 Force plant
Reply With Quote #3

Quote:
Originally Posted by Bugsy View Post
Is this when the last player alive has the bomb? Does the player need to be teleported to the bomb site?

Or do you only want to know how to initiate a force-plant when at the bombsite?
what I want to do is, if there are 50 seconds left and the bomb has not been planted I will force the bomb plant but the player does not need to be with it, just plant
loiraolhosazul is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-27-2021 , 00:13   Re: C4 Force plant
Reply With Quote #4

This will send the player to the site and plant, not thoroughly tested and there may be better ways to do it.
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <engine>
#include <cstrike>

new const Version[] = "0.1";

const 
MAX_SUPPORTED_BOMBSITES 5;

enum BombSites
{
    
EntityID,
    
Float:EntityOrigin]
}

new 
bool:g_bPlanted g_iPlayerWithBomb g_iSitesFound;
new 
g_BombSitesMAX_SUPPORTED_BOMBSITES ][ BombSites ];

public 
plugin_init() 
{
    
register_plugin"Force C4 Plant Random Site" Version "bugsy" );
    
    if ( 
FindBombSites() )
    {
        
register_event"WeapPickup" "PlayerWithBomb" "be" "1=6" ); 
        
register_event"HLTV""NewRound" "a" "1=0" "2=0" );
        
register_logevent"BombPlanted" "2=Planted_The_Bomb" );
        
        
register_clcmd"say c4" "PlantC4" );
    }
}

public 
PlantC4id )
{
    new 
iRandomSite iEntity;

    if ( 
g_bPlanted == false )
    {
        
iRandomSite randomg_iSitesFound );
        
g_BombSitesiRandomSite ][ EntityOrigin ][ ] += 75.0;
        
set_pevg_iPlayerWithBomb pev_origin g_BombSitesiRandomSite ][ EntityOrigin ] );
        
        if( ( 
iEntity create_entity"weapon_c4" ) ) )
        {
            
cs_set_user_bpammog_iPlayerWithBomb CSW_C4 );
            
cs_set_user_plantg_iPlayerWithBomb );
        
            
DispatchKeyValueiEntity "detonatedelay" "50" );
            
DispatchSpawniEntity );
            
g_BombSitesiRandomSite ][ EntityOrigin ][ ] += 20.0;
            
set_peviEntity pev_origin g_BombSitesiRandomSite ][ EntityOrigin ] );
            
force_useiEntity iEntity ); 
            
            
g_bPlanted true;
        }
    }
    else
    {
        
console_printid "The bomb was already planted." );
    }
}

public 
PlayerWithBombid )
{
    
g_iPlayerWithBomb id;
}

public 
BombPlanted()
{
    
g_bPlanted true;
}

public 
NewRound()
{
    
g_bPlanted false;
}

FindBombSites()
{
    new 
Float:fOrigin] , iEntity = -1;

    while ( ( 
iEntity engfuncEngFunc_FindEntityByString iEntity "classname" "func_bomb_target" ) ) && ( g_iSitesFound sizeofg_BombSites ) ) )
    {
        
g_BombSitesg_iSitesFound ][ EntityID ] = iEntity;
        
        
get_brush_entity_originiEntity fOrigin );
        
g_BombSitesg_iSitesFound ][ EntityOrigin ][ ] = fOrigin];
        
g_BombSitesg_iSitesFound ][ EntityOrigin ][ ] = fOrigin];
        
g_BombSitesg_iSitesFound ][ EntityOrigin ][ ] = fOrigin];
        
        
g_iSitesFound++;
    }
    
    return 
g_iSitesFound;

__________________

Last edited by Bugsy; 02-27-2021 at 09:55.
Bugsy is offline
loiraolhosazul
Member
Join Date: May 2020
Old 02-27-2021 , 00:25   Re: C4 Force plant
Reply With Quote #5

really, it takes you to the bombsite but planting is not possible, it is as if the area was removed,

what I really needed is the same function as the 'rg_plant_bomb' where you execute the command and the bomb is placed on the origin.

edit: but the cause of not letting it plant is this ' cs_set_user_plant( g_iPlayerWithBomb , 0 );'

Last edited by loiraolhosazul; 02-27-2021 at 00:26.
loiraolhosazul is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-27-2021 , 00:32   Re: C4 Force plant
Reply With Quote #6

It works fine for me, when I say c4, it puts the person with the bomb at the bombsite and plants instantly.
__________________
Bugsy is offline
loiraolhosazul
Member
Join Date: May 2020
Old 02-27-2021 , 00:35   Re: C4 Force plant
Reply With Quote #7

Quote:
Originally Posted by Bugsy View Post
It works fine for me, when I say c4, it puts the person with the bomb at the bombsite and plants instantly.
what version of your amxmodx?
loiraolhosazul is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-27-2021 , 00:41   Re: C4 Force plant
Reply With Quote #8

Older 1.9 build..if you dont have it, upgrade.
__________________
Bugsy is offline
loiraolhosazul
Member
Join Date: May 2020
Old 02-27-2021 , 00:44   Re: C4 Force plant
Reply With Quote #9

Quote:
Originally Posted by Bugsy View Post
Older 1.9 build..if you dont have it, upgrade.
weird, I'm using 1.10.5413
loiraolhosazul is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-27-2021 , 00:46   Re: C4 Force plant
Reply With Quote #10

Which map are you testing on?
__________________
Bugsy is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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