Raised This Month: $94 Target: $400
 23% 

Defuse Mistake 1.4 - 03/30/08


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Gameplay        Approver:   Emp` (115)
Redshift187
Junior Member
Join Date: Mar 2008
Old 03-25-2008 , 19:41   Defuse Mistake 1.4 - 03/30/08
Reply With Quote #1

Defuse Mistake 1.4 for Counter-strike and Condition Zero by Redshift187

This is my first plugin. I would like to thank VEN for the code on when the bomb defusing was cancelled and how to properly trigger the explosion, Hebusletroll for snippets I borrowed from Time To Defuse, SweatyBanana for snippets I borrowed from Random Bomb Timer, The Specialist for snippets I borrowed from Cut The Right Wire and Cheap Suit for snippets I borrowed from C4 Timer.

Feel free to use any of this code in your own plugin, as long as you mention me. If you have any questions about what any of it does, feel free to ask (I'll do my best).

The idea behind this plugin is that persons trying to defuse without a kit might make a mistake and detonate the bomb early.

This plugin will pick a random number between 1 and dfmis_odds X 10. This will give a possibility of dfmis_odds percent chance that the number is less than the time to defuse without a kit. If you are defusing without a kit, the bomb will explode the random number of seconds into the defuse. If you stop and restart the defuse, the random number is chosen again (just to make you second guess yourself! <evil grin>).

Use:
dfmis_odds (1-100) - default 10, sets the odds that the bomb will detonate during defuse (set to 0 to disable)
Changelog:
1.4 - 03/30/08 Odds calculation mistake, it was 100% all the time.
1.3 - 03/29/08 Fixed odds calculation. Now it really is a percent chance. Converted engine code to fakemeta.
1.2 - Fixed problem with bomb sometimes exploding immediately after defused
1.1 - Updated re: suggestions by Emp`
1.0 - Original
Attached Files
File Type: sma Get Plugin or Get Source (dfmistake.sma - 2972 views - 4.3 KB)

Last edited by Redshift187; 03-30-2008 at 18:20. Reason: new version
Redshift187 is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 03-25-2008 , 20:26   Re: Defuse Mistake
Reply With Quote #2

IMO: no need for two cvars, you can just check if dfmis_odds is above 0, if not, then it's disabled.

Code:
new g_args[1]
new PlayerDefused[33]
g_args does not have to be a global (it defeats the purpose of sending the id with the set_task)

PlayerDefused is not needed.

Code:
	// Check if the map has a bombsite entity in it
	if(engfunc(EngFunc_FindEntityByString, -1, "classname", "func_bomb_target") > 0)
might as well put everything from the plugin_init within that check (besides register_plugin and cvars)

g_c4timer does not contain the time left until explosion, should have it either countdown or check it against current time of defusal

g_defusing hardly has a purpose, you don't need to check against it to remove the task (only real reason you have it)
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
Redshift187
Junior Member
Join Date: Mar 2008
Old 03-25-2008 , 20:53   Re: Defuse Mistake
Reply With Quote #3

Wow, thanks! That's a lot of code removed. Just testing it before I upload the new version.
Redshift187 is offline
Redshift187
Junior Member
Join Date: Mar 2008
Old 03-26-2008 , 01:17   Re: Defuse Mistake
Reply With Quote #4

There, I made the changes you suggested. I realized I didn't really need to get the C4 remaining time, as long as I remove the task when the regular explosion happens.
Redshift187 is offline
Insanity` Wicked
Member
Join Date: Mar 2008
Old 03-28-2008 , 18:54   Re: Defuse Mistake 1.2
Reply With Quote #5

This is a very neat plugin. Makes the game more realistic.

Very nice.
Insanity` Wicked is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 03-28-2008 , 23:55   Re: Defuse Mistake 1.2
Reply With Quote #6

Just pointing these out:
Code:
	return PLUGIN_CONTINUE
you actually don't need these anywhere in your code

It is also better to only use fakemeta or engine (people prefer fakemeta).

Approved. Leaving in New Plugins for a while.

Last edited by Emp`; 03-28-2008 at 23:58.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
Redshift187
Junior Member
Join Date: Mar 2008
Old 03-29-2008 , 01:23   Re: Defuse Mistake 1.2
Reply With Quote #7

Thanks for the help. I use returns out of habit (I'm a software developer by trade). I have removed engine from my code.

Quote:
Originally Posted by Emp` View Post
Just pointing these out:
Code:
    return PLUGIN_CONTINUE
you actually don't need these anywhere in your code

It is also better to only use fakemeta or engine (people prefer fakemeta).

Approved. Leaving in New Plugins for a while.

Last edited by Redshift187; 03-29-2008 at 02:02.
Redshift187 is offline
rx1983
Senior Member
Join Date: Jan 2009
Location: BRASIL
Old 01-25-2009 , 16:41   Re: Defuse Mistake 1.4 - 03/30/08
Reply With Quote #8

c4 bomb frag all to team, ct defuse, ou terror explode, frag all, sos help

lang : portugues brazil , sos-help ???

como faço pra colocar frags para todos do mesmo time que ganha no counter strike ??????????
rx1983 is offline
Send a message via MSN to rx1983
chudy_cwaniak
Junior Member
Join Date: Apr 2010
Old 06-03-2010 , 12:13   Re: Defuse Mistake 1.4 - 03/30/08
Reply With Quote #9

I don’t know what to say except from the fact, that this plugin is very good . Makes the game more realistic by adding this element of a risk while defusing a bomb .
chudy_cwaniak is offline
ShortysPop1
Member
Join Date: Nov 2010
Old 01-13-2011 , 20:42   Re: Defuse Mistake 1.4 - 03/30/08
Reply With Quote #10

Oh cool... Gotta give this a try.
ShortysPop1 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 02:05.


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