Raised This Month: $ Target: $400
 0% 

Full Pack Grenades [27/02/2014]


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Fun Stuff       
Simple32
Junior Member
Join Date: Feb 2014
Old 02-27-2014 , 01:48   Full Pack Grenades [27/02/2014]
Reply With Quote #1

Full Pack Grenades
Version 1.0.9
By Simple32



Description:
You receive grenades through Ham_Spawn each round. You can use Bit flags to put what grenades you want for e.g if you just want an HE Grenade you put the flag "a". There are three options of what grenades you want to put, they're "abc".

A = HE Grenade
B = Flashbang
C = Smoke Grenade

Cvars:
mode_grenades "abc" [Default]"

Credits:
Black Rose - Made Bit flags work and added extra codes.

Modules:
Hamsandwich
Fun

Changelog:
Version 1.0.3 - Initial Release.
Version 1.0.4 - Made the variable in one whole line.
Version 1.0.5 - Removed #defines and optimized the code.
Version 1.0.6 - Waste of if user is alive code and optimized it to once only.
Version 1.0.7 - Bit flags are added and cvar all in one.
Version 1.0.8 - Added client_print, to see what grenades you received.
Version 1.0.9 - Removed server_print from some places and added colorchat.
Attached Files
File Type: sma Get Plugin or Get Source (fpg.sma - 667 views - 1.5 KB)

Last edited by Simple32; 03-02-2014 at 04:23.
Simple32 is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 02-27-2014 , 07:27   Re: Full Pack Grenades [27/02/2014]
Reply With Quote #2

PHP Code:
#include <hamsandwich>
#include <fun>

new gCvarHEGrenadegCvarFlashbanggCvarSmokeGrenade;

#define PLUGIN "Full Pack Grenades"
#define VERSION "1.0.4"
#define AUTHOR "Simple32" 

public plugin_init() {
    
register_plugin"Full Pack Grenades""1.0.4""Simple32" );
    
    
gCvarHEGrenade register_cvar"mode_hegrenade""1" );
    
gCvarFlashbang register_cvar"mode_flashbang""1" );
    
gCvarSmokeGrenade register_cvar"mode_smokegrenade""1" );
    
    
RegisterHamHam_Spawn"player""fwdPlayerSpawn");
}

public 
fwdPlayerSpawnid ) {
    if(
get_pcvar_numgCvarHEGrenade ))
    {
        if( 
is_user_aliveid ) ) {
            
give_item(id"weapon_hegrenade");
        }
        if(
get_pcvar_numgCvarFlashbang ))
        {
            if( 
is_user_aliveid ) ) {
                
give_item(id"weapon_flashbang");
            }
            if(
get_pcvar_numgCvarSmokeGrenade ))
            {
                if( 
is_user_aliveid ) ) {
                    
give_item(id"weapon_smokegrenade");
                }
            }
        }
    }
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang3081\\ f0\\ fs16 \n\\ par }
*/ 
Poorly coded and redundant.
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 02-27-2014 , 11:39   Re: Full Pack Grenades [27/02/2014]
Reply With Quote #3

From what I first saw:
PHP Code:
//Redacted Code
#define PLUGIN "Full Pack Grenades"
#define VERSION "1.0.4"
#define AUTHOR "Simple32" 

public plugin_init() {
    
register_plugin"Full Pack Grenades""1.0.4""Simple32" );
   
//Redacted code
}
//Redacted Code 
Waste of #defines
PHP Code:
//Redacted Code
#define PLUGIN "Full Pack Grenades"
#define VERSION "1.0.4"
#define AUTHOR "Simple32" 

public plugin_init() {
    
register_pluginPLUGINVERSIONAUTHOR );
   
//Redacted code
}
//Redacted Code 
WildCard65 is offline
Simple32
Junior Member
Join Date: Feb 2014
Old 02-28-2014 , 06:43   Re: Full Pack Grenades [27/02/2014]
Reply With Quote #4

Wickedd, since you said it is poorly coded can you please give me suggestions I could fix it and make it look more efficient.
Simple32 is offline
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 02-28-2014 , 08:11   Re: Full Pack Grenades [27/02/2014]
Reply With Quote #5

  1. Your description is wrong. The plugin does not disable grenades, only gives them if CVar is 1.
  2. You only need to check if the player is alive once.
  3. Plugin is redundant.
__________________
Kia is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 02-28-2014 , 08:17   Re: Full Pack Grenades [27/02/2014]
Reply With Quote #6

4. Change the 3 cvars into 1 and use Bit flags to enable/disable each type
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Simple32
Junior Member
Join Date: Feb 2014
Old 02-28-2014 , 16:49   Re: Full Pack Grenades [27/02/2014]
Reply With Quote #7

Do you mean as in use flags for each grenades so you can disable and enable which ones you want?

Last edited by Simple32; 02-28-2014 at 16:51.
Simple32 is offline
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 03-01-2014 , 00:36   Re: Full Pack Grenades [27/02/2014]
Reply With Quote #8

Quote:
Originally Posted by YamiKaitou View Post
4. Change the 3 cvars into 1 and use Bit flags to enable/disable each type
Quote:
Originally Posted by Simple32 View Post
Do you mean as in use flags for each grenades so you can disable and enable which ones you want?
No.
__________________
Blizzard_87 is offline
Simple32
Junior Member
Join Date: Feb 2014
Old 03-01-2014 , 17:02   Re: Full Pack Grenades [27/02/2014]
Reply With Quote #9

Changelog:
Version 1.0.7 - Added Bit flags and cvar all in one.

Last edited by Simple32; 03-01-2014 at 19:46.
Simple32 is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 03-01-2014 , 17:03   Re: Full Pack Grenades [27/02/2014]
Reply With Quote #10

Your description still incorrectly states what the plugin does
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou 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 02:13.


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