AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   Award Grenades: Reloaded v1.5 (https://forums.alliedmods.net/showthread.php?t=75900)

Sam Tsuki 08-14-2008 16:13

Award Grenades: Reloaded v1.5
 
16 Attachment(s)
Award Grenades: Reloaded

.: Description :.
When you kill a person you'll be awarded with Grenades.
You can use 3 conditions:
1. Team
2. Head Shot
3. Weapon

.: Required Modules :.
Fun
CSX
CStrike

.: CVARs :.
Code:

award_nades 1        //Enables the plugin
award_he 1        //How many HE Grenades a player should be awarded when killing another player?
award_fb 1        //How many Flash Bangs a player should be awarded when killing another player?
award_sg 1        //How many Smoke Grenades a player should be awarded when killing another player?
he_max 3        //What's the maximum number of HEs a player can be awarded with?
fb_max 5        //What's the maximum number of FBs a player can be awarded with?
sg_max 4        //What's the maximum number of SGs a player can be awarded with?
award_team Any        //Which team should be awarded? (Any, CT, T)
award_headshot 0    //Is a Head Shot needed ot get awarded?
award_weapon any    //What weapon is needed to get awarded? (knife, usp, glock18, etc.)

.: CMDs :.
Code:

say /awardcmds                                //Shows Award Grenades: Reloaded Commands
say /awardmenu                                //Shows a menu to know the awards and conditions
award_nades_toggle <0|1>                        //ADMIN_LEVEL_D, Enables or disables the plugin
award_nades_awards <he><fb><sg>                        //ADMIN_LEVEL_D, Changes the the awarded Grenades
give_nade <name> <nade>    <amount>                    //ADMIN_LEVEL_D, Gives a Grenade to a player
//Leave <nade> empty to give all Grenades, 'he' to give HEs, 'fb' to give Flash Bangs, 'sg' to give smoke grenades
award_team_toggle <Any|CT|T>                        //ADMIN_LEVEL_D, Changes which team should be awarded? *case sensetive*
award_hs_toggle <0|1>                            //ADMIN_LEVEL_D, Changes if a head shot is needed to get awarded
award_wpn_toggle <any|weapon name>                    //ADMIN_LEVEL_D, Changes if a weapon is needed to get awarded (knife, usp, glock18, etc.)
award_valid_weapons                            //ADMIN_LEVEL_D, Shows valid weapons
award_valid_weapons2                            //ADMIN_LEVEL_D, Shows the rest of the valid weapons

.: Updates :.
v1.1
- Fixed some scripting errors

v1.2
- Added award_team cvar and award_team_toggle command

v1.3
-Changed name to "Award Grenades: Reloaded"
-Added award_headshot and award_weapon CVARs
-Added award_nades_awards, award_hs_toggle, award_wpn_toggle, award_valid_weapons and award_valid_weapons2 ADMIN_LEVEL_D commands
-Added /awardcmds and /awardmenu client commands

v1.4
-Some bug fixes

v1.5
-Removed "award_fb_amount" CVAR
-Added "he_max", "fb_max" and "sg_max" CVARs
-Now the plugin uses v3x's Grenade Sack method to give nades

Requested

ConnorMcLeod 08-14-2008 16:22

Re: Award Grenades
 
You can remove #include <engine> as engine is not needed.
client_death is a csx forward so you need to include it.

You must use pcvars and learn how to use it.
PHP Code:

    //Check if Award Grenades is enabled
    
if(award_nades == 0) return PLUGIN_HANDLED 

Correct way :
PHP Code:

    //Check if Award Grenades is enabled
    
if(get_pcvarnum(award_nades) == 0) return PLUGIN_HANDLED 

There's a lot of other errors.

Sam Tsuki 08-14-2008 16:24

Re: Award Grenades
 
Quote:

Originally Posted by connorr (Post 669626)
You can remove #include <engine> as engine is not needed.
client_death is a csx forward so you need to include it.

You must use pcvars and learn how to use it.
PHP Code:

    //Check if Award Grenades is enabled
    
if(award_nades == 0) return PLUGIN_HANDLED 

Correct way :
PHP Code:

    //Check if Award Grenades is enabled
    
if(get_pcvarnum(award_nades) == 0) return PLUGIN_HANDLED 

There's a lot of other errors.

Done with everything

ConnorMcLeod 08-14-2008 16:37

Re: Award Grenades
 
Then this is false :

PHP Code:

    award_nades str_to_num(arg

And you still don't use pcvars for :
PHP Code:

    register_cvar("award_he""1")
    
register_cvar("award_fb""1")
    
register_cvar("award_fb_amount""2")
    
register_cvar("award_sg""1"

Also you should use DeathMsg event instead of csx forward.

Other big error :
PHP Code:

    if(get_cvar_num("award_fb") == 1) {
        
give_item(attacker"weapon_flashbang")
        if(
get_cvar_num("award_fb_amount") == 2)
            
give_item(attacker"weapon_flashbang")
    } 

Value 2 will never be detected.

Sam Tsuki 08-14-2008 16:44

Re: Award Grenades
 
Quote:

Originally Posted by connorr (Post 669636)
Then this is false :

PHP Code:

    award_nades str_to_num(arg

And you still don't use pcvars for :
PHP Code:

    register_cvar("award_he""1")
    
register_cvar("award_fb""1")
    
register_cvar("award_fb_amount""2")
    
register_cvar("award_sg""1"

Also you should use DeathMsg event instead of csx forward.

Other big error :
PHP Code:

    if(get_cvar_num("award_fb") == 1) {
        
give_item(attacker"weapon_flashbang")
        if(
get_cvar_num("award_fb_amount") == 2)
            
give_item(attacker"weapon_flashbang")
    } 

Value 2 will never be detected.

That's wierd
I test it and it's working well
When I used DeathMsg I got a no free edict error
I tried putting award_fb_amount to 1 and 2 and both worked probably
And about the:
Code:

award_nades = str_to_num(arg)
Even if I used:
Code:

award_nades = arg
It will still do the same
Correct me if anything is wrong
I'm still new you know

Sam Tsuki 08-14-2008 17:01

Re: Award Grenades
 
Ok...
Converted all cvars to pcvars and they're working well
Now I need to find a solution for the no free edicts error when using DeathMsg

ConnorMcLeod 08-14-2008 17:10

Re: Award Grenades
 
Quote:

Originally Posted by Sam Tsuki (Post 669639)
Even if I used:
Code:

award_nades = arg

Seems that you should learn more before posting plugins.
Just keep on.

Sam Tsuki 08-14-2008 18:12

Re: Award Grenades
 
Quote:

Originally Posted by connorr (Post 669657)
Seems that you should learn more before posting plugins.
Just keep on.

Yeah I didn't notice
I need to convert award_nades to an array to use that one

Dores 08-14-2008 19:23

Re: Award Grenades
 
connorr you're such a cocky :)

Sam Tsuki, this:

PHP Code:

if(equal(arg1"")) {
  
console_print(id"[AG] Usage: give_nade <name> <nade he,fb,sg> <amount 1,2>")
  return 
PLUGIN_HANDLED
 


does the same as:
PHP Code:

register_concmd("give_nade""give_nade"ADMIN_LEVEL_D"<name> <nade he,fb,sg> <amount 1,2>"

it will print the usage if nothing was put while used the console command.

same for the other concmd.

Sam Tsuki 08-14-2008 19:34

Re: Award Grenades
 
Quote:

Originally Posted by dor123 (Post 669716)
connorr you're such a cocky :)

Sam Tsuki, this:

PHP Code:

if(equal(arg1"")) {
  
console_print(id"[AG] Usage: give_nade <name> <nade he,fb,sg> <amount 1,2>")
  return 
PLUGIN_HANDLED
 


does the same as:
PHP Code:

register_concmd("give_nade""give_nade"ADMIN_LEVEL_D"<name> <nade he,fb,sg> <amount 1,2>"

it will print the usage if nothing was put while used the console command.

same for the other concmd.

Ok...
Removed


All times are GMT -4. The time now is 03:16.

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