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

Solved c4 experience


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 12-30-2019 , 10:06   c4 experience
Reply With Quote #1

C4 time is adjusted based on experience (frags).


Script adjusts the c4 time based on frags. It was off until I used Cstrike module. Adjusting mp_c4timer wasn't in real life.

__________________

Last edited by DJEarthQuake; 12-17-2021 at 15:30. Reason: Needed Cstrike module.
DJEarthQuake is offline
RaZ_HU
Senior Member
Join Date: May 2015
Location: Hungary
Old 12-31-2019 , 12:42   Re: c4 experience
Reply With Quote #2

You should really ident your code.
What happens if 2 or more player gets to C4?
Team filtering is missing too.
RaZ_HU is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 12-31-2019 , 14:08   Re: c4 experience
Reply With Quote #3

Hey buddy first off thanks for responding. I hope you like the 'concept'.

Quote:
Originally Posted by RaZ_HU View Post
You should really ident your code.
ident or indent?
The code is indented to 4. Post what you think is indented with the same code please. Indentation can be whatever you want. Complaints about it really need examples furnished.
Quote:
Originally Posted by RaZ_HU View Post
What happens if 2 or more player gets to C4?
Bartime controls this so it's locked down to solely the defuser's frags.
Quote:
Originally Posted by RaZ_HU View Post
Team filtering is missing too.
The planter can have the converse and obtained via bartime and or parsing the log. Subtract time when planting based on frags or added if negative kills exist etc.

Source has an 'ideas section' and this does not so I pasted here as it is not a 'request' nor a 'snippets/tutorial' piece. This is more of a unfinished spinoff idea I wanted to share with the community to develop into whatever.
__________________
DJEarthQuake is offline
RaZ_HU
Senior Member
Join Date: May 2015
Location: Hungary
Old 12-31-2019 , 15:34   Re: c4 experience
Reply With Quote #4

Quote:
Originally Posted by DJEarthQuake View Post
ident or indent?
The code is indented to 4. Post what you think is indented with the same code please. Indentation can be whatever you want. Complaints about it really need examples furnished.
Sorry, typo, I meant indent of course: tabs and spaces and empty line to keep it readable.

IDENTIFY should be ran even if there is no bomb on the map (outside of the check), to keep the plugin list organized.
COLOR is not used.
Why do search for vehicles in precache if you don't do anything with the value returned by the search?

Code:
	#include amxmodx
	#include amxmisc
	#include engine
	#include fakemeta
	#define COLOR random_num(0,255)  // Not used
	///C4 time is adjusted based on defuser's experience. # frags.
	#define IDENTIFY register_plugin("c4 Experience","1.0","SPiNX")
	
	static Float:g_fProtected_VIP = 300.0;
	static Float:g_fNormal_Armor = 100.0;
	static Float:g_fExperience_offset = 1.03;
	static Float:g_fUninhibited_Walk = 272.0;
	new g_iC4_base_time, g_szName[33], g_sprite;
	
	public plugin_init()
	{
		IDENTIFY; // We need to keep the plugin list readable
		if(engfunc(EngFunc_FindEntityByString, -1, "classname","func_bomb_target") || engfunc(EngFunc_FindEntityByString, -1, "classname","info_bomb_target"))
		{
			register_logevent("fnReset_C4",2,"1=Round_Start");
			register_event("Money","fnReset_C4", "b")
			register_event("BarTime", "fnDefusal", "be", "1=5", "1=10");
			g_iC4_base_time = get_cvar_num("mp_c4timer");
		}
		else
		{
			pause( "a" );
		}
	}
	
	public plugin_precache()
	{
		find_ent_by_class(-1,"func_vehicle"); // Why do you get a value if not used?
		g_sprite = precache_model("sprites/smoke.spr");
	}
	
	public fnReset_C4(id)
	{
		set_cvar_num("mp_c4timer",g_iC4_base_time);
		if( (get_user_armor(id)) > g_fNormal_Armor)
		{
			entity_set_float(id, EV_FL_armorvalue, g_fNormal_Armor );
		}
	}
	
	public fnDefusal(id)
	{
		new Float:fC4_factor = get_user_frags(id)*g_fExperience_offset;
		new iSatchel_timer = floatround(g_iC4_base_time+fC4_factor);
		new iCar = find_ent_by_tname( -1, "func_vehicle");
		
		fn_iC4_proximity(id,iCar);
		entity_set_float(id, EV_FL_maxspeed, g_fUninhibited_Walk);
		set_cvar_num("mp_c4timer",iSatchel_timer);
		get_user_name(id,g_szName,charsmax (g_szName));
		client_print(0, print_chat, "C4 timer is now %i seconds due to the expertise of %s.", iSatchel_timer,g_szName);
	}
	
	public fn_iC4_proximity(id, iCar)
	{
		if(entity_range(id, iCar) <= 2000)
		{
			entity_set_float(id, EV_FL_armorvalue, g_fProtected_VIP);
			message_begin(0,23);
			write_byte(TE_BEAMRING)
			write_short(id)
			write_short(iCar)
			write_short(g_sprite)
			write_byte(10)  //starting frame
			write_byte(1) //frame rate in 0.1's
			write_byte(50) //life in 0.1's
			write_byte(200) //line width in 0.1's
			write_byte(random_num(1,12)) //noise amplitude in 0.01's
			write_byte(255)  //Red
			write_byte(100) //Green
			write_byte(25) //blue
			write_byte(300) //brightness
			write_byte(1) //scroll speed in 0.1's
			message_end();
		}
	}
	
	///NOTES:::
	//const m_bIsDefusing = 949;
	//set_pdata_bool(id, m_bIsDefusing, false)

Yes, the idea is good and unique, but most of the players are go by their head even if you tell them to do by objectives

Last edited by RaZ_HU; 12-31-2019 at 15:35.
RaZ_HU is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-01-2020 , 09:17   Re: c4 experience
Reply With Quote #5

Quote:
Originally Posted by DJEarthQuake View Post
Hey buddy first off thanks for responding. I hope you like the 'concept'.

The code is indented to 4. Post what you think is indented with the same code please. Indentation can be whatever you want. Complaints about it really need examples furnished.
I don't think that putting 4 blank spaces in front of every line counts as indentation and helps the human eye in any way.

PHP Code:
if(some_check)
{
can
if(some_check)
{
you
if(some_check)
{
read
}
else if(
some_check)
{
this
}
else
{
without
if(some_check)
{
struggling
}
huh?
}
}
else
{
random code here...
}

=>

PHP Code:
if(some_check)
{
    
can
    
if(some_check)
    {
        
you
        
if(some_check)
        {
            
read
        
}
        else if(
some_check)
        {
            
this
        
}
        else
        {
            
without
            
if(some_check)
            {
                
struggling
            
}
            
huh?
        }
    }
    else
    {
        
random code here...
    }

__________________

Last edited by OciXCrom; 01-01-2020 at 09:17.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Old 01-03-2020, 11:40
DJEarthQuake
This message has been deleted by DJEarthQuake. Reason: Somebody is on a rampage today.
Old 04-05-2021, 08:13
DJEarthQuake
This message has been deleted by DJEarthQuake. Reason: Somebody is on a rampage today.
Old 06-18-2021, 05:47
DJEarthQuake
This message has been deleted by DJEarthQuake. Reason: Wrong answer
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 07:28.


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