Raised This Month: $51 Target: $400
 12% 

Solved [ H3LP ] Bomb site on all maps?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 08-21-2017 , 12:46   [ H3LP ] Bomb site on all maps?
Reply With Quote #1

Hello, I'm trying to create [func|info]_bomb_target on all maps (except maps "de_" because it already has). I did some tests and the entity is being created, but I'm not able to plant the C4.

Code:
public plugin_precache() { if (!find_ent_by_class(-1, "[func|info]_bomb_target") create_entity("[func|info]_bomb_target"); }
__________________









Last edited by CrazY.; 08-22-2017 at 13:57.
CrazY. is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-21-2017 , 14:02   Re: [ H3LP ] Bomb site on all maps?
Reply With Quote #2

You need origin and size and other stuff.
__________________

Last edited by HamletEagle; 08-21-2017 at 14:02.
HamletEagle is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 08-21-2017 , 20:46   Re: [ H3LP ] Bomb site on all maps?
Reply With Quote #3

I don't need origin exactly because I will use fake_touch.

What do you are meaning with "other stuff"?
__________________








CrazY. is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-22-2017 , 03:57   Re: [ H3LP ] Bomb site on all maps?
Reply With Quote #4

What do you want to? Plant c4 everywhere on any map?
__________________
HamletEagle is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 08-22-2017 , 05:40   Re: [ H3LP ] Bomb site on all maps?
Reply With Quote #5



It's the self destruct device of the predators
__________________








CrazY. is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-22-2017 , 06:49   Re: [ H3LP ] Bomb site on all maps?
Reply With Quote #6

Quote:
Originally Posted by HamletEagle View Post
What do you want to? Plant c4 everywhere on any map?
You answered nothing.
__________________
HamletEagle is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 08-22-2017 , 10:05   Re: [ H3LP ] Bomb site on all maps?
Reply With Quote #7




Yes, I need to plant the C4 anywhere on any map, no restrictions.
__________________









Last edited by CrazY.; 08-22-2017 at 10:08.
CrazY. is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 08-22-2017 , 11:34   Re: [ H3LP ] Bomb site on all maps?
Reply With Quote #8

I tried that, but I still couldn't use that entity with the fake_touch.

Code:
    if (!find_ent_by_class(-1, CLASS_FUNC_BOMB_TARGET))     {         new entity = create_entity(CLASS_FUNC_BOMB_TARGET);         entity_set_int(entity, EV_INT_solid, SOLID_TRIGGER);         new Float:origin[3]; // 0.0 0.0 0.0         entity_set_origin(entity, origin);         new Float:mins[3] = { -1729.0, 2495.0, -1.0 };         new Float:maxs[3] = { -1343.0, 2881.0, 97.0 };         entity_set_size(entity, mins, maxs);     }
__________________









Last edited by CrazY.; 08-22-2017 at 11:35.
CrazY. is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-22-2017 , 11:38   Re: [ H3LP ] Bomb site on all maps?
Reply With Quote #9

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>

const m_flState        235
const m_fClientMapZone 234
const XoPlayer         5

const SIGNAL_BOMB            1<<1
const CS_MAPZONE_BOMBTARGET  = (1<<1

public 
plugin_init()
{
    
RegisterHam(Ham_Weapon_PrimaryAttack"weapon_c4""CC4_PrimaryAttackPre"false)
    
RegisterHam(Ham_Weapon_PrimaryAttack"weapon_c4""CC4_PrimaryAttackPost"true)
}

public 
CC4_PrimaryAttackPre(const C4Entity)
{
    if(
pev_valid(C4Entity))
    {
        new 
id pev(C4Entitypev_owner)
        if(!(
get_pdata_int(idm_fClientMapZoneXoPlayer) & CS_MAPZONE_BOMBTARGET))
        {
            
set_pdata_int(idm_flStateSIGNAL_BOMBXoPlayer)
            
client_print(idprint_chat"PLANT")
        }
    }
}

public 
CC4_PrimaryAttackPost(const C4Entity)
{
    if(
pev_valid(C4Entity))
    {
        new 
id pev(C4Entitypev_owner)
        new 
SignalState get_pdata_int(idm_flStateXoPlayer)
        
        if(!(
get_pdata_int(idm_fClientMapZoneXoPlayer) & CS_MAPZONE_BOMBTARGET))
        {
            
SignalState &= ~SIGNAL_BOMB
            set_pdata_int
(idm_flStateSignalStateXoPlayer)
        }
    }

Use this, works in all maps. You just have to give a weapon_c4 to the player in non bomb maps.
I did not want to rely on func_bomb_target entity because on some maps it's not present and as you can see here if there is no func_bomb_target(if (!CSGameRules()->m_bMapHasBuyZone)) game will check 200 units around spawpoint and consider that a bomb zone.
__________________

Last edited by HamletEagle; 08-22-2017 at 12:03. Reason: Fixed a bug when player was in a bombsite.
HamletEagle is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 08-22-2017 , 13:55   Re: [ H3LP ] Bomb site on all maps?
Reply With Quote #10

Thanks Hamlet, it's working perfectly!
__________________









Last edited by CrazY.; 08-22-2017 at 13:57.
CrazY. 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 23:30.


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