Raised This Month: $ Target: $400
 0% 

[request] bomb reward.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
FR0NTLINE
AlliedModders Donor
Join Date: Apr 2006
Location: Riverside Cali
Old 04-16-2014 , 15:51   [request] bomb reward.
Reply With Quote #1

I'm in need of A health reward for THE CT who defuses the bomb
He will receive 25 health the next round for his Accomplishments.
Thank you.
__________________
FR0NTLINE is offline
Send a message via AIM to FR0NTLINE Send a message via MSN to FR0NTLINE Send a message via Yahoo to FR0NTLINE
Old 04-16-2014, 16:14
Flick3rR
This message has been deleted by Flick3rR. Reason: Mistake
Buckshot
Senior Member
Join Date: Mar 2014
Location: Sweden
Old 04-16-2014 , 16:38   Re: [request] bomb reward.
Reply With Quote #2

Code:
#include < amxmodx > #include < fakemeta_util > // edit: I got a brainfart, and included this instead of using set_user_health.. but whatever, it doesnt make any performances worse, so im just gonna be lazy n leave you here, fakemeta. #include < hamsandwich > #pragma semicolon 1 new bool:HasReward[ 32 ]; public plugin_init( ) {     register_plugin( "Bomb Reward", "1.0", "BuckShot" );         register_logevent( "Player_DefusedBomb", 3, "2=Defused_The_Bomb" );     RegisterHam( Ham_Spawn, "player", "FwdHamPlayerSpawnPost", 1 ); } stock get_loguser_index( ) {     new loguser[ 80 ], name[ 32 ];     read_logargv( 0, loguser, 79 );     parse_loguser( loguser, name, 31 );       return get_user_index( name ); } public Player_DefusedBomb( ) {         new id = get_loguser_index( );     HasReward[ id ] = true; } public FwdHamPlayerSpawnPost( id ) {     if( HasReward[ id ] )     {         set_pev( id, pev_health, float( pev( id, pev_health ) + 25 ) );         HasReward[ id ] = false;     } } public client_disconnect( id ) {     if( HasReward[ id ] )         HasReward[ id ] = false; }
__________________
PM me for private work.



Last edited by Buckshot; 04-16-2014 at 21:27.
Buckshot is offline
Send a message via Skype™ to Buckshot
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 04-16-2014 , 16:52   Re: [request] bomb reward.
Reply With Quote #3

Well, it works, buckshot! And I had some time, made this:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>

#define PLUGIN "Defuse/Plant Bonus"
#define VERSION "1.0"
#define AUTHOR "AUTHOR"

new bool:HasDefuse[33], bool:HasPlant[33]
new 
cvar_plant

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_event("HLTV""new_round""a""1=0""2=0")  
    
register_logevent("defused"3"2=Defused_The_Bomb")
    
register_logevent("planted"3"2=Planted_The_Bomb")
    
cvar_plant register_cvar("plant_hp_bonus""0")
}

public 
defused()
{
    new 
id get_loguser_index()
    
HasDefuse[id] = true
    ColorMessage
(id"^3You will receive a ^425 HP bonus ^3at the begining of next round for defusing the bomb!")
}

public 
planted()
{
    if(
get_pcvar_num(cvar_plant))
    {
        new 
id get_loguser_index()
        
HasPlant[id] = true
        ColorMessage
(id"^3You will receive a ^425 HP bonus ^3at the begining of next round for planting the bomb!")
    }
}

public 
new_round(id)
{
    if(
HasDefuse[id] == true || HasPlant[id] == true)
        
set_user_health(idget_user_health(id) + 25)
}

stock get_loguser_index()
{
    new 
loguser[80], name[32]
    
read_logargv(0loguser79)
    
parse_loguser(logusername31)
 
    return 
get_user_index(name)
}

stock ColorMessage(const id, const input[], any:...){
            new 
count 1players[32];
            static 
msg191 ];
            
vformat(msg190input3);
            if (
idplayers[0] = id; else get_players(players count "ch"); {
                for (new 
0counti++){
                    if (
is_user_connected(players[i])){
                        
message_begin(MSG_ONE_UNRELIABLE get_user_msgid("SayText"), _players[i]);
                        
write_byte(players[i]);
                        
write_string(msg);
                        
message_end();}}}
        } 
Added colormessage and eventually bonus for planting the bomb - turn it on or off with the cvar:
plant_hp_bonus "0/1"
It's turned off by default (as you wish)
__________________

Last edited by Flick3rR; 04-16-2014 at 16:53.
Flick3rR is offline
Send a message via Skype™ to Flick3rR
Buckshot
Senior Member
Join Date: Mar 2014
Location: Sweden
Old 04-16-2014 , 17:03   Re: [request] bomb reward.
Reply With Quote #4

