|
能把@代源a弄成amx插件?
new const PLUGINNAME[] = "Weapon Arena"
new const VERSION[] = "1.01"
new const AUTHOR[] = "jghg"
/*
Copyleft 2003
http://amxmod.net/forums/viewtopic.php?t=15549
WEAPON ARENA
============
Lets admin start an "<insert your favourite weapon here> arena" which means that everyone will instantly be given specified weapon, and full ammo for it. As long as Weapon Arena is enabled you can't change to any other weapon than the given one, grenades, knife or C4. Upon new round you will be given a new weapon, if you lost your previous... Upon default you will not even have to reload any clips - you will always have bullets to fire! This can be changed with a cvar.
USAGE
=====
amx_weaponarenamenu
-------------------
Menu driven weapon selection. Only for connected clients, that have access ADMIN_CFG. Use it to start and stop Weapon Arena in an easy way.
amx_weaponarena <weaponnumber|random|list|off>
----------------------------------------------
Command, can be run from server console, or through client console by user with ADMIN_CFG access.
Specify a valid weaponnumber as argument, to turn it on, or change current weapon type if Weapon Arena is already on. Specify "random" to automatically change current Weapon Arena weapon on every new round. Will enable Weapon Arena if it is disabled. Specify "list" to have a list of valid weapon numbers in a "message of the day" window (or in server console). Specify "off" to turn Weapon Arena off.
weaponarena_unlimitedammo
-------------------------
Cvar, set it to:
0 - to disable unlimited ammo. You will receive full ammo at round start.
1 - to enable unlimited ammo, AND you will NOT have to reload any clips, so you can fire forever without reloading! This is default.
2 - to enable unlimited ammo, but you will have to reload inbetween clips.
weaponarena_delay
-----------------
Cvar, standard delay of seconds from the time a player's spawn until he receives the weapon. Don't set to anything other than 0 (default) if you aren't having any problems. You might want to set this to 1.5 or something for maps consisting of player_weaponstrip entities. These maps, like ka_matrix and ka_legoland, usually make it so you lose your glock/usp at round starts, and sometimes you are given other weapons. This interferes with Weapon Arena. Use the plugin "Custom Map Configs" to have custom configs for different maps. Find it here: http://amxmod.net/amx-plugins.php?cat=7#25130
Examples:
amx_weaponarena off
(Turns it off)
amx_weaponarena 10
(Starts Weapon Arena with Berettas)
amx_weaponarena list
(Displays valid weapon numbers)
amx_weaponarena random
(Starts Weapon Arena, making a random selection of gun
for every new round to give to all players.)
INSTALLATION
============
1. If your server is running STEAM, you might want to change the line "//#define STEAM" below to say "#define STEAM" (without the quotes), to support new two new guns Galil and Famas.
2. Compile sma to weaponarena.amx
3. Move weaponarena.amx into amx/plugins
4. Add a line at the end of amx/plugins/plugins.ini to say:
weaponarena.amx
5. Done
VERSIONS
========
1.01 First update for a time. Trying this script out under CS 1.6/Steam/Metamod 1.17/AMX 0.9.7j,
the engclient_cmd() seems to not work really as expected. It did crash the server when forcing
drops of weapons, and it couldn't force a player to hold the current WA weapon, resulting in
really odd behaviour. Change to client_cmd() fixes this.
#define STEAM is now default, so if you run CS 1.5 you must comment it.
1.0 Added "weaponarena_unlimitedammo 2"
0.91 Added support for Galil and Famas. Uncomment #define STEAM and recompile of you want this.
0.9 Removed weaponarena_stripdelay, and so also the need
for xtrafun module is removed.
0.8.3b Bug fixing, unlimited ammo off didn't work properly.
0.8.3a Bug fixing
0.8.3 Maps with "player_weaponstrip" entities, like
ka_matrix where you only get a knife at start,
wouldn't work very well with Weapon Arena.
This version postpones the giving of weapon
1.5 seconds (default) from when player spawns.
Seems to fix the problem. If you have problems
still, try changing cvar weaponarena_stripdelay
to hold how many seconds the giving of weapons
should be postponed.
0.8.2 Minor tweak.
0.8.1 Minor tweak.
0.8 Unlimited ammo added.
0.7 Found (thanks to boundary checking) a bug/typo
since newest RC (8) of AMX 0.9.4.
So this version is fixed to work with newest
AMX Mod. Thanks to DoubleTap for help with this.
weaponarena_delay is another new cvar that works
like weapon_arenastripdelay, only that it
is used on all maps that don't have these
"player_weaponstrip"s. Defaults to 0.
0.6 Seemed previous version crashes,
this version has some stuff that might help.
0.5 Knife added
0.4 Added random new weapon for every new round
0.3 Added menu for selecting weapons
0.2 Touch up...
0.1 First version
TO DO
=====
- Make it so ammo displayed is updated instantly when your clip is replenished...
- Johnny got his gun
*/
#include <amxmod>
#include <amxmisc>
// Comment the line below if you run CS 1.5! (put two slashes in front of it like this line has)
#define STEAM
#if defined (CSW_GALIL)
#else
#define CSW_GALIL 14
#endif
#if defined (CSW_FAMAS)
#else
#define CSW_FAMAS 15
#endif
#define MAXGIVEWEAPONS 1
// Global vars below
new bool:weaponArena
new bool:randomWeapon = false
new waWeapon
new weaponString[50]
new ammoString[50]
#if defined (STEAM)
new weaponNumbers[] = "\
SCOUT 3^n\
XM1014 5^n\
MAC10 7^n\
AUG 8^n\
ELITE 10^n\
FIVESEVEN 11^n\
UMP45 12^n\
SG550 13^n\
GALI 14^n\
FAMAS 15^n\
USP 16^n\
GLOCK18 17^n\
AWP 18^n\
MP5NAVY 19^n\
M249 20^n\
M3 21^n\
M4A1 22^n\
TMP 23^n\
G3SG1 24^n\
DEAGLE 26^n\
SG552 27^n\
AK47 28^n\
KNIFE 29^n\
P90 30"
#else
new weaponNumbers[] = "\
SCOUT 3^n\
XM1014 5^n\
MAC10 7^n\
AUG 8^n\
ELITE 10^n\
FIVESEVEN 11^n\
UMP45 12^n\
SG550 13^n\
USP 16^n\
GLOCK18 17^n\
AWP 18^n\
MP5NAVY 19^n\
M249 20^n\
M3 21^n\
M4A1 22^n\
TMP 23^n\
G3SG1 24^n\
DEAGLE 26^n\
SG552 27^n\
AK47 28^n\
KNIFE 29^n\
P90 30"
#endif
new g_hadThisRound[33] = {0,...}
new bool:ranThisRound = false
new const DEFAULTDELAY[] = "0"
/*
new weapontypetemptext[31][] = {
"ERROR: Invalid weapon (0)","Sig Sauer P228","ERROR: Invalid weapon (2)","Steyr Scout",
"High explosive grenade","Benelli XM1014","C4 bomb","Ingram Mac-10",
"Steyr Aug","Smoke grenade","Dual Beretta 96G Elites","Fabrique Nationale Five-seven",
"Heckler & Koch UMP45","Sig SG-550 Commando","ERROR: Invalid weapon (14)","ERROR: Invalid weapon (15)",
"Heckler & Koch USP45","Glock 18","Accuracy Int. Arctic Warfare/Magnum (AW/M)","Heckler & Koch MP5/Navy",
"FN M249 Para","Benelli M3 Super 90","Colt M4A1","Steyr Tactical Machine Pistol",
"Heckler & Koch G3/SG-1","Flashbang","IMI Desert Eagle","Sig SG-552 Commando",
"Avtomat Kalashnikov AK-47","Combat knife","Fabrique Nationale P90"}
*/
// Global vars above
public newround_event(id) {
// Is WA on?
if (!weaponArena)
return PLUGIN_CONTINUE
if (!is_user_alive(id))
return PLUGIN_CONTINUE
if (randomWeapon && !ranThisRound) {
randomize(0)
ranThisRound = true
}
InitGives()
// Give WA weapon, if id already doesn't have it.
new idd[1]
idd[0] = id
set_task(get_cvar_float("weaponarena_delay"),"newround_event2",3526735 + id,idd,1)
return PLUGIN_CONTINUE
}
public newround_event2(idd[]) {
new id = idd[0]
giveIfHasnt(id)
if (get_cvar_num("weaponarena_unlimitedammo") == 2)
giveAmmo(id)
new clip, ammo
if (get_user_weapon(id,clip,ammo) != waWeapon)
holdwaweapon(id)
}
public holdwaweapon(id) {
if (is_user_connected(id) && is_user_alive(id))
client_cmd(id,weaponString)
}
randomize(giveNewWeapon) {
new newWeapon
#if defined (STEAM)
do {
newWeapon = random_num(1,30)
}
while (newWeapon < 1 || newWeapon > 30 || newWeapon == 2
|| newWeapon == CSW_HEGRENADE || newWeapon == CSW_C4 || newWeapon == CSW_SMOKEGRENADE || newWeapon == CSW_FLASHBANG)
#else
do {
newWeapon = random_num(1,30)
}
while (newWeapon < 1 || newWeapon > 30
|| newWeapon == 2 || newWeapon == CSW_GALIL || newWeapon == CSW_FAMAS
|| newWeapon == CSW_HEGRENADE || newWeapon == CSW_C4 || newWeapon == CSW_SMOKEGRENADE || newWeapon == CSW_FLASHBANG)
#endif
if (!changeWeapon(0,newWeapon)) {
client_print(0,print_chat,"WEAPON ARENA ERROR: Couldn't set new random weapon :-(")
console_print(0,"WEAPON ARENA ERROR: Couldn't set new random weapon :-(")
}
new parm[2]
parm[0] = 0
parm[1] = giveNewWeapon
set_task(0.5,"RunChanged",235262,parm,2)
}
public RunChanged(parm[]) {
changed(parm[0],parm[1])
}
public giveIfHasnt(id) {
// Don't give a knife!
if (waWeapon == CSW_KNIFE)
return 0
// DEBUG EXTRA SAFETY THING ADDED
if (!is_user_connected(id) || !is_user_alive(id))
return 0
// DEBUG EXTRA SAFETY THING ADDED
new gave = 0
new wpnList[32]
new number
new tempName[33]
get_user_name(id,tempName,32)
get_user_weapons(id,wpnList,number)
for (new i = 0;i < number;i++) {
if (wpnList == waWeapon)
{
//client_print(0,print_chat,"%s already has the right weapon, won't give",tempName);
return gave
}
}
if (g_hadThisRound[id] < MAXGIVEWEAPONS) {
g_hadThisRound[id]++
give_item(id,weaponString)
gave = 1
}
//else
//client_print(0,print_chat,"Naaah %s already has received %d weapons this round... max is %d",tempName,g_hadThisRound[id],MAXGIVEWEAPONS)
return gave
}
public setWpnString() {
switch (waWeapon) {
case CSW_P228 : weaponString = "weapon_p228"
case CSW_SCOUT : weaponString = "weapon_scout"
case CSW_XM1014 : weaponString = "weapon_xm1014"
case CSW_MAC10 : weaponString = "weapon_mac10"
case CSW_AUG : weaponString = "weapon_aug"
case CSW_ELITE : weaponString = "weapon_elite"
case CSW_FIVESEVEN : weaponString = "weapon_fiveseven"
case CSW_UMP45 : weaponString = "weapon_ump45"
case CSW_SG550 : weaponString = "weapon_sg550"
#if defined (STEAM)
case CSW_GALIL : weaponString = "weapon_galil"
case CSW_FAMAS : weaponString = "weapon_famas"
#endif
case CSW_USP : weaponString = "weapon_usp"
case CSW_GLOCK18 : weaponString = "weapon_glock18"
case CSW_AWP : weaponString = "weapon_awp"
case CSW_MP5NAVY : weaponString = "weapon_mp5navy"
case CSW_M249 : weaponString = "weapon_m249"
case CSW_M3 : weaponString = "weapon_m3"
case CSW_M4A1 : weaponString = "weapon_m4a1"
case CSW_TMP : weaponString = "weapon_tmp"
case CSW_G3SG1 : weaponString = "weapon_g3sg1"
case CSW_DEAGLE : weaponString = "weapon_deagle"
case CSW_SG552 : weaponString = "weapon_sg552"
case CSW_AK47 : weaponString = "weapon_ak47"
case CSW_KNIFE : weaponString = "weapon_knife"
case CSW_P90 : weaponString = "weapon_p90"
default : {
// bad weapon type, mega error, quit quit!
}
}
switch (waWeapon) {
case CSW_P228 : ammoString = "ammo_357sig"
case CSW_SCOUT : ammoString = "ammo_762nato"
case CSW_XM1014 : ammoString = "ammo_buckshot"
case CSW_MAC10 : ammoString = "ammo_45acp"
case CSW_AUG : ammoString = "ammo_556nato"
case CSW_ELITE : ammoString = "ammo_9mm"
case CSW_FIVESEVEN : ammoString = "ammo_57mm"
case CSW_UMP45 : ammoString = "ammo_45acp"
case CSW_SG550 : ammoString = "ammo_556nato"
#if defined (STEAM)
case CSW_GALIL : ammoString = "ammo_556nato"
case CSW_FAMAS : ammoString = "ammo_556nato"
#endif
case CSW_USP : ammoString = "ammo_45acp"
case CSW_GLOCK18 : ammoString = "ammo_9mm"
case CSW_AWP : ammoString = "ammo_338magnum"
case CSW_MP5NAVY : ammoString = "ammo_9mm"
case CSW_M249 : ammoString = "ammo_556natobox"
case CSW_M3 : ammoString = "ammo_buckshot"
case CSW_M4A1 : ammoString = "ammo_556nato"
case CSW_TMP : ammoString = "ammo_9mm"
case CSW_G3SG1 : ammoString = "ammo_762nato"
case CSW_DEAGLE : ammoString = "ammo_50ae"
case CSW_SG552 : ammoString = "ammo_556nato"
case CSW_AK47 : ammoString = "ammo_762nato"
case CSW_P90 : ammoString = "ammo_57mm"
default : {
// bad weapon type, mega error, quit quit!
}
}
}
public toggle(id,level,cid) {
if (!cmd_access(id,level,cid,2)) {
return PLUGIN_HANDLED
}
new bool:originalState = weaponArena
new oldWeapon = waWeapon
if (read_argc() != 2) {
console_print(id,"[AMX] ERROR: Use - amx_weaponarena <weaponnumber|list|off|random>")
return PLUGIN_HANDLED
}
new argument[7]
read_argv(1,argument,6)
strtolower(argument)
//console_print(id,"%s",argument)
if (equal(argument,"off")) {
if (!weaponArena) {
console_print(id,"[AMX] ERROR: Weapon Arena is already off.")
randomWeapon = false
return PLUGIN_HANDLED
}
else {
randomWeapon = false
weaponArena = false
}
}
else if (equal(argument,"list")) {
if (id >= 1 && id <= 32)
show_motd(id,weaponNumbers,"Weapon Arena")
else
console_print(id,weaponNumbers)
}
else if (equal(argument,"random")) {
SwitchRandom(id)
}
else {
new wpnNumber = str_to_num(argument)
if (changeWeapon(id,wpnNumber))
weaponArena = true
else {
console_print(id,"[AMX] ERROR: Use - amx_weaponarena <weaponnumber|list|off|random>",argument)
}
}
if (originalState != weaponArena) {
if (weaponArena) {
// Activate
activate(id)
}
else {
disabled(id)
}
}
else if (oldWeapon != waWeapon) {
changed(id,1)
}
return PLUGIN_HANDLED
}
activate(id) {
set_hudmessage(0, 100, 0, -1.0, 0.65, 2, 0.02, 10.0, 0.01, 0.1, 2)
show_hudmessage(0,"%c%s Arena is enabled!",weaponString[7] - 32,weaponString[8])
client_print(id,print_console,"[AMX] %c%s Arena was enabled!",weaponString[7] - 32,weaponString[8])
server_print("[AMX] %c%s Arena was enabled!",weaponString[7] - 32,weaponString[8])
giveAllIfHavent()
}
InitGives()
{
for (new i = 1;i <= 32;i++)
g_hadThisRound = 0
//client_print(0,print_center,"inited gives")
}
giveAllIfHavent() {
// Init amount of weapons given to people this round...
InitGives()
// Collect all alive players and give'm a weapon if they
// already not have one.
new playersList[32]
new playersFound
get_players(playersList,playersFound,"a")
//console_print(0,"Found %d players",playersFound)
new clip, ammo
for (new i = 0;i < playersFound;i++) {
if (giveIfHasnt(playersList) && get_cvar_num("weaponarena_unlimitedammo") == 0)
giveAmmo(playersList)
if (get_user_weapon(playersList,clip,ammo) != waWeapon)
holdwaweapon(playersList)
}
}
public changed(id,giveNewWeapon) {
InitGives()
set_hudmessage(0, 100, 0, -1.0, 0.65, 2, 0.02, 10.0, 0.01, 0.1, 2)
show_hudmessage(0,"Changed to %c%s Arena!",weaponString[7] - 32,weaponString[8])
client_print(id,print_console,"[AMX] Changed to %c%s Arena!",weaponString[7] - 32,weaponString[8])
server_print("[AMX] Changed to %c%s Arena!",weaponString[7] - 32,weaponString[8])
if (giveNewWeapon) {
// Collect all alive players and give'm a weapon if they
// already not have one.
new playersList[32]
new playersFound
get_players(playersList,playersFound,"a")
for (new i = 0;i < playersFound;i++) {
if (giveIfHasnt(playersList) && get_cvar_num("weaponarena_unlimitedammo") == 0)
giveAmmo(playersList)
new clip, ammo
if (get_user_weapon(playersList,clip,ammo) != waWeapon)
holdwaweapon(playersList)
}
}
}
disabled(id) {
set_hudmessage(0, 100, 0, -1.0, 0.65, 2, 0.02, 10.0, 0.01, 0.1, 2)
show_hudmessage(0,"%c%s Arena is disabled!",weaponString[7] - 32,weaponString[8])
client_print(id,print_console,"[AMX] %c%s Arena was disabled!",weaponString[7] - 32,weaponString[8])
server_print("[AMX] %c%s Arena was disabled!",weaponString[7] - 32,weaponString[8])
}
public giveAmmo(id) {
// DEBUG EXTRA SAFETY THING ADDED
if (!is_user_connected(id) || !is_user_alive(id))
return
// DEBUG EXTRA SAFETY THING ADDED
new clips = 0
switch (waWeapon) {
case CSW_P228 : clips = 4
case CSW_SCOUT : clips = 3
case CSW_XM1014 : clips = 4
case CSW_MAC10 : clips = 9
case CSW_AUG : clips = 3
case CSW_ELITE : clips = 4
case CSW_FIVESEVEN : clips = 2
case CSW_UMP45 : clips = 9
case CSW_SG550 : clips = 3
#if defined (STEAM)
case CSW_GALIL : clips = 3
case CSW_FAMAS : clips = 3
#endif
case CSW_USP : clips = 9
case CSW_GLOCK18 : clips = 4
case CSW_AWP : clips = 3
case CSW_MP5NAVY : clips = 4
case CSW_M249 : clips = 7
case CSW_M3 : clips = 4
case CSW_M4A1 : clips = 3
case CSW_TMP : clips = 4
case CSW_G3SG1 : clips = 3
case CSW_DEAGLE : clips = 5
case CSW_SG552 : clips = 3
case CSW_AK47 : clips = 3
case CSW_P90 : clips = 2
}
for (new i = 0;i < clips;i++)
give_item(id,ammoString)
}
public dropweapon(id) {
// Since update to CS 1.6/Steam/AMX 0.9.7j/Metamod 1.17 (dunno what causes it really)
// engclient_cmd(id,"drop") doesn't work anymore. So we change it to client_cmd().
if (is_user_connected(id) && is_user_alive(id))
client_cmd(id,"drop")
}
public holdwpn_event(id) {
if (!weaponArena)
return PLUGIN_CONTINUE
new weaponTypeId = read_data(2)
// Only valid weapons to hold are waWeapon, C4, knife, and grenades.
if (weaponTypeId == waWeapon) {
//client_print(id, print_chat, "You hold %s, which %s the current WA weapon. (no drop)", weapontypetemptext[weaponTypeId], (weaponTypeId == waWeapon) ? "is" : "is not")
switch (get_cvar_num("weaponarena_unlimitedammo")) {
case 1:
{
new clip, ammo
get_user_ammo(id,weaponTypeId,clip,ammo)
if (clip < 1) {
if (is_user_connected(id) && is_user_alive(id)) {
give_item(id,weaponString)
holdwaweapon(id)
}
}
}
case 2:
{
new clip, ammo
get_user_ammo(id,weaponTypeId,clip,ammo)
if (clip < 1 && ammo == 0) {
if (is_user_connected(id) && is_user_alive(id)) {
giveAmmo(id)
holdwaweapon(id)
}
}
}
}
}
else if (weaponTypeId == CSW_HEGRENADE
|| weaponTypeId == CSW_SMOKEGRENADE
|| weaponTypeId == CSW_FLASHBANG
|| weaponTypeId == CSW_KNIFE
|| weaponTypeId == CSW_C4) {
//client_print(id, print_chat, "You hold %s, which %s the current WA weapon. (no drop)", weapontypetemptext[weaponTypeId], (weaponTypeId == waWeapon) ? "is" : "is not")
return PLUGIN_CONTINUE
}
else {
//client_print(id, print_chat, "You hold %s, which %s the current WA weapon. (drop)", weapontypetemptext[weaponTypeId], (weaponTypeId == waWeapon) ? "is" : "is not")
dropweapon(id)
holdwaweapon(id)
}
return PLUGIN_CONTINUE
}
// Returns 0 on failure, 1 on success
public changeWeapon(id,newWeapon) {
new returnValue = 0
if (newWeapon < 1 || newWeapon > 30
|| newWeapon == 2
|| newWeapon == CSW_C4
|| newWeapon == CSW_HEGRENADE
|| newWeapon == CSW_SMOKEGRENADE
|| newWeapon == CSW_FLASHBANG) {
// Bad weapon type, does not change.
//console_print(id,"[AMX] ERROR: Bad weapon type (%d is out of bounds)",newWeapon)
}
else {
waWeapon = newWeapon
setWpnString()
returnValue = 1
}
return returnValue
}
public endround_event() {
ranThisRound = false
}
public SwitchRandom(id) {
randomWeapon = !randomWeapon
if (randomWeapon) {
set_hudmessage(0, 100, 0, -1.0, 0.35, 2, 0.02, 10.0, 0.01, 0.1, 3)
show_hudmessage(0,"Weapon Arena will select random weapon on every new round!")
client_print(id,print_console,"[AMX] Weapon Arena will select random weapon on every new round!")
server_print("[AMX] Weapon Arena will select random weapon on every new round!")
if (!weaponArena) {
weaponArena = true
}
randomize(0)
giveAllIfHavent()
}
else {
set_hudmessage(0, 100, 0, -1.0, 0.35, 2, 0.02, 10.0, 0.01, 0.1, 3)
show_hudmessage(0,"Disabled Weapon Arena.")
client_print(id,print_console,"[AMX] Disabled Weapon Arena.")
server_print("[AMX] Disabled Weapon Arena.")
/*
set_hudmessage(0, 100, 0, -1.0, 0.35, 2, 0.02, 10.0, 0.01, 0.1, 3)
show_hudmessage(0,"Disabled random weapon on every new round!")
client_print(id,print_console,"[AMX] Disabled random weapon on every new round!")
server_print("[AMX] Disabled random weapon on every new round!")
*/
}
}
#if defined (STEAM)
public wamenu1(id) {
if (!(get_user_flags(id)&ADMIN_CFG)){
//client_print(id,print_console,"You have no access to that command")
return PLUGIN_HANDLED
}
new menuBody[512]
new len = format(menuBody,511,"\yWeapon Arena 1/4\R^n^n\w")
len += format(menuBody[len],511-len,"1. P228^n2. Scout^n3. XM1014^n4. Mac10^n5. Aug^n6. Elite^n^n%s8. Disable Weapon Arena^n9. More weapons...^n0. Exit",randomWeapon ? "" : "7. Enable random weapon on new round^n")
new flags = ((1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<7)|(1<<8)|(1<<9))
if (!randomWeapon)
flags |= (1<<6)
show_menu(id,flags,menuBody)
return PLUGIN_HANDLED
}
public wamenu2(id) {
new menuBody[512]
new len = format(menuBody,511,"\yWeapon Arena 2/4\R^n^n\w")
len += format(menuBody[len],511-len,"1. Fiveseven^n2. UMP45^n3. SG550^n4. Galil^n5. Famas^n6. USP^n7. Glock18^n8. AWM^n^n9. More weapons...^n0. Back")
show_menu(id,((1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9)),menuBody)
return PLUGIN_HANDLED
}
public wamenu3(id) {
new menuBody[512]
new len = format(menuBody,511,"\yWeapon Arena 3/4\R^n^n\w")
len += format(menuBody[len],511-len,"1. MP5Navy^n2. M249^n3. M3^n4. M4A1^n5. TMP^n6. G3SG1^n7. Desert eagle^n8. SG552^n^n9. More weapons...^n0. Back")
show_menu(id,((1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9)),menuBody)
return PLUGIN_HANDLED
}
public wamenu4(id) {
new menuBody[512]
new len = format(menuBody,511,"\yWeapon Arena 4/4\R^n^n\w")
len += format(menuBody[len],511-len,"1. AK47^n2. Combat knife^n3. P90^n^n0. Back")
show_menu(id,((1<<0)|(1<<1)|(1<<2)|(1<<9)),menuBody)
return PLUGIN_HANDLED
}
public menu_wa1(id,key)
{
new bool:chose = true
switch(key) {
case 0: changeWeapon(id,CSW_P228)
case 1: changeWeapon(id,CSW_SCOUT)
case 2: changeWeapon(id,CSW_XM1014)
case 3: changeWeapon(id,CSW_MAC10)
case 4: changeWeapon(id,CSW_AUG)
case 5: changeWeapon(id,CSW_ELITE)
case 6: {
new bool:weaponArenaState = weaponArena
SwitchRandom(id)
if (weaponArena && !weaponArenaState) {
activate(id)
}
chose = false
}
case 7: {
weaponArena = false
randomWeapon = false
disabled(id)
chose = false
}
case 8: {
wamenu2(id)
chose = false
}
case 9: chose = false // Exit, don't do anything
}
if (chose) {
randomWeapon = false
if (weaponArena)
changed(id,1)
else {
weaponArena = true
activate(id)
}
}
return PLUGIN_HANDLED
}
public menu_wa2(id,key)
{
new bool:chose = true
switch(key) {
case 0: changeWeapon(id,CSW_FIVESEVEN)
case 1: changeWeapon(id,CSW_UMP45)
case 2: changeWeapon(id,CSW_SG550)
case 3: changeWeapon(id,CSW_GALIL)
case 4: changeWeapon(id,CSW_FAMAS)
case 5: changeWeapon(id,CSW_USP)
case 6: changeWeapon(id,CSW_GLOCK18)
case 7: changeWeapon(id,CSW_AWP)
case 8: {
wamenu3(id)
chose = false
}
case 9: {
wamenu1(id)
chose = false
}
}
if (chose) {
randomWeapon = false
if (weaponArena)
changed(id,1)
else {
weaponArena = true
activate(id)
}
}
return PLUGIN_HANDLED
}
public menu_wa3(id,key)
{
new bool:chose = true
switch(key) {
case 0: changeWeapon(id,CSW_MP5NAVY)
case 1: changeWeapon(id,CSW_M249)
case 2: changeWeapon(id,CSW_M3)
case 3: changeWeapon(id,CSW_M4A1)
case 4: changeWeapon(id,CSW_TMP)
case 5: changeWeapon(id,CSW_G3SG1)
case 6: changeWeapon(id,CSW_DEAGLE)
case 7: changeWeapon(id,CSW_SG552)
case 8: {
wamenu4(id)
chose = false
}
case 9: {
wamenu2(id)
chose = false
}
}
if (chose) {
randomWeapon = false
if (weaponArena)
changed(id,1)
else {
weaponArena = true
activate(id)
}
}
return PLUGIN_HANDLED
}
public menu_wa4(id,key)
{
new bool:chose = true
switch(key) {
case 0: changeWeapon(id,CSW_AK47)
case 1: changeWeapon(id,CSW_KNIFE)
case 2: changeWeapon(id,CSW_P90)
case 9: {
wamenu3(id)
chose = false
}
}
if (chose) {
randomWeapon = false
if (weaponArena)
changed(id,1)
else {
weaponArena = true
activate(id)
}
}
return PLUGIN_HANDLED
}
#else
public wamenu1(id) {
if (!(get_user_flags(id)&ADMIN_CFG)){
//client_print(id,print_console,"You have no access to that command")
return PLUGIN_HANDLED
}
new menuBody[512]
new len = format(menuBody,511,"\yWeapon Arena 1/3\R^n^n\w")
len += format(menuBody[len],511-len,"1. P228^n2. Scout^n3. XM1014^n4. Mac10^n5. Aug^n6. Elite^n^n%s8. Disable Weapon Arena^n9. More weapons...^n0. Exit",randomWeapon ? "" : "7. Enable random weapon on new round^n")
new flags = ((1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<7)|(1<<8)|(1<<9))
if (!randomWeapon)
flags |= (1<<6)
show_menu(id,flags,menuBody)
return PLUGIN_HANDLED
}
public wamenu2(id) {
new menuBody[512]
new len = format(menuBody,511,"\yWeapon Arena 2/3\R^n^n\w")
len += format(menuBody[len],511-len,"1. Fiveseven^n2. UMP45^n3. SG550^n4. USP^n5. Glock18^n6. AWM^n7. MP5Navy^n8. M249^n^n9. More weapons...^n0. Back")
show_menu(id,((1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9)),menuBody)
return PLUGIN_HANDLED
}
public wamenu3(id) {
new menuBody[512]
new len = format(menuBody,511,"\yWeapon Arena 3/3\R^n^n\w")
len += format(menuBody[len],511-len,"1. M3^n2. M4A1^n3. TMP^n4. G3SG1^n5. Desert eagle^n6. SG552^n7. AK47^n8. Combat knife^n9. P90^n^n0. Back")
show_menu(id,((1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9)),menuBody)
return PLUGIN_HANDLED
}
public menu_wa1(id,key)
{
new bool:chose = true
switch(key) {
case 0: changeWeapon(id,CSW_P228)
case 1: changeWeapon(id,CSW_SCOUT)
case 2: changeWeapon(id,CSW_XM1014)
case 3: changeWeapon(id,CSW_MAC10)
case 4: changeWeapon(id,CSW_AUG)
case 5: changeWeapon(id,CSW_ELITE)
case 6: {
new bool:weaponArenaState = weaponArena
SwitchRandom(id)
if (weaponArena && !weaponArenaState) {
activate(id)
}
chose = false
}
case 7: {
weaponArena = false
randomWeapon = false
disabled(id)
chose = false
}
case 8: {
wamenu2(id)
chose = false
}
case 9: chose = false // Exit, don't do anything
}
if (chose) {
randomWeapon = false
if (weaponArena)
changed(id,1)
else {
weaponArena = true
activate(id)
}
}
return PLUGIN_HANDLED
}
public menu_wa2(id,key)
{
new bool:chose = true
switch(key) {
case 0: changeWeapon(id,CSW_FIVESEVEN)
case 1: changeWeapon(id,CSW_UMP45)
case 2: changeWeapon(id,CSW_SG550)
case 3: changeWeapon(id,CSW_USP)
case 4: changeWeapon(id,CSW_GLOCK18)
case 5: changeWeapon(id,CSW_AWP)
case 6: changeWeapon(id,CSW_MP5NAVY)
case 7: changeWeapon(id,CSW_M249)
case 8: {
wamenu3(id)
chose = false
}
case 9: {
wamenu1(id)
chose = false
}
}
if (chose) {
randomWeapon = false
if (weaponArena)
changed(id,1)
else {
weaponArena = true
activate(id)
}
}
return PLUGIN_HANDLED
}
public menu_wa3(id,key)
{
new bool:chose = true
switch(key) {
case 0: changeWeapon(id,CSW_M3)
case 1: changeWeapon(id,CSW_M4A1)
case 2: changeWeapon(id,CSW_TMP)
case 3: changeWeapon(id,CSW_G3SG1)
case 4: changeWeapon(id,CSW_DEAGLE)
case 5: changeWeapon(id,CSW_SG552)
case 6: changeWeapon(id,CSW_AK47)
case 7: changeWeapon(id,CSW_KNIFE)
case 8: changeWeapon(id,CSW_P90)
case 9: {
wamenu2(id)
chose = false
}
}
if (chose) {
randomWeapon = false
if (weaponArena)
changed(id,1)
else {
weaponArena = true
activate(id)
}
}
return PLUGIN_HANDLED
}
#endif
public plugin_init() {
register_plugin(PLUGINNAME,VERSION,AUTHOR)
register_cvar("weaponarena_version",VERSION,FCVAR_SERVER|FCVAR_SPONLY)
register_event("ResetHUD","newround_event","b")
register_concmd("amx_weaponarena","toggle",ADMIN_CFG,"<weaponnumber|off|list|random>")
register_event("CurWeapon","holdwpn_event","be","1=1")
register_event("SendAudio","endround_event","a","2&%!MRAD_terwin","2&%!MRAD_ctwin","2&%!MRAD_rounddraw")
register_event("TextMsg","endround_event","a","2&#Game_C","2&#Game_w")
register_event("TextMsg","endround_event","a","2&#Game_will_restart_in")
#if defined (STEAM)
register_menucmd(register_menuid("Weapon Arena 1/4"),1023,"menu_wa1")
register_menucmd(register_menuid("Weapon Arena 2/4"),1023,"menu_wa2")
register_menucmd(register_menuid("Weapon Arena 3/4"),1023,"menu_wa3")
register_menucmd(register_menuid("Weapon Arena 4/4"),1023,"menu_wa4")
#else
register_menucmd(register_menuid("Weapon Arena 1/3"),1023,"menu_wa1")
register_menucmd(register_menuid("Weapon Arena 2/3"),1023,"menu_wa2")
register_menucmd(register_menuid("Weapon Arena 3/3"),1023,"menu_wa3")
#endif
register_clcmd("amx_weaponarenamenu","wamenu1",ADMIN_CFG,"- displays Weapon Arena's menu")
register_cvar("weaponarena_unlimitedammo","1")
register_cvar("weaponarena_delay",DEFAULTDELAY)
weaponArena = false
changeWeapon(0,CSW_FIVESEVEN) // Default weapon...
} |
|