Raised This Month: $ Target: $400
 0% 

Receive HE Again [ V 0.2 ]


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Gameplay       
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 04-17-2014 , 05:33   Receive HE Again [ V 0.2 ]
Reply With Quote #1

Receive He Again
Release: 17.04.2014 | Last Update: 09.08.2014


This plugin does a very simple and "useless" thing. It just give you another he grenade, when you throw one, after a countdown set by cvar.

Table of Contents

Cvars
Installation
Possible Use
Change Log
Downloads

Cvars
top


Code:
  • he_count_down
    You can change the countdown with this cvar. Set any value you want, but I suggest it to be bigger that 20. It must be an integer, not a float number.
  • he_give_again
    If player already has a he grenade, should he receive another one ? 0 - no 1 - yes
Installation
top

  • Download the files provided at the end of this post.
  • Put the amxx file into addons/amxmodx/plugins.
  • Put the sma file into addons/amxmodx/scripting ( OPTIONAL ).
  • Open addons/amxmodx/configs/plugins.ini and add at the end of the file plugin_name.amxx
  • Restart/Change MAP

Possible Use
top


I can just think, that this is usefull for csdm/ fun servers.

Change Log
top


Code:
  • V 0.1 +Initial release
  • V 0.2: +Plugin rewritted from scratch
Downloads
top
  • V 0.1: ~ 76 downloads
Attached Files
File Type: sma Get Plugin or Get Source (receive_he_again.sma - 1088 views - 2.6 KB)

Last edited by HamletEagle; 08-09-2014 at 06:30.
HamletEagle is offline
Old 04-17-2014, 05:51
swapped
This message has been deleted by swapped. Reason: my bad
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 04-17-2014 , 05:56   Re: Receive HE Again [ 1 .0 Version ]
Reply With Quote #2

This is not an optimization, it's just a "scripting preference". I won't update with this, since it doesn't affect plugin performances.

Last edited by HamletEagle; 04-17-2014 at 06:01.
HamletEagle is offline
Old 04-17-2014, 05:56
Kia
This message has been deleted by Kia. Reason: Hamlet was faster.
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-17-2014 , 05:57   Re: Receive HE Again [ 1 .0 Version ]
Reply With Quote #3

There is nothing wrong doing > 0 or <= 0.
__________________
Arkshine is offline
swapped
BANNED
Join Date: Mar 2014
Location: OrpheuRegisterHook
Old 04-17-2014 , 06:00   Re: Receive HE Again [ 1 .0 Version ]
Reply With Quote #4

Sorry. i just tell what other person tell me.
My bad.
swapped is offline
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 04-17-2014 , 06:02   Re: Receive HE Again [ 1 .0 Version ]
Reply With Quote #5

Quote:
Originally Posted by swapped View Post
Sorry. i just tell what other person tell me.
My bad.
Quote:
Originally Posted by swapped View Post
so dont comment if you dont have experience.
__________________
Kia is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 04-17-2014 , 19:42   Re: Receive HE Again [ 1 .0 Version ]
Reply With Quote #6

Quote:
Originally Posted by HamletEagle View Post
1. Add a cvar to control countdown time.
Like this?:
PHP Code:
new cvar_countdown

public plugin_init() {
    
cvar_countdown register_cvar("countdown_time""20")
    
}

public 
Check_He_Grenade(heIndex) {
    else {
        
        
Countdown id ] = get_pcvar_num(cvar_countdown)
    }

------------------------------------------------------------------------------------------------
Quote:
Originally Posted by HamletEagle View Post
3. Check if player already has a HE grenade.
Maybe this:
PHP Code:
if ( Countdown id ] <= ) {
        
        
set_hudmessage255255420.560.1306.012.0 )
        
show_hudmessage id"You get a new HE!" )
        new 
allwep[32], num
        get_user_weapons
(idallwepnum)
        for(new 
2numi++) 
        {
            if(!(
allwep[i] == CSW_HEGRENADE))
                
give_itemid"weapon_hegrenade" )
        }
            
        
Countdown id ] = 0
        g_block 
id ] = false
    

I'm not really sure about this line:
PHP Code:
for(new 2numi++) 
How much the i has to be equal to get the grenade weapon type.

I though I could do it. If it's not my work, excuse me.
__________________

Last edited by Flick3rR; 04-18-2014 at 07:42.
Flick3rR is offline
Send a message via Skype™ to Flick3rR
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 04-18-2014 , 05:06   Re: Receive HE Again [ 1 .0 Version ]
Reply With Quote #7

I'm glad that you tried to make it.
This is correct.

PHP Code:
new cvar_countdown

public plugin_init() {
    
cvar_countdown register_cvar("countdown_time""20")
    
}

public 
Check_He_Grenade(heIndex) {
    else {
        
        
Countdown id ] = get_pcvar_num(cvar_countdown)
    }

I don't think that you have to loop trough all weapons.

PHP Code:
if ( Countdown id ] <= ) {
        
        
set_hudmessage255255420.560.1306.012.0 )
        
show_hudmessage id"You get a new HE!" )
        new 
allwep[32], num
        get_user_weapons
(idallwepnum)
        for(new 
2numi++) 
        {
            if(!(
allwep[i] == CSW_HEGRENADE))
                
give_itemid"weapon_hegrenade" )
        }
            
        
