This plugin will allow any player that have access to start a weapon war or voting for war round.
In weapons war round, all players will use the same weapon.
It just for fun. Thats all!
List of admin flags:
-->
PHP Code:
ADMIN_IMMUNITY /* flag "a" */ ADMIN_RESERVATION /* flag "b" */ ADMIN_KICK /* flag "c" */ ADMIN_BAN /* flag "d" */ ADMIN_SLAY /* flag "e" */ ADMIN_MAP /* flag "f" */ ADMIN_CVAR /* flag "g" */ ADMIN_CFG /* flag "h" */ ADMIN_CHAT /* flag "i" */ ADMIN_VOTE /* flag "j" */ ADMIN_PASSWORD /* flag "k" */ ADMIN_RCON /* flag "l" */ ADMIN_LEVEL_A /* flag "m" */ ADMIN_LEVEL_B /* flag "n" */ ADMIN_LEVEL_C /* flag "o" */ ADMIN_LEVEL_D /* flag "p" */ ADMIN_LEVEL_E /* flag "q" */ ADMIN_LEVEL_F /* flag "r" */ ADMIN_LEVEL_G /* flag "s" */ ADMIN_LEVEL_H /* flag "t" */ ADMIN_MENU /* flag "u" */ ADMIN_BAN_TEMP /* flag "v" */ ADMIN_ADMIN /* flag "y" */ ADMIN_USER /* flag "z" */
Cvars?
-->
PHP Code:
g_iAllowDeadAdmin = register_cvar("ww_allow_dead_admin", "0") // Allow dead admin to start war g_iAllowWarStart = register_cvar("ww_allow_war_start", "1") // Allow admin to start custom war round g_sAdminFlag = register_cvar("ww_admin_flag", "j") // Configure access flag to open war menu and start vote command. ;) g_iAllowWarVote = register_cvar("ww_allow_war_vote", "1") // Allow admin to start custom war vote g_iAutoWarVote = register_cvar("ww_auto_vote", "0") // Allow auto war vote g_iAutoWarStart = register_cvar("ww_auto_war", "0") // Allow auto war start ///////////////////////////////////////////////////////////////////////////// // If both auto-vote and auto-war features are enabled, please read below: // // 1. Auto-vote delay value must be a reference value for auto-vote delay. // // 2. Both auto-vote and auto-war delay value must in odd number. // // 3. As example, if auto-vote delay is 3, so auto-war delay must 5. // ///////////////////////////////////////////////////////////////////////////// g_iVoteDelay = register_cvar("ww_vote_delay", "3") // Amount of round delay for auto war vote g_iWarDelay = register_cvar("ww_war_delay", "5") // Amount of round delay for auto war start g_iAllowConsecutive = register_cvar("ww_allow_consecutive", "1") // Allow consecutive war g_iConWarAmount = register_cvar("ww_con_war_amount", "5") // Amount of consecutive war round g_iWeaponDrop = register_cvar("ww_weapon_drop", "1") // 0; Prevent players to drop any weapons || 1; Allow players to drop current war weapon g_iBullet = register_cvar("ww_allow_bullet", "0") // Allow player to have unlimited bullet g_iShowHud = register_cvar("ww_show_war_hud", "1") // Show current war round. ;) g_iXPosition = register_cvar("ww_hud_X_position", "0.75") // X Position ( --- ) g_iYPosition = register_cvar("ww_hud_Y_position", "0.20") // Y Position ( ||| ) g_iHudColors = register_cvar("ww_hud_colors", "0 255 0") // Hud colors g_iVotingTime = register_cvar("ww_vote_time", "30") // Time for vote g_iPointLeader = register_cvar("ww_point_leader", "1") // Enable showing point leader g_iPointBonus = register_cvar("ww_leader_bonus", "1") // Enable point leader bonus g_iBonusAmount = register_cvar("ww_bonus_amount", "2000") // Amount of money given g_iAutoRespawn = register_cvar("ww_allow_respawn", "1") // Allow auto respawn during war round g_iStripWeapon = register_cvar("ww_strip_weapon", "0") // Strip player weapon during war at the end of round g_iNoShield = register_cvar("ww_no_shield", "1") // Prevent player from getting shield on floor g_iKillerView = register_cvar("ww_allow_killer_view", "1") // Allow players see themselves dying from killer's view g_iBlockChangeViewTime = register_cvar("ww_buttons_delay", "2.0") // Delay before which player won't be able to switch spec view/target with mouse buttons g_iSpecMode = register_cvar("ww_spec_mode", "0") // 0; First person view || 1; Third person view g_iKillerViewFade = register_cvar("ww_fade_color", "030000000180") // Color and alpha of fade effect. RRR is red, GGG is green, BBB is blue and AAA is alpha g_iMuteNade = register_cvar("ww_mute_nade", "3") // 0; Nothing is blocked || 1; Radio is blocked || 2; Message is blocked || 3; Radio and message is blocked
How to start a Weapons War?
Just say /ww in your chat.
How to start a vote?
Just say /wvote in you chat. Next, just choose which weapon that you want to vote. ;)
How to start a consecutive round?
Just say /cw in you chat. If you want to disable it, just say the same word again!
How to install?
1. Just download cs_war.sma file. Next, compile it.
2. Please download cs_war.txt file also. Then, put it in the lang folder.
3. Thats it!
Advantages?
This plugin is different from other weapons round plugin:
1. Easy to install. Just 2 steps!
2. Now, you can start a vote for any weapons.
3. There is 26 different weapons to choose.
4. No need to worry about losing of money or weapons. This plugin will not strip your previous weapon. Yet, it will only force you to use the choosen weapon in the war round.
5. If you are alive until the end of round, you still have the weapon from previous weapons war round. It is a gift! Or you also can strip that weapon when the weapon war round is finished. Just edit the cvar. ;)
6. In weapons war round, you can configure whether to allow player to drop or pick up current war weapon or just disable this feature.
7. If players is allow to drop their weapon during war round, only current war weapon can be used. Other weapons will be malfunction.
8. Player can have custom killer view feature.
9. There is an option for you to choose whether to allow unlimited bullet during weapons war round.
10. There is an option for you to choose whether to show hud about current weapons war round.
11. Now, you can allow auto-war vote or auto-war start.
12. Adding custom natives and forwards for any coders to modify the gameplay.
13. Auto-respawn feature. ;)
14. Consecutive round. Now, admin can start consecutive war round. In this round, admin cannot open weapon war or vote menu.
15. Now, you can start custom war round. Just download custom_war.sma to see how I'm using the new natives. ;)
1. xPaw for code helping.
2. HamletEagle for suggestions.
3. Exolent[jNr] for code helping.
4. ConnorMcLeod for his code.
Changelog:
-->
Quote:
(21/7/2014):
v1.0 - First release.
v2.0 - [ADDED] Grenade bonus for admin only after killing a victim.
v2.2 - [ADDED] Multi-lingual supported.
(22/7/2014):
v2.5 - [ADDED] Remove task function.
v3.0 - [FIXED] Remove the used of stocks from fm_util, then use fun instead.
v4.0 - [ADDED] Admin can start a grenade war round.
(25/7/2014)
[ADDED] Romanian translation.
(9/8/2014)
[ADDED] Polish translation.
(15/8/2014)
v4.1
- [FIXED] Remove unnecessary code
- [ADDED] New colourful hud message when admin start the grenade war round.
(7/10/2014)
v5.0
- [OPTIMIZED] Fully rewritten the code.
- [ADDED] The code to prevent weapon pickup during grenade war.
- [FIXED] Hand bug when human is being infected during grenade war.
- [FIXED] Grenade is given to the zombie during grenade war.
(14/10/2014)
v5.1
- [FIXED] Grenade reward for admin during grenade war.
- [FIXED] Hand model missing after grenade war.
- [FIXED] Unlimited HE/ fire grenade after grenade war.
(17/10/2014)
v5.2
- [ADDED] Code to check whether a player is recieving the grenade or not during grenade war.
(31/10/2014)
v5.3
- [ADDED] Vote option.
- [ADDED] 2 new languages.
- [FIXED] The arrangement of the codes.
(17/12/2014)
v5.5
- [FIXED] Fully rewritten the codes.
- Release the Weapons War. ;)
(20/12/2014)
v5.6
- [FIXED] Remove completely switch.
- [ADDED] Romanian translation. Credit to HamletEagle.
(21/12/2014)
v5.7
- [FIXED] Remove unnecessary vode for voting. Change how the vote menu is working as before this it is not working properly.
- [FIXED] Add ID of task for vote ending. So that, we can remove it if vote still going when the round is end or being restarted.
- [FIXED] Add check during vote and after vote is successful. So that, no other admin can start the weapon war vote if voting is on going or there is already weapon war round being chosen.
- [FIXED] Now, the weapon wenu is being converted into global menu. This is same with vote menu.
- [FIXED] Add check during weapon war round. So that, no admin can start another weapon war.
- [FIXED] Add check to prevent other admin to start weapon war if the vote for weapon war round is successful.
- [FIXED] The code during player disconnect.
- [OPTIMIZED] The code for three different event which are new round, round start and end of round.
- [ADDED] New sentences that need to be translated due to new update. ;)
- [ADDED] Turkish translation.
(26/12/2014)
v5.8
- [FIXED] Change the .sma file name from ww.sma into cs_war.sma. This is the same also with .txt file
- [FIXED] Simply the code in war_handler by using enum _:WEAPONSWAR.
- [ADDED] Spanish translation.
(31/12/2014)
v5.9
- [FIXED] Cvar values for unlimited clip is being cached outside of a loop.
- [FIXED] Set task for war hud.
- [FIXED] Change some of the variables name for better readability.
- [ADDED] Check whether the entity is valid in fw_TouchWeapon.
(1/1/2015)
v6.0
- [FIXED] Improved the readability or code.
- [FIXED] Removed id from set_task(1.0, "WarHud", id+TASK_HUD, _, _, "b") and set_task(get_pcvar_float(g_iVotingTime), "EndVote", id+TASK_VOTE).
- [FIXED] The code at EndVote.
- [FIXED] The code for war hud. Remove loop for all players. ;)
- [FIXED] Changed MSG_ONE to MSG_ONE_UNRELIABLE.
- [FIXED] Code to destroy the war menu at plugin_end().
- [FIXED] Code at event_new_round() and logevent_round_end().
(2/1/2015)
v6.1
- [FIXED] Improved the readability or code.
- [FIXED] Code for war_handler.
- [ADDED] 3 more features. Now, you can enable point leader feature which this plugin will announce the player that have the highest points based on killing count. ;)
(29/1/2015)
v6.2
- [FIXED] Improved the readability or code.
- [FIXED] Code for HE grenade war as before this players only recieved 1 grenade only.
- [ADDED] Custom natives and forwards.
- [ADDED] New options to allow auto-war vote or auto-war start. ;)
(1/2/2015)
v6.3
- [FIXED] Improved the code.
- [ADDED] New natives to allow player to design their own weapon war. ;)
- [ADDED] New options to allow auto-respawn. ;)
(6/2/2015)
v6.4
- [FIXED] Improved the code.
- [FIXED] Fixed the lang keys.
- [FIXED] API tutorial.
- [ADDED] New forward when player respawn in war round. ;)
- [ADDED] New translations.
(7/2/2015)
v6.5
- [FIXED] Unlimited grenade after grenade round.
v6.6
- [ADDED] An option to strip player weapon after weapon war. ;)
(19/5/2014):
v6.7
- [FIXED] Problem with weapon war menu if player exit without choose any weapons.
- [ADDED] Killer view feature.
- [ADDED] An option to configure whether to allow player to drop or pick up current war weapon or just disable this feature.
- [ADDED] Weapon malfunction feature.
(19/9/2014):
v6.8
- [FIXED] Problem with malfunction feature. Next round, sometimes player cannot use their previous weapon.
(4/10/2014):
v7.0
- [FIXED] Invalid weapon id 0 problem.
- [FIXED] Run time error 10: native error (native "cs_get_user_bpammo").
- [FIXED] Players can drop HE grenade and knife during war round.
- [OPTIMIZED] Removed cs_core natives. Now, it is using default include.
(6/10/2014):
v7.1
- [FIXED] Player can shoot 1 bullet with previous weapon at beginning of weapon war round.
- [ADDED] Prevent auto-war round to start if auto-war delay is equal to auto-vote delay.
- [ADDED] Error log if auto-war delay is equal to auto-vote delay.
- [ADDED] Prevent auto-war round to start if before that auto-vote is approved.
- [ADDED] Error log if auto-war round start at same time for war round that being voted.
- [ADDED] Prevent same weapon war round for auto-war or auto-vote.
- [ADDED] Reset auto-war and auto-vote countdown if any admins with required access flag start custom war or vote.
- [ADDED] Reset auto-war and auto-vote countdown if custom war natives is being called.
- [FIXED] The arrangement of auto-war and auto-vote countdown variable.
- [ADDED] Consecutive war round feature.
- [ADDED] New sentences to be translated.
- [ADDED] Error log if auto-war or auto-vote is being enabled during consecutive round.
- [ADDED] Prevent admin to open weapon war or vote menu during consecutive round.
(7/10/2015)
v7.2
- [FIXED] Remove unnecessary natives and forward.
- [FIXED] cs_war_set native. Add code to get weapon id associated with a custom weapon name.
- [FIXED] cs_start_war and cs_start_vote natives. Add code to determine whether cs_war_set native is already being used. If not, it will give error.
- [ADDED] Option to block rodio sound or message of "Fire in the hole!" during HE-grenade war.
- [FIXED] Example using of custom cs_war.inc in custom_war.sma and war_trail.sma files.
- [FIXED] Find leader code.
(21/6/2016)
v7.3
- [FIXED] Remove unnecessary codes related to Ham_CS_Item_CanDrop as they no longer needed and caused "FATAL ERROR (Shutting Down): ED_Alloc: no free edicts".
- [ADDED] Using different method to block weapon from being dropped.
- [FIXED] Using arrayset() native instead of looping for resetting arrays.
- [FIXED] Looping two times WeaponsData items in public plugin_init() section.
- [FIXED] Find leader code.
- [FIXED] Wrong szName variable size.
- [ADDED] Danish and Urdu translation.
(26/6/2016)
v7.4
- [FIXED] Remove unnecessary codes.
- [FIXED] Naming function correctly.
- [FIXED] Using provided global const.
- [FIXED] Code to find leader.
- [FIXED] Cache cvar outside loop.
- [FIXED] Using provided global Weapon ID and Weapon Index in cs_strip_weapon function.
(26/12/2016)
v7.5
- [FIXED] Problem that player can buy weapon during weapon war..
- [FIXED] Crash problem due to buy icon.
- [ADDED] New cvar to allow dead admin to start weapon war.
/* * Return whether current round is war round */ native cs_is_war_round();
/* * Return current war name * param const szWarName[] - the name of current weapon war round * param iLen - maximum size of buffer */ native cs_current_war(const szWarName[], iLen);
/* * Return last war name * param const szWarName[] - the name of current weapon war round * param iLen - maximum size of buffer */ native cs_last_war(const szWarName[], iLen);
/* * Return war ID * param const szWarName[] - the name of weapon war round * param const szWarID[] - the name of weapon ID */ native cs_war_set(const szWarName[], const szWarID[]);
/** * Return auto-start war round */ native cs_start_war();
/** * Return auto-start war vote * param Float:fVoteTime - the durations for voting */ native cs_start_vote(Float:fVoteTime);
/** * Return point leader * param id - ID of client */ native cs_is_point_leader(id);
// Configure admin flag #define ADMIN_FLAG ADMIN_VOTE
// String new g_sCurrentWar[32]
public plugin_init() { register_plugin("Custom War", "1.0", "zmd94")
// In this example, I just show how to start a custom war using a command. // If you want to start the custom war automatically, just comment to learn. // We also can add more that 1 custom war. ;) register_clcmd("say /cus", "clcmd_custom_war") register_clcmd("say_team /cus", "clcmd_custom_war") register_clcmd("say /cvote", "clcmd_custom_vote") register_clcmd("say_team /ccvote", "clcmd_custom_vote")
public clcmd_custom_war(id) { // Register our custom war // Just use cs_war_set(const szWarName[], const szWarID[]) native. // const szWarName[] - the name of weapon war round // const szWarID[] - the name of weapon ID
// In this example, I choose to give all players AK-47. ;) cs_war_set("Head Hunter", "weapon_ak47") // Other than this, you also can set random custom war // and just using pcvar. // Just comment if you want to learn. ;)
// Then, start our custom war // Just use cs_start_war() native
cs_start_war() }
public clcmd_custom_vote(id) { // Register our custom war vote // Just use cs_war_set(const szWarName[], const szWarID[]) native. // const szWarName[] - the name of weapon war round // const szWarID[] - the name of weapon ID
// In this example, I choose to give all players AK-47. ;) cs_war_set("Head Hunter", "weapon_ak47") // Other than this, you also can set random custom war // and just using pcvar. // Just comment if you want to learn. ;)
// Then, start our custom war // Just use cs_start_vote(Float:fVoteTime) native // Float:fVoteTime - the durations for voting
// Vote for 30s cs_start_vote(30.0) }
// War round is start. public cs_fw_war_start() { // Just use native cs_current_war(const szWarName[], iLen) inside cs_fw_war_start() forward. ;) cs_current_war(g_sCurrentWar, charsmax(g_sCurrentWar))
public cs_cus_PlayerRespawn(id) { if(cs_is_war_round() && equal(g_sCurrentWar, "Head Hunter")) { client_print(id, print_chat, "[WW] Now is Head Hunter round!") } }
// Credit to ConnorMcLeod // This will only allow player to dealt a damage if their bullets hit enemies's head. ;) public forward_traceline(Float:v1[3], Float:v2[3], noMonsters, pentToSkip) { // If now is not war round. ;) if(!cs_is_war_round() || !is_user_alive(pentToSkip)) return FMRES_IGNORED
///////////////////////////////////////////////////////////// // Below is how to use cs_fw_war_start() forward. public cs_fw_war_start() { // Below is how to get current weapon war round. ;) // Just use native cs_current_war(const szWarName[], iLen); new sCurrentWar[32] cs_current_war(sCurrentWar, charsmax(sCurrentWar))
///////////////////////////////////////////////////////////// // Below is how to use cs_fw_vote_start() forward. public cs_fw_war_end() { client_print(0, print_chat, "End of war!") }
///////////////////////////////////////////////////////////// // Below is how to use cs_fw_vote_start() forward. public cs_fw_vote_start() { client_print(0, print_chat, "Please vote now!") }
///////////////////////////////////////////////////////////// // Below is how to use cs_fw_vote_end() forward. public cs_fw_vote_end() { client_print(0, print_chat, "End of voting!") }
///////////////////////////////////////////////////////////// // Below is how to use cs_is_point_leader(id) native. public fw_PlayerRespawn(id) { if(is_user_alive(id)) { // If point leader still in server after war round. Just tell about it again. ;) if(cs_is_point_leader(id)) { new szName[32] get_user_name(id, szName, charsmax(szName))
Just download the war_trail.sma file to see how to use them.
Then, open the war_trail.sma file to configure the trail color:
PHP Code:
g_iWarTrail = register_cvar("ww_allow_trail", "1") // Allow player trail during war round g_iCTAdminTrail = register_cvar("ww_CT_admin_trail", "0 255 0") // Trail color for CT admin g_iTAdminTrail = register_cvar("ww_T_admin_trail", "255 127 0") // Trail color for T admin g_iCTTrail = register_cvar("ww_CT_trail", "0 0 255") // Trail color for CT player g_iTTrail = register_cvar("ww_T_trail", "255 0 0") // Trail color for T player
Nice plugin. I'll make a little request if you mind ,
Can you make a cvar for only admins get grenade after killing player (for cs. (not zp)) if this cvar is on only admins will get free grenade after killing each player.
MENU_1 = Normal Packs of Grenades
MENU_2 = HE Grenade
MENU_3 = Flashbang
ZP_MENU_1 = Normal Packs of Grenades
ZP_MENU_2 = Fire Grenade
ZP_MENU_3 = Frost Grenade
MENU_EXIT = Exit
ADVERTISE_1 = You can receive free grenades.
ADVERTISE_2 = Just say /freegrenade, then a Free Grenade menu will be opened.
WORD_1 = You have receive a normal packs of grenades.
WORD_2 = You have receive a HE grenades.
WORD_3 = You have receive a flashbang.
WORD_4 = You have receive a HE grenade for killing.
WORD_5 = You have receive a flashbang for killing.
ZP_WORD_2 = You have receive a fire grenades.
ZP_WORD_3 = You have receive a frost grenades.
ZP_WORD_4 = You have receive a fire grenade for killing.
ZP_WORD_5 = You have receive a frost grenade for killing.