Raised This Month: $ Target: $400
 0% 

[request] bomb reward.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Buckshot
Senior Member
Join Date: Mar 2014
Location: Sweden
Old 04-16-2014 , 17:03   Re: [request] bomb reward.
Reply With Quote #5

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
 



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