 |
|
Senior Member
Join Date: Mar 2014
Location: Sweden
|

04-16-2014
, 17:03
Re: [request] bomb reward.
|
#5
|
Quote:
Originally Posted by Flick3rR
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(PLUGIN, VERSION, AUTHOR) 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(id, get_user_health(id) + 25) }
stock get_loguser_index() { new loguser[80], name[32] read_logargv(0, loguser, 79) parse_loguser(loguser, name, 31) return get_user_index(name) }
stock ColorMessage(const id, const input[], any:...){ new count = 1, players[32]; static msg[ 191 ]; vformat(msg, 190, input, 3); if (id) players[0] = id; else get_players(players , count , "ch"); { for (new i = 0; i < count; i++){ 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.
|
|
|
|