Countdown id ] = 0
        g_block 
id ] = false
    

You can simply check like this:

Code:
if ( !user_has_weapon ( id ,CSW_HEGRENADE ) ) //code
Please remove amxx+sma file, I'll update in the main post when I have time to add them...

Last edited by HamletEagle; 04-18-2014 at 05:27.
HamletEagle is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 04-18-2014 , 07:43   Re: Receive HE Again [ 1 .0 Version ]
Reply With Quote #8

Well, it really is. But I thought to present it by the hard way, because people here often love to make easy things more complicated and critic them. And that's why i decided to make it like this. Sorry for the attachments! Respect! Good plugin!
__________________

Last edited by Flick3rR; 04-18-2014 at 07:44.
Flick3rR is offline
Send a message via Skype™ to Flick3rR
Old 04-18-2014, 08:04
Spawner30
This message has been deleted by Spawner30. Reason: nvm
ironskillz1
AlliedModders Donor
Join Date: Jul 2012
Location: Sweden
Old 04-18-2014 , 18:21   Re: Receive HE Again [ 1 .0 Version ]
Reply With Quote #9

I was bored. So i optimized and fixed the plugin

Code:
#include <amxmodx>
#include <cstrike>
#include <fun>

new Cvar_Countdown, Cvar_HasGrenade, Cvar_ShowMessage
new Countdown[33]

public plugin_init( ) 
{
	//Events
	register_logevent( "EventRoundEnd", 2, "1=Round_End" ) 
	register_event( "DeathMsg", "EventDeathMsg", "a" ) 
	
	//Cvars
	Cvar_Countdown = register_cvar( "cvar_countdowntime", "20" ) // Time in seconds to get a grenade
	Cvar_HasGrenade = register_cvar( "cvar_hasgrenade", "1" ) // If a user already have a grenade || 1 = He get ammo || 2 = Block 
	Cvar_ShowMessage = register_cvar( "cvar_showmessage", "1" ) // Show message || 1 = Yes || 2 = No
}

public EventRoundEnd( ) 
{   
	new players[32], num, id;
	get_players( players, num, "a" );
			
	for( new i = 0; i < num; i++ )
	{
		id = players[i];
		
		if(task_exists(id)) 
			remove_task(id)
	}
}

public EventDeathMsg( ) 
{ 
	new id = read_data(2)
	
	if(task_exists(id)) 
		remove_task(id)
}

public grenade_throw( id, greindex, wId ) 
{
	if( wId == CSW_HEGRENADE && !task_exists(id)) 
	{
		Countdown[id] = get_pcvar_num(Cvar_Countdown)
		CountDown(id)
	}
}

public CountDown( id ) 
{ 
	if ( Countdown[id] >= 0 ) 
	{ 
		if(get_pcvar_num(Cvar_ShowMessage) == 1)
		{ 
			set_hudmessage(255, 255, 42, 0.56, 0.13, 0, 1.0, 12.0)
			show_hudmessage ( id, "You will get a new grenade in %d second%s", Countdown[id], Countdown[id] == 1 ? "s" : "" )
		}
		
		Countdown[id]--
		
		set_task ( 1.0, "CountDown", id )
	}
	else if ( Countdown[id] <= 0 ) 
	{
		new iWeapons[32], iNum
		get_user_weapons(id, iWeapons, iNum)

		for (new i=0; i < iNum; i++) 
		{			
			if(iWeapons[i] == CSW_HEGRENADE)
			{
				if(get_pcvar_num(Cvar_HasGrenade) == 1)
				{
					if(get_pcvar_num(Cvar_ShowMessage) == 1)
					{ 
						set_hudmessage( 255, 255, 42, 0.56, 0.13, 0, 6.0, 12.0 )
						show_hudmessage ( id, "You got another grenade!" )
					}
					
					cs_set_user_bpammo( id, CSW_HEGRENADE, 2 ) 
					return
				}
				else if(get_pcvar_num(Cvar_HasGrenade) == 2)
				{
					if(get_pcvar_num(Cvar_ShowMessage) == 1)
					{ 
						set_hudmessage( 255, 255, 42, 0.56, 0.13, 0, 6.0, 12.0 )
						show_hudmessage ( id, "You already have a grenade. You need to throw your grenade to get another")
					}
					return
				}
			}
			else
			{
				if(get_pcvar_num(Cvar_ShowMessage) == 1)
				{ 
					set_hudmessage( 255, 255, 42, 0.56, 0.13, 0, 6.0, 12.0 )
					show_hudmessage ( id, "You got a new grenade!" )
				}
		
				give_item( id, "weapon_hegrenade" )
			}
		}
	}
}
__________________
I have many private and unique plugins for Jailbreak and Hide'N'Seek. PM me for more info.

Pm me.

Check out my roulette site.
ironskillz1 is offline
Send a message via Skype™ to ironskillz1
Spawner30
BANNED
Join Date: Dec 2013
Location: I Don't Know Yet
Old 04-19-2014 , 06:02   Re: Receive HE Again [ 1 .0 Version ]
Reply With Quote #10

You can add a cvar for how much can give grenade !
Spawner30 is offline
Send a message via Skype™ to Spawner30
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 17:50.


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