Quote:
Originally Posted by Flick3rR View Post
Well, it works, buckshot! And I had some time, made this:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>

#define PLUGIN "Defuse/Plant Bonus"
#define VERSION "1.0"
#define AUTHOR "AUTHOR"

new bool:HasDefuse[33], bool:HasPlant[33]
new 
cvar_plant

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_event("HLTV""new_round""a""1=0""2=0")  
    
register_logevent("defused"3"2=Defused_The_Bomb")
    
register_logevent("planted"3"2=Planted_The_Bomb")
    
cvar_plant register_cvar("plant_hp_bonus""0")
}

public 
defused()
{
    new 
id get_loguser_index()
    
HasDefuse[id] = true
    ColorMessage
(id"^3You will receive a ^425 HP bonus ^3at the begining of next round for defusing the bomb!")
}

public 
planted()
{
    if(
get_pcvar_num(cvar_plant))
    {
        new 
id get_loguser_index()
        
HasPlant[id] = true
        ColorMessage
(id"^3You will receive a ^425 HP bonus ^3at the begining of next round for planting the bomb!")
    }
}

public 
new_round(id)
{
    if(
HasDefuse[id] == true || HasPlant[id] == true)
        
set_user_health(idget_user_health(id) + 25)
}

stock get_loguser_index()
{
    new 
loguser[80], name[32]
    
read_logargv(0loguser79)
    
parse_loguser(logusername31)
 
    return 
get_user_index(name)
}

stock ColorMessage(const id, const input[], any:...){
            new 
count 1players[32];
            static 
msg191 ];
            
vformat(msg190input3);
            if (
idplayers[0] = id; else get_players(players count "ch"); {
                for (new 
0counti++){
                    if (
is_user_connected(players[i])){
                        
message_begin(MSG_ONE_UNRELIABLE get_user_msgid("SayText"), _players[i]);
                        
write_byte(players[i]);
                        
write_string(msg);
                        
message_end();}}}
        } 
Added colormessage and eventually bonus for planting the bomb - turn it on or off with the cvar:
plant_hp_bonus "0/1"
It's turned off by default (as you wish)
You got many problems in your code... I'm not gonna review your whole code, but one thing i see right away: You can't get player index in a global event such as hltv event like this: "public new_round(id)"..
__________________
PM me for private work.



Last edited by Buckshot; 04-16-2014 at 17:05.
Buckshot is offline
Send a message via Skype™ to Buckshot
FR0NTLINE
AlliedModders Donor
Join Date: Apr 2006
Location: Riverside Cali
Old 04-16-2014 , 17:20   Re: [request] bomb reward.
Reply With Quote #5

It works! Thanks.
__________________
FR0NTLINE is offline
Send a message via AIM to FR0NTLINE Send a message via MSN to FR0NTLINE Send a message via Yahoo to FR0NTLINE
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 04-16-2014 , 19:20   Re: [request] bomb reward.
Reply With Quote #6

@Buckshot to be safe from errors, you need to set reward false on player on disconnect.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
Buckshot
Senior Member
Join Date: Mar 2014
Location: Sweden
Old 04-16-2014 , 19:30   Re: [request] bomb reward.
Reply With Quote #7

Quote:
Originally Posted by hornet View Post
@Buckshot to be safe from errors, you need to set reward false on player on disconnect.
Thanks, fixed Still learning you know.
__________________
PM me for private work.



Last edited by Buckshot; 04-16-2014 at 19:51.
Buckshot is offline
Send a message via Skype™ to Buckshot
FR0NTLINE
AlliedModders Donor
Join Date: Apr 2006
Location: Riverside Cali
Old 04-16-2014 , 20:20   Re: [request] bomb reward.
Reply With Quote #8

Thanks Hornet I was hoping you'd pop up for a correction
AND THANK YOU BUCKSHOT!!!!!!
__________________
FR0NTLINE is offline
Send a message via AIM to FR0NTLINE Send a message via MSN to FR0NTLINE Send a message via Yahoo to FR0NTLINE
swapped
BANNED
Join Date: Mar 2014
Location: OrpheuRegisterHook
Old 04-17-2014 , 01:27   Re: [request] bomb reward.
Reply With Quote #9

Quote:
Originally Posted by hornet View Post
@Buckshot to be safe from errors, you need to set reward false on player on disconnect.
Also check is_user_alive() in ham_Spawn
swapped is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 04-17-2014 , 02:57   Re: [request] bomb reward.
Reply With Quote #10

Quote:
Originally Posted by swapped View Post
Also check is_user_alive() in ham_Spawn
Not required.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet 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 17:53.


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