44 |
- molotov_firetime - Duration (in seconds) of fire effects, sounds, etc. [default = 6] |
- molotov_firetime - Duration (in seconds) of fire effects, sounds, etc. [default = 6] |
45 |
- molotov_firedamage - Amount of damage done by fire effects (every 0.2 secs). [default = 3] |
- molotov_firedamage - Amount of damage done by fire effects (every 0.2 secs). [default = 3] |
46 |
- molotov_ff - Disable(0)/enable(1) the ability to damage/kill someone on your team with molotov. [default = 1] (Was molotov_tk) |
- molotov_ff - Disable(0)/enable(1) the ability to damage/kill someone on your team with molotov. [default = 1] (Was molotov_tk) |
47 |
- molotov_override_he - Override the original hegrenade automaticly with molotov. [default = 0] (Was molotov_tempoverride) |
- molotov_override_he - Override the original hegrenade automatically with molotov. [default = 0] (Was molotov_tempoverride) |
48 |
- molotov_max - Max num of molotovs able to carry. [default = 1] (Does not work with override) |
- molotov_max - Max num of molotovs able to carry. [default = 1] (Does not work with override) |
49 |
- molotov_inmenu - Puts molotov in the end of the equipment buymenu (old menu, not VGUI). [default = 0] |
- molotov_inmenu - Puts molotov in the end of the equipment buymenu (old menu, not VGUI). [default = 0] |
50 |
(If the override cvar is enabled the hegrenade will be replaced instead.) |
(If the override cvar is enabled the hegrenade will be replaced instead.) |
53 |
|
|
54 |
* Required Modules: |
* Required Modules: |
55 |
- Fakemeta |
- Fakemeta |
56 |
- Fun |
- Fakemeta Utilities |
57 |
- Cstrike |
- Cstrike |
|
- CSX |
|
58 |
|
|
59 |
* Changelog/Credit: |
* Changelog/Credit: |
60 |
- DynamicBits |
- DynamicBits |
61 |
|
* (SVN) |
62 |
|
- Removed unnecessary csx include |
63 |
|
- Converted fun functions to fakemeta_util functions (removed fun include) |
64 |
|
- Minor optimizations |
65 |
|
- Fixed a few typos |
66 |
* Version 3.20 (2008-11-20) |
* Version 3.20 (2008-11-20) |
67 |
- My first public release |
- My first public release |
68 |
- Finally tracked down and fixed the intermittent crashing problem (I hope!) |
- Finally tracked down and fixed the intermittent crashing problem (I hope!) |
101 |
#include <amxmodx> |
#include <amxmodx> |
102 |
#include <amxmisc> |
#include <amxmisc> |
103 |
#include <fakemeta> |
#include <fakemeta> |
|
#include <cstrike> |
|
|
#include <csx> |
|
|
#include <fun> |
|
104 |
#include <fakemeta_util> |
#include <fakemeta_util> |
105 |
|
#include <cstrike> |
106 |
|
|
107 |
// Uncomment the following line to enable debug logging. |
// Uncomment the following line to enable debug logging. |
108 |
//#define MOLOTOV_DEBUG |
//#define MOLOTOV_DEBUG |
153 |
|
|
154 |
public plugin_init() { |
public plugin_init() { |
155 |
|
|
156 |
register_plugin("Molotov Cocktail", "3.20", AUTHORS); |
register_plugin("Molotov Cocktail", "3.20SVN", AUTHORS); |
157 |
|
|
158 |
register_menucmd(register_menuid("Buy Molotov Coctail"), MOLOTOV_MENU_KEYS, "giveMolotov"); |
register_menucmd(register_menuid("Buy Molotov Cocktail"), MOLOTOV_MENU_KEYS, "giveMolotov"); |
159 |
#if defined MOLOTOV_DEBUG |
#if defined MOLOTOV_DEBUG |
160 |
register_clcmd("molotov_menutest", "show_molotov_menu"); |
register_clcmd("molotov_menutest", "show_molotov_menu"); |
161 |
#endif |
#endif |
348 |
|
|
349 |
for (new i; i < g_MaxPlayers; i++) { |
for (new i; i < g_MaxPlayers; i++) { |
350 |
if (g_frags[i] && is_user_connected(i)) { |
if (g_frags[i] && is_user_connected(i)) { |
351 |
set_user_frags(i, get_user_frags(i) + g_frags[i]); |
fm_set_user_frags(i, get_user_frags(i) + g_frags[i]); |
352 |
} |
} |
353 |
g_frags[i] = 0; |
g_frags[i] = 0; |
354 |
} |
} |
503 |
targetTeam = TEAM_TWO; |
targetTeam = TEAM_TWO; |
504 |
} |
} |
505 |
|
|
506 |
get_players(Players, iNum, "ac"); // Bots don't understand molotov cocktails |
get_players(Players, iNum, "ac"); // Bots don't understand Molotov cocktails |
507 |
|
|
508 |
for (new i = 0; i < iNum; ++i) { |
for (new i = 0; i < iNum; ++i) { |
509 |
target = Players[i]; |
target = Players[i]; |
511 |
if ((targetTeam == 0) || (get_user_team(target) == targetTeam)) { |
if ((targetTeam == 0) || (get_user_team(target) == targetTeam)) { |
512 |
g_hasMolotov[target] = MOLOTOV_HARD_LIMIT; |
g_hasMolotov[target] = MOLOTOV_HARD_LIMIT; |
513 |
|
|
514 |
give_item(target, "weapon_hegrenade"); |
fm_give_item(target, "weapon_hegrenade"); |
515 |
cs_set_user_bpammo(target, CSW_HEGRENADE, MOLOTOV_HARD_LIMIT); |
cs_set_user_bpammo(target, CSW_HEGRENADE, MOLOTOV_HARD_LIMIT); |
516 |
emit_sound(target, CHAN_WEAPON, "items/gunpickup2.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM); |
emit_sound(target, CHAN_WEAPON, "items/gunpickup2.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM); |
517 |
} |
} |
540 |
} |
} |
541 |
} |
} |
542 |
} |
} |
543 |
client_print(0, print_chat, "ADMIN %s: has given %s %d Molotov Cocktails!", adminName, targetTeamName, MOLOTOV_HARD_LIMIT); |
client_print(0, print_chat, "ADMIN %s: has given %s %d Molotov cocktails!", adminName, targetTeamName, MOLOTOV_HARD_LIMIT); |
544 |
|
|
545 |
} else { |
} else { |
546 |
|
|
555 |
|
|
556 |
g_hasMolotov[target] = MOLOTOV_HARD_LIMIT; |
g_hasMolotov[target] = MOLOTOV_HARD_LIMIT; |
557 |
|
|
558 |
give_item(target, "weapon_hegrenade"); |
fm_give_item(target, "weapon_hegrenade"); |
559 |
cs_set_user_bpammo(target, CSW_HEGRENADE, MOLOTOV_HARD_LIMIT); |
cs_set_user_bpammo(target, CSW_HEGRENADE, MOLOTOV_HARD_LIMIT); |
560 |
|
|
561 |
emit_sound(target, CHAN_WEAPON, "items/gunpickup2.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM); |
emit_sound(target, CHAN_WEAPON, "items/gunpickup2.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM); |
562 |
|
|
563 |
client_print(target, print_chat, "ADMIN %s: has given you %d Molotov Cocktails!", adminName, MOLOTOV_HARD_LIMIT); |
client_print(target, print_chat, "ADMIN %s: has given you %d Molotov cocktails!", adminName, MOLOTOV_HARD_LIMIT); |
564 |
|
|
565 |
} |
} |
566 |
return PLUGIN_HANDLED; |
return PLUGIN_HANDLED; |
582 |
} |
} |
583 |
|
|
584 |
if (!is_user_alive(id)) { |
if (!is_user_alive(id)) { |
585 |
client_print(id, print_center, "You can't buy Molotov Cocktails because you are dead."); |
client_print(id, print_center, "You can't buy Molotov cocktails because you are dead."); |
586 |
return PLUGIN_HANDLED; |
return PLUGIN_HANDLED; |
587 |
} |
} |
588 |
|
|
594 |
new money = cs_get_user_money(id); |
new money = cs_get_user_money(id); |
595 |
|
|
596 |
if (money < get_pcvar_num(pPrice)) { |
if (money < get_pcvar_num(pPrice)) { |
597 |
client_print(id, print_center, "You don't have enough $ to buy a Molotov Cocktail."); |
client_print(id, print_center, "You don't have enough $ to buy a Molotov cocktail."); |
598 |
return PLUGIN_HANDLED; |
return PLUGIN_HANDLED; |
599 |
} |
} |
600 |
|
|
601 |
if (g_hasMolotov[id] == get_pcvar_num(pMaxMolotovs)) { |
if (g_hasMolotov[id] == get_pcvar_num(pMaxMolotovs)) { |
602 |
if (g_hasMolotov[id] == 1) { |
if (g_hasMolotov[id] == 1) { |
603 |
client_print(id, print_center, "You already have a Molotov Cocktail."); |
client_print(id, print_center, "You already have a Molotov cocktail."); |
604 |
} else { |
} else { |
605 |
client_print(id, print_center, "You already have %d Molotov Cocktails.", g_hasMolotov[id]); |
client_print(id, print_center, "You already have %d Molotov cocktails.", g_hasMolotov[id]); |
606 |
} |
} |
607 |
return PLUGIN_HANDLED; |
return PLUGIN_HANDLED; |
608 |
} |
} |
613 |
} |
} |
614 |
|
|
615 |
cs_set_user_money(id, money - get_pcvar_num(pPrice)); |
cs_set_user_money(id, money - get_pcvar_num(pPrice)); |
616 |
give_item(id, "weapon_hegrenade"); |
fm_give_item(id, "weapon_hegrenade"); |
617 |
cs_set_user_bpammo(id, CSW_HEGRENADE, ++g_hasMolotov[id]); |
cs_set_user_bpammo(id, CSW_HEGRENADE, ++g_hasMolotov[id]); |
618 |
client_print(id, print_chat, "You got a Molotov Cocktail!"); |
client_print(id, print_chat, "You got a Molotov cocktail!"); |
619 |
|
|
620 |
return PLUGIN_HANDLED; |
return PLUGIN_HANDLED; |
621 |
} |
} |
716 |
new money = cs_get_user_money(id); |
new money = cs_get_user_money(id); |
717 |
|
|
718 |
if (money < get_pcvar_num(pPrice)) { |
if (money < get_pcvar_num(pPrice)) { |
719 |
client_print(id, print_center, "You don't have enough $ to buy a Molotov Cocktail."); |
client_print(id, print_center, "You don't have enough $ to buy a Molotov cocktail."); |
720 |
return PLUGIN_HANDLED; |
return PLUGIN_HANDLED; |
721 |
} |
} |
722 |
|
|
723 |
if (g_hasMolotov[id] == get_pcvar_num(pMaxMolotovs)) { |
if (g_hasMolotov[id] == get_pcvar_num(pMaxMolotovs)) { |
724 |
if (g_hasMolotov[id] == 1) { |
if (g_hasMolotov[id] == 1) { |
725 |
client_print(id, print_center, "You already have a Molotov Cocktail."); |
client_print(id, print_center, "You already have a Molotov cocktail."); |
726 |
} else { |
} else { |
727 |
client_print(id, print_center, "You already have %d Molotov Cocktails.", g_hasMolotov[id]); |
client_print(id, print_center, "You already have %d Molotov cocktails.", g_hasMolotov[id]); |
728 |
} |
} |
729 |
return PLUGIN_HANDLED; |
return PLUGIN_HANDLED; |
730 |
} else if (!g_hasMolotov[id] && user_has_weapon(id, CSW_HEGRENADE)) { |
} else if (!g_hasMolotov[id] && user_has_weapon(id, CSW_HEGRENADE)) { |
733 |
} |
} |
734 |
|
|
735 |
cs_set_user_money(id, money - get_pcvar_num(pPrice)); |
cs_set_user_money(id, money - get_pcvar_num(pPrice)); |
736 |
give_item(id, "weapon_hegrenade"); |
fm_give_item(id, "weapon_hegrenade"); |
737 |
cs_set_user_bpammo(id, CSW_HEGRENADE, ++g_hasMolotov[id]); |
cs_set_user_bpammo(id, CSW_HEGRENADE, ++g_hasMolotov[id]); |
738 |
client_print(id, print_chat, "You got a Molotov Cocktail!"); |
client_print(id, print_chat, "You got a Molotov cocktail!"); |
739 |
|
|
740 |
return PLUGIN_HANDLED; |
return PLUGIN_HANDLED; |
741 |
} |
} |
1034 |
|
|
1035 |
// This will run at event New Round if enabled |
// This will run at event New Round if enabled |
1036 |
public show_molotov_menu(id) { |
public show_molotov_menu(id) { |
1037 |
new menu[192]; |
new menu[128]; |
1038 |
|
formatex(menu, 127, "Buy Molotov Cocktail ($%d)?^n^n1. Yes^n2. No^n^n0. Exit", get_pcvar_num(pPrice)); |
|
// Get a custom menu title with the price |
|
|
// When done it should look something like this: |
|
|
// Buy Molotov Cocktail ($1200)... |
|
|
new menu_title_text[120], the_molotov_price[7]; |
|
|
get_cvar_string("molotov_price", the_molotov_price, 6); |
|
|
strcat(menu_title_text, "Buy Molotov Cocktail ($", 40); |
|
|
strcat(menu_title_text, the_molotov_price, 40); |
|
|
strcat(menu_title_text, ")?^n^n1. Yes, I will burn them all...^n2. No, I will kill in some other way...^n^n0. EXIT MENU", 119); |
|
|
|
|
|
format(menu, 191, menu_title_text); |
|
1039 |
|
|
1040 |
// This shows the menu for 30 seconds, I tried first with get_cvar_num("mp_buytime")*60 , but it didn't work well |
// This shows the menu for 30 seconds, I tried first with get_cvar_num("mp_buytime")*60 , but it didn't work well |
1041 |
// when using 0.5 as mp_buytime. If you like, just change the time below |
// when using 0.5 as mp_buytime. If you like, just change the time below |
1048 |
public giveMolotov(id, key) { |
public giveMolotov(id, key) { |
1049 |
|
|
1050 |
//key will start at zero |
//key will start at zero |
1051 |
if (key == 0) { |
switch(key) { |
1052 |
buy_molotov(id); |
case 0: buy_molotov(id); |
1053 |
} else if (key == 1) { |
case 1: client_print(id, print_center, "You have chosen not to buy a Molotov cocktail"); |
1054 |
client_print(id, print_center, ">You have chosen not to buy a Molotov Coctail<"); |
default: client_print(id, print_center, "You have chosen to exit the Molotov menu"); |
|
} else { |
|
|
client_print(id, print_center, ">You have choosen to exit the molotov menu...<"); |
|
1055 |
} |
} |
1056 |
} |
} |