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

How to use "cs_set_c4_explode_time" ??


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nax0ne
Senior Member
Join Date: Jul 2011
Location: Chile
Old 01-13-2018 , 18:43   How to use "cs_set_c4_explode_time" ??
Reply With Quote #1

Hi guys! I wanna change the explode time of the C4. But every time I try, I get an error.... Does anyone can help me?

PHP Code:
L 01/13/2018 20:36:07: [CSTRIKENon-player entity 6 out of range
L 01
/13/2018 20:36:07: [AMXXRun time error 10 (plugin "host.amxx") (native "cs_set_c4_explode_time") - debug not enabled!
L 01/13/2018 20:36:07: [AMXXTo enable debug modeadd "debug" after the plugin name in plugins.ini (without quotes). 
PHP Code:
public set_c4_time(id)
{
    if(
is_user_connected(id) && is_user_alive(id))
    {
        new 
iC4Ent find_ent_by_class0"weapon_c4" );
        
cs_set_c4_explode_time(iC4Ent100.0);
    }

__________________

Last edited by Nax0ne; 01-14-2018 at 11:21.
Nax0ne is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 01-13-2018 , 19:04   Re: How to use "cs_set_c4_explode_time" ??
Reply With Quote #2

PHP Code:
public set_c4_time(id)
{
    if(
is_user_alive(id))
    {
        new 
iC4Ent find_ent_by_class( -1"weapon_c4" );

        if( ! 
is_valid_entiC4Ent ) )
        return;

        
cs_set_c4_explode_time(iC4Ent100.0);
    }

__________________

Last edited by edon1337; 01-13-2018 at 19:05.
edon1337 is offline
Nax0ne
Senior Member
Join Date: Jul 2011
Location: Chile
Old 01-13-2018 , 19:11   Re: How to use "cs_set_c4_explode_time" ??
Reply With Quote #3

Quote:
Originally Posted by edon1337 View Post
PHP Code:
public set_c4_time(id)
{
    if(
is_user_alive(id))
    {
        new 
iC4Ent find_ent_by_class( -1"weapon_c4" );

        if( ! 
is_valid_entiC4Ent ) )
        return;

        
cs_set_c4_explode_time(iC4Ent100.0);
    }

Doesn't work man.

PHP Code:
L 01/13/2018 21:09:29: [CSTRIKEEntity 195 ("weapon_c4"is not C4!
L 01/13/2018 21:09:29: [AMXXDisplaying debug trace (plugin "host.amxx"version "0.1")
L 01/13/2018 21:09:29: [AMXXRun time error 10native error (native "cs_set_c4_explode_time")
L 01/13/2018 21:09:29: [AMXX]    [0host.sma::set_c4_time (line 63
I try different ways... but all give me that similar error :'(
__________________
Nax0ne is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 01-14-2018 , 00:11   Re: How to use "cs_set_c4_explode_time" ??
Reply With Quote #4

PHP Code:
c4timer get_cvar_pointer("mp_c4timer");
set_pcvar_num(c4timer,  mytime); 
Craxor is offline
Send a message via ICQ to Craxor
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 01-14-2018 , 04:00   Re: How to use "cs_set_c4_explode_time" ??
Reply With Quote #5

Because you guys are searching for the wrong entity. You should search for "grenade" and check m_bIsC4 offset to find the bomb.
__________________
HamletEagle is offline
TheWhitesmith
Senior Member
Join Date: Oct 2017
Location: Morocco :c
Old 01-14-2018 , 08:39   Re: How to use "cs_set_c4_explode_time" ??
Reply With Quote #6

So you would have to loop for all grenades, or just check if the grenade spawned is a C4 and save the entity id.
__________________
TheWhitesmith is offline
Nax0ne
Senior Member
Join Date: Jul 2011
Location: Chile
Old 01-14-2018 , 11:18   Re: How to use "cs_set_c4_explode_time" ??
Reply With Quote #7

Quote:
Originally Posted by HamletEagle View Post
Because you guys are searching for the wrong entity. You should search for "grenade" and check m_bIsC4 offset to find the bomb.
Well... i found the solution:

PHP Code:
    new iEnt;
    if  ( ( 
iEnt fm_find_ent_by_model( -1"grenade""models/w_c4.mdl" ) ) )
        
cs_set_c4_explode_timeiEnt300.0 ); 
And it works correctly!

But there is a problem. the "beep" sound bug, It seems that it is not coordinated with the custom time. For example i put "300" seconds until the explode the bomb.

Quote:
Originally Posted by Craxor View Post
PHP Code:
c4timer get_cvar_pointer("mp_c4timer");
set_pcvar_num(c4timer,  mytime); 
I was thinking about using that cvar, but I think it can be up to 90 seconds and I want more time!!
__________________

Last edited by Nax0ne; 01-14-2018 at 11:20.
Nax0ne is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 01-14-2018 , 14:03   Re: How to use "cs_set_c4_explode_time" ??
Reply With Quote #8

Quote:
Originally Posted by Nax0ne View Post
Well... i found the solution:

PHP Code:
    new iEnt;
    if  ( ( 
iEnt fm_find_ent_by_model( -1"grenade""models/w_c4.mdl" ) ) )
        
cs_set_c4_explode_timeiEnt300.0 ); 
And it works correctly!

But there is a problem. the "beep" sound bug, It seems that it is not coordinated with the custom time. For example i put "300" seconds until the explode the bomb.



I was thinking about using that cvar, but I think it can be up to 90 seconds and I want more time!!
Your solution is bad. Find all grenade entities and check m_bIsC4 offset. You can find the code in my Objective Reset plugin.
__________________

Last edited by HamletEagle; 01-14-2018 at 14:06.
HamletEagle is offline
Nax0ne
Senior Member
Join Date: Jul 2011
Location: Chile
Old 01-14-2018 , 15:29   Re: How to use "cs_set_c4_explode_time" ??
Reply With Quote #9

Quote:
Originally Posted by HamletEagle View Post
Your solution is bad. Find all grenade entities and check m_bIsC4 offset. You can find the code in my Objective Reset plugin.
PHP Code:
const m_bIsC4 385;

public 
plugin_init()
{
    
register_logevent("logevent_planted_bomb"3"2=Planted_The_Bomb")
}

public 
logevent_planted_bomb() 
{
    new 
iEnt = -1;    

    
// Loop through all grenades
    
while ( ( iEnt engfuncEngFunc_FindEntityByStringiEnt"classname""grenade" ) ) )
    {
        
// Check if the grenade is C4 (Bomb)
        
if ( pev_validiEnt ) && get_pdata_booliEntm_bIsC4 ) )
            
cs_set_c4_explode_timeiEnt300.0 );  //Change the explode time
    
}

Something like that? I extracted your code.

And i tested, but the bomb doesn't change its time. Is there a problem?
__________________

Last edited by Nax0ne; 01-14-2018 at 15:36.
Nax0ne is offline
dauletbai00
New Member
Join Date: Apr 2019
Old 04-01-2019 , 09:23   Re: How to use "cs_set_c4_explode_time" ??
Reply With Quote #10

#include <amxmodx>
#include <cstrike>
#include <fakemeta>

#define PLUGIN "bomb_explode"
#define VERSION "1.0"
#define AUTHOR "NE[x]US"

#define m_bIsC4 385


new g_iBomb

public plugin_init()
{
register_logevent("logevent_planted_bomb", 3, "2=Planted_The_Bomb")
}

bool:get_pdata_boolc(ent, charbased_offset, intbase_linuxdiff = 5) return !!( get_pdata_int(ent, charbased_offset / 4, intbase_linuxdiff) & (0xFF<<((charbased_offset % 4) * ) )
public logevent_planted_bomb()
{
g_iBomb = FM_NULLENT
while((g_iBomb = engfunc(EngFunc_FindEntityByString, g_iBomb, "classname", "grenade")))
{
// Check if the grenade is C4 (Bomb)
if(pev_valid(g_iBomb) && get_pdata_boolc(g_iBomb, m_bIsC4))
cs_set_c4_explode_time( g_iBomb, 300.0 )
{
Setup_Bomb()
return
}
}
}


Setup_Bomb()
{
engfunc(g_iBomb)
set_pev(g_iBomb, pev_frame, 0.0)
set_pev(g_iBomb, pev_animtime, get_gametime())
set_pev(g_iBomb, pev_framerate, 1.0)
set_pdata_float(g_iBomb, get_gametime(), 9999.9)
}

Last edited by dauletbai00; 04-01-2019 at 09:23.
dauletbai00 is offline
Reply


Thread Tools
Display Modes

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 01:23.


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