Weapons module added, still needs better validations
This commit is contained in:
parent
d063def554
commit
035d6182a9
@ -1,86 +0,0 @@
|
|||||||
// Weapon Lists
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// Counter-Strike: Source |
|
|
||||||
// -----------------------|
|
|
||||||
// glock |
|
|
||||||
// usp |
|
|
||||||
// p228 |
|
|
||||||
// deagle |
|
|
||||||
// elite |
|
|
||||||
// fiveseven |
|
|
||||||
// m3 |
|
|
||||||
// xm1014 |
|
|
||||||
// mac10 |
|
|
||||||
// tmp |
|
|
||||||
// mp5navy |
|
|
||||||
// ump45 |
|
|
||||||
// p90 |
|
|
||||||
// galil |
|
|
||||||
// famas |
|
|
||||||
// ak47 |
|
|
||||||
// m4a1 |
|
|
||||||
// sg552 |
|
|
||||||
// aug |
|
|
||||||
// scout |
|
|
||||||
// sg550 |
|
|
||||||
// g3sg1 |
|
|
||||||
// awp |
|
|
||||||
// -----------------------|
|
|
||||||
|
|
||||||
|
|
||||||
// Format
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// "weapon group name"
|
|
||||||
// {
|
|
||||||
// "weaponname (listed above)" {} <-- To satisfy the standard format of a keyvalues file,
|
|
||||||
// without these brackets the weapon will be ommitted
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
"weapongroups"
|
|
||||||
{
|
|
||||||
"pistols"
|
|
||||||
{
|
|
||||||
"glock" {}
|
|
||||||
"usp" {}
|
|
||||||
"p228" {}
|
|
||||||
"deagle" {}
|
|
||||||
"elite" {}
|
|
||||||
"fiveseven" {}
|
|
||||||
}
|
|
||||||
|
|
||||||
"shotguns"
|
|
||||||
{
|
|
||||||
"m3" {}
|
|
||||||
"xm1014" {}
|
|
||||||
}
|
|
||||||
|
|
||||||
"smgs"
|
|
||||||
{
|
|
||||||
"mac10" {}
|
|
||||||
"tmp" {}
|
|
||||||
"mp5navy" {}
|
|
||||||
"ump45" {}
|
|
||||||
"p90" {}
|
|
||||||
}
|
|
||||||
|
|
||||||
"rifles"
|
|
||||||
{
|
|
||||||
"galil" {}
|
|
||||||
"famas" {}
|
|
||||||
"ak47" {}
|
|
||||||
"m4a1" {}
|
|
||||||
"sg552" {}
|
|
||||||
"aug" {}
|
|
||||||
}
|
|
||||||
|
|
||||||
"snipers"
|
|
||||||
{
|
|
||||||
"scout" {}
|
|
||||||
"sg550" {}
|
|
||||||
"g2sg1" {}
|
|
||||||
"awp" {}
|
|
||||||
}
|
|
||||||
}
|
|
58
cstrike/addons/sourcemod/configs/zr/weapons/weapongroups.txt
Normal file
58
cstrike/addons/sourcemod/configs/zr/weapons/weapongroups.txt
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
// Weapon Groups
|
||||||
|
// (See list of weapons in weapons.txt)
|
||||||
|
|
||||||
|
// Format
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// "weapon group name" (how it appears in chat messages)
|
||||||
|
// {
|
||||||
|
// "weaponname" {} <-- To satisfy the standard format of a keyvalues file,
|
||||||
|
// without these brackets the weapon will be skipped.
|
||||||
|
// Invalid weapons are logged and skipped.
|
||||||
|
// }
|
||||||
|
|
||||||
|
"weapongroups"
|
||||||
|
{
|
||||||
|
"Pistols"
|
||||||
|
{
|
||||||
|
"Glock" {}
|
||||||
|
"USP" {}
|
||||||
|
"P228" {}
|
||||||
|
"Deagle" {}
|
||||||
|
"Elite" {}
|
||||||
|
"Fiveseven" {}
|
||||||
|
}
|
||||||
|
|
||||||
|
"Shotguns"
|
||||||
|
{
|
||||||
|
"M3" {}
|
||||||
|
"XM1014" {}
|
||||||
|
}
|
||||||
|
|
||||||
|
"SMGs"
|
||||||
|
{
|
||||||
|
"Mac10" {}
|
||||||
|
"TMP" {}
|
||||||
|
"MP5Navy" {}
|
||||||
|
"UMP45" {}
|
||||||
|
"P90" {}
|
||||||
|
}
|
||||||
|
|
||||||
|
"Rifles"
|
||||||
|
{
|
||||||
|
"Galil" {}
|
||||||
|
"Famas" {}
|
||||||
|
"AK47" {}
|
||||||
|
"M4A1" {}
|
||||||
|
"SG552" {}
|
||||||
|
"AUG" {}
|
||||||
|
}
|
||||||
|
|
||||||
|
"Snipers"
|
||||||
|
{
|
||||||
|
"Scout" {}
|
||||||
|
"SG550" {}
|
||||||
|
"G2SG1" {}
|
||||||
|
"AWP" {}
|
||||||
|
}
|
||||||
|
}
|
154
cstrike/addons/sourcemod/configs/zr/weapons/weapons.txt
Normal file
154
cstrike/addons/sourcemod/configs/zr/weapons/weapons.txt
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
// Weapons
|
||||||
|
//
|
||||||
|
// Format
|
||||||
|
//
|
||||||
|
// "weaponname" // Name of the weapon (without weapon_ prefix)
|
||||||
|
// {
|
||||||
|
// "restrict" "no" (default) // Restricts the weapon on each map start
|
||||||
|
// "menu" "yes" (default) // Allows admins to toggle restriction with the menu
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Duplicate weapon entries will show up separately in restrict menu, but
|
||||||
|
// only the first one's options are used.
|
||||||
|
|
||||||
|
"weapons" // Counter-Strike: Source weapons
|
||||||
|
{
|
||||||
|
"Glock"
|
||||||
|
{
|
||||||
|
"restrict" "no"
|
||||||
|
"menu" "yes"
|
||||||
|
}
|
||||||
|
|
||||||
|
"USP"
|
||||||
|
{
|
||||||
|
"restrict" "no"
|
||||||
|
"menu" "yes"
|
||||||
|
}
|
||||||
|
|
||||||
|
"P228"
|
||||||
|
{
|
||||||
|
"restrict" "no"
|
||||||
|
"menu" "yes"
|
||||||
|
}
|
||||||
|
|
||||||
|
"Deagle"
|
||||||
|
{
|
||||||
|
"restrict" "no"
|
||||||
|
"menu" "yes"
|
||||||
|
}
|
||||||
|
|
||||||
|
"Elite"
|
||||||
|
{
|
||||||
|
"restrict" "no"
|
||||||
|
"menu" "yes"
|
||||||
|
}
|
||||||
|
|
||||||
|
"Fiveseven"
|
||||||
|
{
|
||||||
|
"restrict" "no"
|
||||||
|
"menu" "yes"
|
||||||
|
}
|
||||||
|
|
||||||
|
"M3"
|
||||||
|
{
|
||||||
|
"restrict" "no"
|
||||||
|
"menu" "yes"
|
||||||
|
}
|
||||||
|
|
||||||
|
"XM1014"
|
||||||
|
{
|
||||||
|
"restrict" "no"
|
||||||
|
"menu" "yes"
|
||||||
|
}
|
||||||
|
|
||||||
|
"Mac10"
|
||||||
|
{
|
||||||
|
"restrict" "no"
|
||||||
|
"menu" "yes"
|
||||||
|
}
|
||||||
|
|
||||||
|
"TMP"
|
||||||
|
{
|
||||||
|
"restrict" "no"
|
||||||
|
"menu" "yes"
|
||||||
|
}
|
||||||
|
|
||||||
|
"MP5Navy"
|
||||||
|
{
|
||||||
|
"restrict" "no"
|
||||||
|
"menu" "yes"
|
||||||
|
}
|
||||||
|
|
||||||
|
"UMP45"
|
||||||
|
{
|
||||||
|
"restrict" "no"
|
||||||
|
"menu" "yes"
|
||||||
|
}
|
||||||
|
|
||||||
|
"P90"
|
||||||
|
{
|
||||||
|
"restrict" "no"
|
||||||
|
"menu" "yes"
|
||||||
|
}
|
||||||
|
|
||||||
|
"Galil"
|
||||||
|
{
|
||||||
|
"restrict" "no"
|
||||||
|
"menu" "yes"
|
||||||
|
}
|
||||||
|
|
||||||
|
"Famas"
|
||||||
|
{
|
||||||
|
"restrict" "no"
|
||||||
|
"menu" "yes"
|
||||||
|
}
|
||||||
|
|
||||||
|
"AK47"
|
||||||
|
{
|
||||||
|
"restrict" "no"
|
||||||
|
"menu" "no"
|
||||||
|
}
|
||||||
|
|
||||||
|
"M4A1"
|
||||||
|
{
|
||||||
|
"restrict" "no"
|
||||||
|
"menu" "yes"
|
||||||
|
}
|
||||||
|
|
||||||
|
"SG552"
|
||||||
|
{
|
||||||
|
"restrict" "no"
|
||||||
|
"menu" "yes"
|
||||||
|
}
|
||||||
|
|
||||||
|
"AUG"
|
||||||
|
{
|
||||||
|
"restrict" "no"
|
||||||
|
"menu" "yes"
|
||||||
|
}
|
||||||
|
|
||||||
|
"Scout"
|
||||||
|
{
|
||||||
|
"restrict" "no"
|
||||||
|
"menu" "yes"
|
||||||
|
}
|
||||||
|
|
||||||
|
"SG550"
|
||||||
|
{
|
||||||
|
"restrict" "no"
|
||||||
|
"menu" "yes"
|
||||||
|
}
|
||||||
|
|
||||||
|
"GSG1"
|
||||||
|
{
|
||||||
|
"restrict" "no"
|
||||||
|
"menu" "yes"
|
||||||
|
}
|
||||||
|
|
||||||
|
"AWP"
|
||||||
|
{
|
||||||
|
"restrict" "no"
|
||||||
|
"menu" "yes"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -90,12 +90,6 @@
|
|||||||
"en" "You are now susceptible to zombie infection."
|
"en" "You are now susceptible to zombie infection."
|
||||||
"ru" "Теперь вы восприимчивы к зомби инфекции."
|
"ru" "Теперь вы восприимчивы к зомби инфекции."
|
||||||
}
|
}
|
||||||
|
|
||||||
"Market out of buyzone"
|
|
||||||
{
|
|
||||||
"en" "You are not in a buyzone."
|
|
||||||
"ru" "Вы вне зоны покупки."
|
|
||||||
}
|
|
||||||
|
|
||||||
"!ztele amount"
|
"!ztele amount"
|
||||||
{
|
{
|
||||||
@ -171,35 +165,67 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ===========================
|
// ===========================
|
||||||
// Weapon Restrict
|
// Weapons
|
||||||
// ===========================
|
// ===========================
|
||||||
|
|
||||||
|
// General
|
||||||
|
|
||||||
|
"Zombie cant use weapon"
|
||||||
|
{
|
||||||
|
"en" "Zombies can't use weapons!"
|
||||||
|
"ru" "Зомби не могут использовать оружие!"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Market
|
||||||
|
|
||||||
|
"Market out of buyzone"
|
||||||
|
{
|
||||||
|
"en" "You are not in a buyzone."
|
||||||
|
"ru" "Вы вне зоны покупки."
|
||||||
|
}
|
||||||
|
|
||||||
|
// Restrict
|
||||||
|
|
||||||
"Restrict weapon"
|
"Restrict weapon"
|
||||||
{
|
{
|
||||||
"#format" "{1:s}"
|
"#format" "{1:s}"
|
||||||
"en" "Weapon @green\"{1}\" @defaulthas been restricted."
|
"en" "Weapon @green\"{1}\" @defaulthas been restricted."
|
||||||
"ru" "Оружие @green\"{1}\" было запрещено."
|
|
||||||
}
|
}
|
||||||
|
|
||||||
"Unrestrict weapon"
|
"Unrestrict weapon"
|
||||||
{
|
{
|
||||||
"#format" "{1:s}"
|
"#format" "{1:s}"
|
||||||
"en" "Weapon @green\"{1}\" @defaulthas been unrestricted."
|
"en" "Weapon @green\"{1}\" @defaulthas been unrestricted."
|
||||||
"ru" "Оружие @green\"{1}\" было разрешено."
|
}
|
||||||
|
|
||||||
|
"Restrict weapon failed"
|
||||||
|
{
|
||||||
|
"#format" "{1:s}"
|
||||||
|
"en" "Weapon @green\"{1}\" @defaultis already restricted."
|
||||||
|
}
|
||||||
|
|
||||||
|
"Unrestrict weapon failed"
|
||||||
|
{
|
||||||
|
"#format" "{1:s}"
|
||||||
|
"en" "Weapon @green\"{1}\" @default has no restrictions set."
|
||||||
}
|
}
|
||||||
|
|
||||||
"Restrict custom weapon group"
|
"Restrict custom weapon group"
|
||||||
{
|
{
|
||||||
"#format" "{1:s},{2:s}"
|
"#format" "{1:s},{2:s}"
|
||||||
"en" "Weapon group @green\"{1}\" ({2}) @defaulthas been restricted."
|
"en" "Weapon group @green\"{1}\" ({2}) @defaulthas been restricted."
|
||||||
"ru" "Группа оружия @green\"{1}\" ({2}) была запрещена."
|
|
||||||
}
|
}
|
||||||
|
|
||||||
"Unrestrict custom weapon group"
|
"Unrestrict custom weapon group"
|
||||||
{
|
{
|
||||||
"#format" "{1:s},{2:s}"
|
"#format" "{1:s},{2:s}"
|
||||||
"en" "Weapon group @green\"{1}\" ({2}) @defaulthas been unrestricted."
|
"en" "Weapon group @green\"{1}\" ({2}) @defaulthas been unrestricted."
|
||||||
"ru" "Группа оружия @green\"{1}\" ({2}) была разрешена."
|
}
|
||||||
|
|
||||||
|
"Weapon invalid"
|
||||||
|
{
|
||||||
|
"#format" "{1:s}"
|
||||||
|
"en" "Weapon @green\"{1}\" @defaultis an invalid weapon name."
|
||||||
}
|
}
|
||||||
|
|
||||||
"Weapon is restricted"
|
"Weapon is restricted"
|
||||||
@ -209,19 +235,42 @@
|
|||||||
"ru" "Оружие @green{1} @default запрещено."
|
"ru" "Оружие @green{1} @default запрещено."
|
||||||
}
|
}
|
||||||
|
|
||||||
"Weapon invalid"
|
// Menu
|
||||||
|
|
||||||
|
"Weapons menu main title"
|
||||||
{
|
{
|
||||||
"#format" "{1:s}"
|
"en" "Weapons Management"
|
||||||
"en" "Weapon @green\"{1}\" @defaultis not currently restricted."
|
|
||||||
}
|
}
|
||||||
|
|
||||||
"Zombie cant use weapon"
|
"Weapons menu main restrict weapon"
|
||||||
{
|
{
|
||||||
"en" "Zombies can't use weapons!"
|
"en" "Restrict a Weapon"
|
||||||
"ru" "Зомби не могут использовать оружие!"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"Weapons menu main unrestrict weapon"
|
||||||
|
{
|
||||||
|
"en" "Unrestrict a Weapon"
|
||||||
|
}
|
||||||
|
|
||||||
|
"Weapons menu main restrict weapon group"
|
||||||
|
{
|
||||||
|
"en" "Restrict a Weapon Group"
|
||||||
|
}
|
||||||
|
|
||||||
|
"Weapons menu main unrestrict weapon group"
|
||||||
|
{
|
||||||
|
"en" "Unrestrict a Weapon Group"
|
||||||
|
}
|
||||||
|
|
||||||
|
"Weapons menu main market" // Option disabled if ZMarket isn't installed
|
||||||
|
{
|
||||||
|
"en" "ZMarket Options"
|
||||||
|
}
|
||||||
|
|
||||||
|
"Weapons menu weapons title"
|
||||||
|
{
|
||||||
|
"en" "Toggle Restrictions:"
|
||||||
|
}
|
||||||
|
|
||||||
"Suicide text"
|
"Suicide text"
|
||||||
{
|
{
|
||||||
@ -344,27 +393,22 @@
|
|||||||
{
|
{
|
||||||
"en" "Infect a Player"
|
"en" "Infect a Player"
|
||||||
}
|
}
|
||||||
|
|
||||||
"!zadmin main spawn"
|
"!zadmin main spawn"
|
||||||
{
|
{
|
||||||
"en" "Spawn All Players"
|
"en" "Spawn All Players"
|
||||||
}
|
}
|
||||||
|
|
||||||
"!zadmin main tele"
|
"!zadmin main tele"
|
||||||
{
|
{
|
||||||
"en" "ZTele Commands"
|
"en" "ZTele Commands"
|
||||||
}
|
}
|
||||||
|
|
||||||
"!zadmin main restrict"
|
"!zadmin main weapons"
|
||||||
{
|
{
|
||||||
"en" "Restrict Weapon"
|
"en" "Weapon Management"
|
||||||
}
|
}
|
||||||
|
|
||||||
"!zadmin main unrestrict"
|
|
||||||
{
|
|
||||||
"en" "Unrestrict Weapon"
|
|
||||||
}
|
|
||||||
|
|
||||||
"!zadmin main logflags"
|
"!zadmin main logflags"
|
||||||
{
|
{
|
||||||
"en" "Logging Flags"
|
"en" "Logging Flags"
|
||||||
|
@ -33,12 +33,11 @@
|
|||||||
#include "zr/zombie"
|
#include "zr/zombie"
|
||||||
#include "zr/menu"
|
#include "zr/menu"
|
||||||
#include "zr/sayhooks"
|
#include "zr/sayhooks"
|
||||||
#include "zr/zadmin"
|
|
||||||
|
|
||||||
// Weapons
|
// Weapons
|
||||||
#include "zr/weapons/restrict"
|
#include "zr/weapons/weapons"
|
||||||
#include "zr/weapons/markethandler"
|
|
||||||
|
|
||||||
|
#include "zr/zadmin"
|
||||||
#include "zr/damagecontrol"
|
#include "zr/damagecontrol"
|
||||||
#include "zr/commands"
|
#include "zr/commands"
|
||||||
#include "zr/event"
|
#include "zr/event"
|
||||||
@ -120,8 +119,16 @@ public OnMapStart()
|
|||||||
LoadModelData();
|
LoadModelData();
|
||||||
LoadDownloadData();
|
LoadDownloadData();
|
||||||
|
|
||||||
// Forward event to modules.
|
// Weapons
|
||||||
WeaponRestrictMapStart();
|
WeaponsOnMapStart();
|
||||||
|
|
||||||
|
new i;
|
||||||
|
new classindex = GetDefaultClassIndex();
|
||||||
|
for (i = 1; i <= MAXPLAYERS; i++)
|
||||||
|
{
|
||||||
|
pClass[i] = classindex;
|
||||||
|
}
|
||||||
|
|
||||||
Anticamp_Startup();
|
Anticamp_Startup();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,6 +139,11 @@ public OnMapEnd()
|
|||||||
|
|
||||||
public OnConfigsExecuted()
|
public OnConfigsExecuted()
|
||||||
{
|
{
|
||||||
|
FindMapSky();
|
||||||
|
|
||||||
|
LoadClassData();
|
||||||
|
LoadAmbienceData();
|
||||||
|
|
||||||
decl String:mapconfig[PLATFORM_MAX_PATH];
|
decl String:mapconfig[PLATFORM_MAX_PATH];
|
||||||
|
|
||||||
GetCurrentMap(mapconfig, sizeof(mapconfig));
|
GetCurrentMap(mapconfig, sizeof(mapconfig));
|
||||||
@ -143,17 +155,8 @@ public OnConfigsExecuted()
|
|||||||
if (FileExists(path))
|
if (FileExists(path))
|
||||||
{
|
{
|
||||||
ServerCommand("exec %s", mapconfig);
|
ServerCommand("exec %s", mapconfig);
|
||||||
if (LogFlagCheck(LOG_CORE_EVENTS))
|
LogMessage("Executed map config file: %s", mapconfig);
|
||||||
{
|
|
||||||
LogMessage("Executed map config file: %s", mapconfig);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FindMapSky();
|
|
||||||
|
|
||||||
ClassLoad();
|
|
||||||
LoadClassData();
|
|
||||||
LoadAmbienceData();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public OnClientPutInServer(client)
|
public OnClientPutInServer(client)
|
||||||
@ -167,9 +170,8 @@ public OnClientPutInServer(client)
|
|||||||
new bool:zhp = GetConVarBool(gCvars[CVAR_ZHP_DEFAULT]);
|
new bool:zhp = GetConVarBool(gCvars[CVAR_ZHP_DEFAULT]);
|
||||||
dispHP[client] = zhp;
|
dispHP[client] = zhp;
|
||||||
|
|
||||||
// Forward event to modules.
|
// Weapon restrict
|
||||||
WeaponRestrictClientInit(client);
|
WeaponRestrictClientInit(client);
|
||||||
ClassClientInit(client);
|
|
||||||
|
|
||||||
ClientHookAttack(client);
|
ClientHookAttack(client);
|
||||||
|
|
||||||
@ -186,12 +188,12 @@ public OnClientPutInServer(client)
|
|||||||
|
|
||||||
public OnClientDisconnect(client)
|
public OnClientDisconnect(client)
|
||||||
{
|
{
|
||||||
ClientUnHookAttack(client);
|
// Weapon restrict
|
||||||
PlayerLeft(client);
|
|
||||||
|
|
||||||
// Forward event to modules.
|
|
||||||
WeaponRestrictClientDisconnect(client);
|
WeaponRestrictClientDisconnect(client);
|
||||||
ClassOnClientDisconnect(client);
|
|
||||||
|
ClientUnHookAttack(client);
|
||||||
|
|
||||||
|
PlayerLeft(client);
|
||||||
ZTeleResetClient(client);
|
ZTeleResetClient(client);
|
||||||
AmbienceStop(client);
|
AmbienceStop(client);
|
||||||
|
|
||||||
@ -233,8 +235,6 @@ ZREnd()
|
|||||||
UnhookCvars();
|
UnhookCvars();
|
||||||
UnhookEvents();
|
UnhookEvents();
|
||||||
|
|
||||||
// TODO: Disable all modules! Teleport, ambience, overlays, antistick, etc.
|
|
||||||
|
|
||||||
new maxplayers = GetMaxClients();
|
new maxplayers = GetMaxClients();
|
||||||
for (new x = 1; x <= maxplayers; x++)
|
for (new x = 1; x <= maxplayers; x++)
|
||||||
{
|
{
|
||||||
|
@ -169,6 +169,12 @@ public Action:Command_Restrict(client, argc)
|
|||||||
|
|
||||||
ZR_PrintToChat(0, "Restrict custom weapon group", arg1, weaponlist);
|
ZR_PrintToChat(0, "Restrict custom weapon group", arg1, weaponlist);
|
||||||
}
|
}
|
||||||
|
case Failed_Weapon:
|
||||||
|
{
|
||||||
|
ZR_ReplyToCommand(client, "Restrict weapon failed", arg1);
|
||||||
|
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
case Invalid:
|
case Invalid:
|
||||||
{
|
{
|
||||||
ZR_ReplyToCommand(client, "Weapon invalid", arg1);
|
ZR_ReplyToCommand(client, "Weapon invalid", arg1);
|
||||||
@ -226,6 +232,12 @@ public Action:Command_Unrestrict(client, argc)
|
|||||||
|
|
||||||
ZR_PrintToChat(0, "Unrestrict custom weapon group", arg1, weaponlist);
|
ZR_PrintToChat(0, "Unrestrict custom weapon group", arg1, weaponlist);
|
||||||
}
|
}
|
||||||
|
case Failed_Weapon:
|
||||||
|
{
|
||||||
|
ZR_ReplyToCommand(client, "Unrestrict weapon failed", arg1);
|
||||||
|
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
case Invalid:
|
case Invalid:
|
||||||
{
|
{
|
||||||
ZR_ReplyToCommand(client, "Weapon invalid", arg1);
|
ZR_ReplyToCommand(client, "Weapon invalid", arg1);
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
* @param client The client index.
|
* @param client The client index.
|
||||||
* @param weaponid The unique weapon ID used for market natives.
|
* @param weaponid The unique weapon ID used for market natives.
|
||||||
* @return True to allow market to take over, false to block purchase.
|
* @return True to allow market to take over, false to block purchase.
|
||||||
*/
|
*/
|
||||||
public bool:Market_OnWeaponSelected(client, String:weaponid[])
|
public bool:Market_OnWeaponSelected(client, String:weaponid[])
|
||||||
{
|
{
|
||||||
// If player is dead or weaponid is invalid, then stop
|
// If player is dead or weaponid is invalid, then stop
|
||||||
@ -36,7 +36,7 @@ public bool:Market_OnWeaponSelected(client, String:weaponid[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
decl String:display[64];
|
decl String:display[64];
|
||||||
decl String:weapon[32];
|
decl String:weapon[WEAPONS_MAX_LENGTH];
|
||||||
new price;
|
new price;
|
||||||
|
|
||||||
// If the market plugin can't find info about the weapon, then stop
|
// If the market plugin can't find info about the weapon, then stop
|
||||||
@ -73,7 +73,7 @@ public bool:Market_OnWeaponSelected(client, String:weaponid[])
|
|||||||
*
|
*
|
||||||
* @param client The client index.
|
* @param client The client index.
|
||||||
* @param allowed True when the weapon was purchased successfully, false otherwise.
|
* @param allowed True when the weapon was purchased successfully, false otherwise.
|
||||||
*/
|
*/
|
||||||
public Market_PostOnWeaponSelected(client, &bool:allowed)
|
public Market_PostOnWeaponSelected(client, &bool:allowed)
|
||||||
{
|
{
|
||||||
// If the purchase wasn't allowed, then stop
|
// If the purchase wasn't allowed, then stop
|
||||||
|
283
src/zr/weapons/menu_weapons.inc
Normal file
283
src/zr/weapons/menu_weapons.inc
Normal file
@ -0,0 +1,283 @@
|
|||||||
|
/**
|
||||||
|
* ====================
|
||||||
|
* Zombie:Reloaded
|
||||||
|
* File: menu_weapons.inc
|
||||||
|
* Author: Greyscale
|
||||||
|
* ====================
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Weapons Menus
|
||||||
|
*/
|
||||||
|
enum WeaponsMenu
|
||||||
|
{
|
||||||
|
Restrict_Weapon,
|
||||||
|
Unrestrict_Weapon,
|
||||||
|
Restrict_Group,
|
||||||
|
Unrestrict_Group,
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array to store the client's current weapon menu
|
||||||
|
*/
|
||||||
|
new WeaponsMenu:curMenuWeapons[MAXPLAYERS+1];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends main weapon menu to client.
|
||||||
|
* @param client The client index.
|
||||||
|
*/
|
||||||
|
WeaponsMenuMain(client)
|
||||||
|
{
|
||||||
|
// Create menu handle
|
||||||
|
new Handle:menu_weapons_main = CreateMenu(WeaponsMenuMainHandle);
|
||||||
|
|
||||||
|
SetGlobalTransTarget(client);
|
||||||
|
|
||||||
|
SetMenuTitle(menu_weapons_main, "%t\n ", "Weapons menu main title");
|
||||||
|
|
||||||
|
decl String:restrictweapon[64];
|
||||||
|
decl String:unrestrictweapon[64];
|
||||||
|
decl String:restrictwgroup[64];
|
||||||
|
decl String:unrestrictwgroup[64];
|
||||||
|
decl String:zmarket[64];
|
||||||
|
|
||||||
|
Format(restrictweapon, sizeof(restrictweapon), "%t", "Weapons menu main restrict weapon");
|
||||||
|
Format(unrestrictweapon, sizeof(unrestrictweapon), "%t", "Weapons menu main unrestrict weapon");
|
||||||
|
Format(restrictwgroup, sizeof(restrictwgroup), "%t", "Weapons menu main restrict weapon group");
|
||||||
|
Format(unrestrictwgroup, sizeof(unrestrictwgroup), "%t", "Weapons menu main unrestrict weapon group");
|
||||||
|
Format(zmarket, sizeof(zmarket), "%t", "Weapons menu main market");
|
||||||
|
|
||||||
|
AddMenuItem(menu_weapons_main, "restrictweapon", restrictweapon);
|
||||||
|
AddMenuItem(menu_weapons_main, "unrestrictweapon", unrestrictweapon);
|
||||||
|
AddMenuItem(menu_weapons_main, "restrictwgroup", restrictwgroup);
|
||||||
|
AddMenuItem(menu_weapons_main, "unrestrictwgroup", unrestrictwgroup);
|
||||||
|
|
||||||
|
// Disable market option if market isn't installed
|
||||||
|
if (market)
|
||||||
|
{
|
||||||
|
AddMenuItem(menu_weapons_main, "zmarket", zmarket);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AddMenuItem(menu_weapons_main, "zmarket", zmarket, ITEMDRAW_DISABLED);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a "Back" button to the weapons main menu
|
||||||
|
SetMenuExitBackButton(menu_weapons_main, true);
|
||||||
|
|
||||||
|
// Send menu
|
||||||
|
DisplayMenu(menu_weapons_main, client, MENU_TIME_FOREVER);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when client selects option in the weapons main menu, and handles it.
|
||||||
|
* @param menu_weapons_main Handle of the menu being used.
|
||||||
|
* @param action The action done on the menu (see menus.inc, enum MenuAction).
|
||||||
|
* @param client The client index.
|
||||||
|
* @param slot The slot index selected (starting from 0).
|
||||||
|
*/
|
||||||
|
public WeaponsMenuMainHandle(Handle:menu_weapons_main, MenuAction:action, client, slot)
|
||||||
|
{
|
||||||
|
// Client selected an option
|
||||||
|
if (action == MenuAction_Select)
|
||||||
|
{
|
||||||
|
switch(slot)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
{
|
||||||
|
WeaponsMenuWeapons(client, Restrict_Weapon);
|
||||||
|
}
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
WeaponsMenuWeapons(client, Unrestrict_Weapon);
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
WeaponsMenuWeapons(client, Restrict_Group);
|
||||||
|
}
|
||||||
|
case 3:
|
||||||
|
{
|
||||||
|
WeaponsMenuWeapons(client, Unrestrict_Group);
|
||||||
|
}
|
||||||
|
case 4:
|
||||||
|
{
|
||||||
|
// WeaponsMenuMarket(client);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Client closed the menu
|
||||||
|
if (action == MenuAction_Cancel)
|
||||||
|
{
|
||||||
|
// Client hit "Back" button
|
||||||
|
if (slot == MenuCancel_ExitBack)
|
||||||
|
{
|
||||||
|
ZRAdminMenu(client);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Client hit "Exit" button
|
||||||
|
else if (action == MenuAction_End)
|
||||||
|
{
|
||||||
|
CloseHandle(menu_weapons_main);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends weapon list menu to client.
|
||||||
|
* @param client The client index.
|
||||||
|
*/
|
||||||
|
WeaponsMenuWeapons(client, WeaponsMenu:type)
|
||||||
|
{
|
||||||
|
// Set the current action client is performing on a weapon (see enum WeaponsMenu)
|
||||||
|
curMenuWeapons[client] = type;
|
||||||
|
|
||||||
|
// Create menu handle
|
||||||
|
new Handle:menu_weapons_weapons = CreateMenu(WeaponsMenuWeaponsHandle);
|
||||||
|
|
||||||
|
SetGlobalTransTarget(client);
|
||||||
|
|
||||||
|
SetMenuTitle(menu_weapons_weapons, "%t\n ", "Weapons menu weapons title");
|
||||||
|
|
||||||
|
// If client wants to perform an action on a single weapon, show weapon list
|
||||||
|
if (curMenuWeapons[client] == Restrict_Weapon || curMenuWeapons[client] == Unrestrict_Weapon)
|
||||||
|
{
|
||||||
|
decl String:weapon[WEAPONS_MAX_LENGTH];
|
||||||
|
new Handle:arrayWeapons = INVALID_HANDLE;
|
||||||
|
new size = WeaponsCreateWeaponArray(arrayWeapons);
|
||||||
|
|
||||||
|
// x = Array index
|
||||||
|
for (new x = 0; x < size; x++)
|
||||||
|
{
|
||||||
|
GetArrayString(arrayWeapons, x, weapon, sizeof(weapon));
|
||||||
|
|
||||||
|
new bool:menu = WeaponsIsWeaponMenu(weapon);
|
||||||
|
|
||||||
|
// If weapon restriction is blocked for the menu, disable option
|
||||||
|
if (menu)
|
||||||
|
{
|
||||||
|
AddMenuItem(menu_weapons_weapons, weapon, weapon);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AddMenuItem(menu_weapons_weapons, weapon, weapon, ITEMDRAW_DISABLED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Kill the array handle
|
||||||
|
CloseHandle(arrayWeapons);
|
||||||
|
}
|
||||||
|
// If client wants to perform an action on a weapon group, show custom group list
|
||||||
|
else if (curMenuWeapons[client] == Restrict_Group || curMenuWeapons[client] == Unrestrict_Group)
|
||||||
|
{
|
||||||
|
decl String:weapongroup[WEAPONS_MAX_LENGTH];
|
||||||
|
new Handle:arrayWeaponGroups = INVALID_HANDLE;
|
||||||
|
new size = WeaponsCreateWeaponGroupArray(arrayWeaponGroups);
|
||||||
|
|
||||||
|
// x = Array index
|
||||||
|
for (new x = 0; x < size; x++)
|
||||||
|
{
|
||||||
|
GetArrayString(arrayWeaponGroups, x, weapongroup, sizeof(weapongroup));
|
||||||
|
|
||||||
|
AddMenuItem(menu_weapons_weapons, weapongroup, weapongroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Kill the array handle
|
||||||
|
CloseHandle(arrayWeaponGroups);
|
||||||
|
}
|
||||||
|
|
||||||
|
SetMenuExitBackButton(menu_weapons_weapons, true);
|
||||||
|
|
||||||
|
DisplayMenu(menu_weapons_weapons, client, MENU_TIME_FOREVER);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when client selects option in the weapons list menu, and handles it.
|
||||||
|
* @param menu_weapons_main Handle of the menu being used.
|
||||||
|
* @param action The action done on the menu (see menus.inc, enum MenuAction).
|
||||||
|
* @param client The client index.
|
||||||
|
* @param slot The slot index selected (starting from 0).
|
||||||
|
*/
|
||||||
|
public WeaponsMenuWeaponsHandle(Handle:menu_weapons_weapons, MenuAction:action, client, slot)
|
||||||
|
{
|
||||||
|
// Client selected an option
|
||||||
|
if (action == MenuAction_Select)
|
||||||
|
{
|
||||||
|
decl String:weapon[WEAPONS_MAX_LENGTH];
|
||||||
|
GetMenuItem(menu_weapons_weapons, slot, weapon, sizeof(weapon));
|
||||||
|
|
||||||
|
new WpnRestrictQuery:output;
|
||||||
|
|
||||||
|
// If client is restricting a weapon or group, then call the restrict function
|
||||||
|
if (curMenuWeapons[client] == Restrict_Weapon || curMenuWeapons[client] == Restrict_Group)
|
||||||
|
{
|
||||||
|
output = WeaponRestrictRestrict(weapon);
|
||||||
|
|
||||||
|
switch(output)
|
||||||
|
{
|
||||||
|
case Successful_Weapon:
|
||||||
|
{
|
||||||
|
ZR_PrintToChat(0, "Restrict weapon", weapon);
|
||||||
|
}
|
||||||
|
case Successful_Group:
|
||||||
|
{
|
||||||
|
decl String:weaponlist[128];
|
||||||
|
WeaponRestrictGetWeaponList(weapon, weaponlist, sizeof(weaponlist), ", ");
|
||||||
|
|
||||||
|
ZR_PrintToChat(0, "Restrict custom weapon group", weapon, weaponlist);
|
||||||
|
}
|
||||||
|
case Failed_Weapon:
|
||||||
|
{
|
||||||
|
ZR_PrintToChat(client, "Restrict weapon failed", weapon);
|
||||||
|
}
|
||||||
|
case Invalid:
|
||||||
|
{
|
||||||
|
ZR_PrintToChat(client, "Weapon invalid", weapon);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// If client is unrestricting a weapon or group, then call the unrestrict function
|
||||||
|
else if (curMenuWeapons[client] == Unrestrict_Weapon || curMenuWeapons[client] == Unrestrict_Group)
|
||||||
|
{
|
||||||
|
output = WeaponRestrictUnrestrict(weapon);
|
||||||
|
|
||||||
|
switch(output)
|
||||||
|
{
|
||||||
|
case Successful_Weapon:
|
||||||
|
{
|
||||||
|
ZR_PrintToChat(0, "Unrestrict weapon", weapon);
|
||||||
|
}
|
||||||
|
case Successful_Group:
|
||||||
|
{
|
||||||
|
decl String:weaponlist[128];
|
||||||
|
WeaponRestrictGetWeaponList(weapon, weaponlist, sizeof(weaponlist), ", ");
|
||||||
|
|
||||||
|
ZR_PrintToChat(0, "Unrestrict custom weapon group", weapon, weaponlist);
|
||||||
|
}
|
||||||
|
case Failed_Weapon:
|
||||||
|
{
|
||||||
|
ZR_PrintToChat(client, "Unrestrict weapon failed", weapon);
|
||||||
|
}
|
||||||
|
case Invalid:
|
||||||
|
{
|
||||||
|
ZR_PrintToChat(client, "Weapon invalid", weapon);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Resend menu
|
||||||
|
WeaponsMenuWeapons(client, curMenuWeapons[client]);
|
||||||
|
}
|
||||||
|
// Client closed the menu
|
||||||
|
if (action == MenuAction_Cancel)
|
||||||
|
{
|
||||||
|
// Client hit "Back" button
|
||||||
|
if (slot == MenuCancel_ExitBack)
|
||||||
|
{
|
||||||
|
WeaponsMenuMain(client);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Client hit "Exit" button
|
||||||
|
else if (action == MenuAction_End)
|
||||||
|
{
|
||||||
|
CloseHandle(menu_weapons_weapons);
|
||||||
|
}
|
||||||
|
}
|
@ -8,32 +8,34 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Array to store restricted weapon names.
|
* Array to store restricted weapon names.
|
||||||
*/
|
*/
|
||||||
new Handle:gRestrictedWeapons = INVALID_HANDLE;
|
new Handle:gRestrictedWeapons = INVALID_HANDLE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Array to store keyvalue data.
|
* Array to store keyvalue data.
|
||||||
*/
|
*/
|
||||||
new Handle:kvWeaponGroups = INVALID_HANDLE;
|
new Handle:kvWeaponGroups = INVALID_HANDLE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Array that stores the "HookID" to be later unhooked on player disconnect.
|
* Array that stores the "HookID" to be later unhooked on player disconnect.
|
||||||
*/
|
*/
|
||||||
new gCanUseHookID[MAXPLAYERS+1];
|
new gCanUseHookID[MAXPLAYERS+1];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Query results returned when (un)restricting a weapon.
|
* Query results returned when (un)restricting a weapon.
|
||||||
*/
|
*/
|
||||||
enum WpnRestrictQuery
|
enum WpnRestrictQuery
|
||||||
{
|
{
|
||||||
Successful_Weapon, /** Weapon (un)restrict query was successful. */
|
Successful_Weapon, /** Weapon (un)restrict query was successful. */
|
||||||
Successful_Group, /** Group (un)restrict query was successful. */
|
Successful_Group, /** Group (un)restrict query was successful. */
|
||||||
|
Failed_Weapon, /** Weapon (un)restrict was unsuccessful */
|
||||||
|
Failed_Group, /** Group (un)restrict was unsuccessful */
|
||||||
Invalid, /** Weapon/Group invalid */
|
Invalid, /** Weapon/Group invalid */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize data and hook commands.
|
* Initialize data and hook commands.
|
||||||
*/
|
*/
|
||||||
WeaponRestrictInit()
|
WeaponRestrictInit()
|
||||||
{
|
{
|
||||||
// Initialize weapon restrict array
|
// Initialize weapon restrict array
|
||||||
@ -45,8 +47,8 @@ WeaponRestrictInit()
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads weapon data from file.
|
* Loads weapon data from file.
|
||||||
*/
|
*/
|
||||||
WeaponRestrictMapStart()
|
WeaponRestrictOnMapStart()
|
||||||
{
|
{
|
||||||
// Clear restricted weapons
|
// Clear restricted weapons
|
||||||
RestrictWeaponUnrestrictAll();
|
RestrictWeaponUnrestrictAll();
|
||||||
@ -60,17 +62,44 @@ WeaponRestrictMapStart()
|
|||||||
kvWeaponGroups = CreateKeyValues("weapongroups");
|
kvWeaponGroups = CreateKeyValues("weapongroups");
|
||||||
|
|
||||||
decl String:path[PLATFORM_MAX_PATH];
|
decl String:path[PLATFORM_MAX_PATH];
|
||||||
BuildPath(Path_SM, path, sizeof(path), "configs/zr/weapongroups.txt");
|
BuildPath(Path_SM, path, sizeof(path), "configs/zr/weapons/weapongroups.txt");
|
||||||
|
|
||||||
|
// If file isn't found, stop plugin
|
||||||
if (!FileToKeyValues(kvWeaponGroups, path))
|
if (!FileToKeyValues(kvWeaponGroups, path))
|
||||||
{
|
{
|
||||||
SetFailState("\"%s\" missing from server", path);
|
SetFailState("\"%s\" missing from server", path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KvRewind(kvWeaponGroups);
|
||||||
|
|
||||||
|
if (KvGotoFirstSubKey(kvWeaponGroups))
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if (KvGotoFirstSubKey(kvWeaponGroups))
|
||||||
|
{
|
||||||
|
decl String:groupweapon[32];
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
|
||||||
|
KvGetSectionName(kvWeaponGroups, groupweapon, sizeof(groupweapon));
|
||||||
|
|
||||||
|
if (!WeaponsIsValidWeapon(groupweapon))
|
||||||
|
{
|
||||||
|
// TODO: LOG INVALID WEAPON
|
||||||
|
}
|
||||||
|
} while (KvGotoNextKey(kvWeaponGroups));
|
||||||
|
|
||||||
|
KvGoBack(kvWeaponGroups);
|
||||||
|
}
|
||||||
|
} while (KvGotoNextKey(kvWeaponGroups));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears restricted weapon array.
|
* Clears restricted weapon array.
|
||||||
*/
|
*/
|
||||||
RestrictWeaponUnrestrictAll()
|
RestrictWeaponUnrestrictAll()
|
||||||
{
|
{
|
||||||
ClearArray(gRestrictedWeapons);
|
ClearArray(gRestrictedWeapons);
|
||||||
@ -80,7 +109,7 @@ RestrictWeaponUnrestrictAll()
|
|||||||
* Hook Weapon_CanUse function on a client.
|
* Hook Weapon_CanUse function on a client.
|
||||||
*
|
*
|
||||||
* @param client The client index.
|
* @param client The client index.
|
||||||
*/
|
*/
|
||||||
WeaponRestrictClientInit(client)
|
WeaponRestrictClientInit(client)
|
||||||
{
|
{
|
||||||
gCanUseHookID[client] = Hacks_Hook(client, HACKS_HTYPE_WEAPON_CANUSE, WeaponRestrictCanUse, false);
|
gCanUseHookID[client] = Hacks_Hook(client, HACKS_HTYPE_WEAPON_CANUSE, WeaponRestrictCanUse, false);
|
||||||
@ -90,7 +119,7 @@ WeaponRestrictClientInit(client)
|
|||||||
* Unhook Weapon_CanUse function on a client.
|
* Unhook Weapon_CanUse function on a client.
|
||||||
*
|
*
|
||||||
* @param client The client index.
|
* @param client The client index.
|
||||||
*/
|
*/
|
||||||
WeaponRestrictClientDisconnect(client)
|
WeaponRestrictClientDisconnect(client)
|
||||||
{
|
{
|
||||||
Hacks_Unhook(gCanUseHookID[client]);
|
Hacks_Unhook(gCanUseHookID[client]);
|
||||||
@ -102,7 +131,7 @@ WeaponRestrictClientDisconnect(client)
|
|||||||
*
|
*
|
||||||
* @param client The client index.
|
* @param client The client index.
|
||||||
* @param argc Argument count.
|
* @param argc Argument count.
|
||||||
*/
|
*/
|
||||||
public Action:WeaponRestrictBuyHook(client, argc)
|
public Action:WeaponRestrictBuyHook(client, argc)
|
||||||
{
|
{
|
||||||
// If plugin is disabled then stop
|
// If plugin is disabled then stop
|
||||||
@ -146,8 +175,10 @@ public Action:WeaponRestrictBuyHook(client, argc)
|
|||||||
* @param weapon The weapon/group name.
|
* @param weapon The weapon/group name.
|
||||||
* @return Successful_Weapon: The call successfully restricted a weapon.
|
* @return Successful_Weapon: The call successfully restricted a weapon.
|
||||||
* Successful_Group: The call successfully restricted a weapon group.
|
* Successful_Group: The call successfully restricted a weapon group.
|
||||||
|
* Failed_Weapon: The call failed to restrict a weapon.
|
||||||
|
* Failed_Group: The call failed to restrict a weapon group.
|
||||||
* Invalid: The call was unsuccessful due to invalid weapon.
|
* Invalid: The call was unsuccessful due to invalid weapon.
|
||||||
*/
|
*/
|
||||||
WpnRestrictQuery:WeaponRestrictRestrict(const String:weapon[])
|
WpnRestrictQuery:WeaponRestrictRestrict(const String:weapon[])
|
||||||
{
|
{
|
||||||
if (WeaponRestrictIsCustomGroup(weapon))
|
if (WeaponRestrictIsCustomGroup(weapon))
|
||||||
@ -164,6 +195,12 @@ WpnRestrictQuery:WeaponRestrictRestrict(const String:weapon[])
|
|||||||
|
|
||||||
KvGetSectionName(kvWeaponGroups, groupweapon, sizeof(groupweapon));
|
KvGetSectionName(kvWeaponGroups, groupweapon, sizeof(groupweapon));
|
||||||
|
|
||||||
|
// If weapon is invalid, then skip
|
||||||
|
if (!WeaponsIsValidWeapon(groupweapon))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!WeaponRestrictIsRestricted(groupweapon))
|
if (!WeaponRestrictIsRestricted(groupweapon))
|
||||||
{
|
{
|
||||||
PushArrayString(gRestrictedWeapons, groupweapon);
|
PushArrayString(gRestrictedWeapons, groupweapon);
|
||||||
@ -174,11 +211,18 @@ WpnRestrictQuery:WeaponRestrictRestrict(const String:weapon[])
|
|||||||
return Successful_Group;
|
return Successful_Group;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!WeaponRestrictIsRestricted(weapon))
|
if (!WeaponsIsValidWeapon(weapon))
|
||||||
{
|
{
|
||||||
PushArrayString(gRestrictedWeapons, weapon);
|
return Invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (WeaponRestrictIsRestricted(weapon))
|
||||||
|
{
|
||||||
|
return Failed_Weapon;
|
||||||
|
}
|
||||||
|
|
||||||
|
PushArrayString(gRestrictedWeapons, weapon);
|
||||||
|
|
||||||
return Successful_Weapon;
|
return Successful_Weapon;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,8 +232,10 @@ WpnRestrictQuery:WeaponRestrictRestrict(const String:weapon[])
|
|||||||
* @param weapon The weapon/group name.
|
* @param weapon The weapon/group name.
|
||||||
* @return Successful_Weapon: The call successfully restricted a weapon.
|
* @return Successful_Weapon: The call successfully restricted a weapon.
|
||||||
* Successful_Group: The call successfully restricted a weapon group.
|
* Successful_Group: The call successfully restricted a weapon group.
|
||||||
* Invalid: The call was unsuccessful due to invalid weapon.
|
* Failed_Weapon: The call failed to restrict a weapon.
|
||||||
*/
|
* Failed_Group: The call failed to restrict a weapon group.
|
||||||
|
* Invalid: The call was unsuccessful due to invalid weapon.
|
||||||
|
*/
|
||||||
WpnRestrictQuery:WeaponRestrictUnrestrict(const String:weapon[])
|
WpnRestrictQuery:WeaponRestrictUnrestrict(const String:weapon[])
|
||||||
{
|
{
|
||||||
if (WeaponRestrictIsCustomGroup(weapon))
|
if (WeaponRestrictIsCustomGroup(weapon))
|
||||||
@ -199,12 +245,18 @@ WpnRestrictQuery:WeaponRestrictUnrestrict(const String:weapon[])
|
|||||||
|
|
||||||
if (KvGotoFirstSubKey(kvWeaponGroups))
|
if (KvGotoFirstSubKey(kvWeaponGroups))
|
||||||
{
|
{
|
||||||
decl String:groupweapon[32];
|
decl String:groupweapon[WEAPONS_MAX_LENGTH];
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
KvGetSectionName(kvWeaponGroups, groupweapon, sizeof(groupweapon));
|
KvGetSectionName(kvWeaponGroups, groupweapon, sizeof(groupweapon));
|
||||||
|
|
||||||
|
// If weapon is invalid, then skip
|
||||||
|
if (!WeaponsIsValidWeapon(groupweapon))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (WeaponRestrictIsRestricted(groupweapon))
|
if (WeaponRestrictIsRestricted(groupweapon))
|
||||||
{
|
{
|
||||||
new weaponindex = WeaponRestrictGetIndex(groupweapon);
|
new weaponindex = WeaponRestrictGetIndex(groupweapon);
|
||||||
@ -219,31 +271,36 @@ WpnRestrictQuery:WeaponRestrictUnrestrict(const String:weapon[])
|
|||||||
return Successful_Group;
|
return Successful_Group;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WeaponRestrictIsRestricted(weapon))
|
if (!WeaponsIsValidWeapon(weapon))
|
||||||
{
|
{
|
||||||
new weaponindex = WeaponRestrictGetIndex(weapon);
|
return Invalid;
|
||||||
if (weaponindex > -1)
|
|
||||||
{
|
|
||||||
RemoveFromArray(gRestrictedWeapons, weaponindex);
|
|
||||||
|
|
||||||
return Successful_Weapon;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Invalid;
|
if (!WeaponRestrictIsRestricted(weapon))
|
||||||
|
{
|
||||||
|
return Failed_Weapon;
|
||||||
|
}
|
||||||
|
|
||||||
|
new weaponindex = WeaponRestrictGetIndex(weapon);
|
||||||
|
if (weaponindex > -1)
|
||||||
|
{
|
||||||
|
RemoveFromArray(gRestrictedWeapons, weaponindex);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Successful_Weapon;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if a weapon is restricted.
|
* Checks if a weapon is restricted.
|
||||||
*
|
*
|
||||||
* @param weapon The weapon name.
|
* @param weapon The weapon name.
|
||||||
*/
|
*/
|
||||||
bool:WeaponRestrictIsRestricted(const String:weapon[])
|
bool:WeaponRestrictIsRestricted(const String:weapon[])
|
||||||
{
|
{
|
||||||
new size = GetArraySize(gRestrictedWeapons);
|
new size = GetArraySize(gRestrictedWeapons);
|
||||||
for (new x = 0; x < size; x++)
|
for (new x = 0; x < size; x++)
|
||||||
{
|
{
|
||||||
decl String:restrictedweapon[32];
|
decl String:restrictedweapon[WEAPONS_MAX_LENGTH];
|
||||||
GetArrayString(gRestrictedWeapons, x, restrictedweapon, sizeof(restrictedweapon));
|
GetArrayString(gRestrictedWeapons, x, restrictedweapon, sizeof(restrictedweapon));
|
||||||
|
|
||||||
if (StrEqual(weapon, restrictedweapon, false))
|
if (StrEqual(weapon, restrictedweapon, false))
|
||||||
@ -259,13 +316,13 @@ bool:WeaponRestrictIsRestricted(const String:weapon[])
|
|||||||
* Returns the array index of the restricted weapon.
|
* Returns the array index of the restricted weapon.
|
||||||
*
|
*
|
||||||
* @param weapon The weapon name.
|
* @param weapon The weapon name.
|
||||||
*/
|
*/
|
||||||
WeaponRestrictGetIndex(const String:weapon[])
|
WeaponRestrictGetIndex(const String:weapon[])
|
||||||
{
|
{
|
||||||
new size = GetArraySize(gRestrictedWeapons);
|
new size = GetArraySize(gRestrictedWeapons);
|
||||||
for (new x = 0; x < size; x++)
|
for (new x = 0; x < size; x++)
|
||||||
{
|
{
|
||||||
decl String:restrictedweapon[32];
|
decl String:restrictedweapon[WEAPONS_MAX_LENGTH];
|
||||||
GetArrayString(gRestrictedWeapons, x, restrictedweapon, sizeof(restrictedweapon));
|
GetArrayString(gRestrictedWeapons, x, restrictedweapon, sizeof(restrictedweapon));
|
||||||
|
|
||||||
if (StrEqual(weapon, restrictedweapon, false))
|
if (StrEqual(weapon, restrictedweapon, false))
|
||||||
@ -282,7 +339,7 @@ WeaponRestrictGetIndex(const String:weapon[])
|
|||||||
*
|
*
|
||||||
* @param groupname Name of the group to check.
|
* @param groupname Name of the group to check.
|
||||||
* @return True if it's a group, false if not.
|
* @return True if it's a group, false if not.
|
||||||
*/
|
*/
|
||||||
bool:WeaponRestrictIsCustomGroup(const String:groupname[])
|
bool:WeaponRestrictIsCustomGroup(const String:groupname[])
|
||||||
{
|
{
|
||||||
// Reset the traversal stack
|
// Reset the traversal stack
|
||||||
@ -300,7 +357,7 @@ bool:WeaponRestrictIsCustomGroup(const String:groupname[])
|
|||||||
* @param weaponlist Variable to store weapon list string in.
|
* @param weaponlist Variable to store weapon list string in.
|
||||||
* @param maxlen Maximum length of the weapon list, the rest is truncated.
|
* @param maxlen Maximum length of the weapon list, the rest is truncated.
|
||||||
* @param separator Separator character between weapon names.
|
* @param separator Separator character between weapon names.
|
||||||
*/
|
*/
|
||||||
WeaponRestrictGetWeaponList(const String:groupname[], String:weaponlist[], maxlen, const String:separator[])
|
WeaponRestrictGetWeaponList(const String:groupname[], String:weaponlist[], maxlen, const String:separator[])
|
||||||
{
|
{
|
||||||
KvRewind(kvWeaponGroups);
|
KvRewind(kvWeaponGroups);
|
||||||
@ -308,7 +365,7 @@ WeaponRestrictGetWeaponList(const String:groupname[], String:weaponlist[], maxle
|
|||||||
|
|
||||||
if (KvGotoFirstSubKey(kvWeaponGroups))
|
if (KvGotoFirstSubKey(kvWeaponGroups))
|
||||||
{
|
{
|
||||||
decl String:groupweapon[32];
|
decl String:groupweapon[WEAPONS_MAX_LENGTH];
|
||||||
|
|
||||||
strcopy(weaponlist, maxlen, "");
|
strcopy(weaponlist, maxlen, "");
|
||||||
|
|
||||||
@ -316,6 +373,12 @@ WeaponRestrictGetWeaponList(const String:groupname[], String:weaponlist[], maxle
|
|||||||
{
|
{
|
||||||
KvGetSectionName(kvWeaponGroups, groupweapon, sizeof(groupweapon));
|
KvGetSectionName(kvWeaponGroups, groupweapon, sizeof(groupweapon));
|
||||||
|
|
||||||
|
// If weapon is invalid, then skip
|
||||||
|
if (!WeaponsIsValidWeapon(groupweapon))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!weaponlist[0])
|
if (!weaponlist[0])
|
||||||
{
|
{
|
||||||
strcopy(weaponlist, maxlen, groupweapon);
|
strcopy(weaponlist, maxlen, groupweapon);
|
||||||
@ -333,7 +396,7 @@ WeaponRestrictGetWeaponList(const String:groupname[], String:weaponlist[], maxle
|
|||||||
* @param client The client index.
|
* @param client The client index.
|
||||||
* @param weapon The weapon index.
|
* @param weapon The weapon index.
|
||||||
* @return 0 to block weapon pickup, Hacks_Continue to allow.
|
* @return 0 to block weapon pickup, Hacks_Continue to allow.
|
||||||
*/
|
*/
|
||||||
public WeaponRestrictCanUse(client, weapon, dummy1, dummy2, dummy3, dummy4)
|
public WeaponRestrictCanUse(client, weapon, dummy1, dummy2, dummy3, dummy4)
|
||||||
{
|
{
|
||||||
// If plugin is disabled then stop
|
// If plugin is disabled then stop
|
||||||
@ -343,7 +406,7 @@ public WeaponRestrictCanUse(client, weapon, dummy1, dummy2, dummy3, dummy4)
|
|||||||
return Hacks_Continue;
|
return Hacks_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
new String:weaponname[32];
|
new String:weaponname[WEAPONS_MAX_LENGTH];
|
||||||
GetEdictClassname(weapon, weaponname, sizeof(weaponname));
|
GetEdictClassname(weapon, weaponname, sizeof(weaponname));
|
||||||
|
|
||||||
// Strip "weapon_" from entity name
|
// Strip "weapon_" from entity name
|
||||||
|
186
src/zr/weapons/weapons.inc
Normal file
186
src/zr/weapons/weapons.inc
Normal file
@ -0,0 +1,186 @@
|
|||||||
|
/**
|
||||||
|
* ====================
|
||||||
|
* Zombie:Reloaded
|
||||||
|
* File: weapons.inc
|
||||||
|
* Author: Greyscale
|
||||||
|
* ====================
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle to store trie weapon data
|
||||||
|
*/
|
||||||
|
new Handle:trieWeapons = INVALID_HANDLE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Maximum length of a weapon name string
|
||||||
|
*/
|
||||||
|
#define WEAPONS_MAX_LENGTH 32
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @section Config array indexes.
|
||||||
|
*/
|
||||||
|
#define WEAPON_RESTRICT 0
|
||||||
|
#define WEAPON_MENU 1
|
||||||
|
/**
|
||||||
|
* @endsection
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array to store keyvalue data.
|
||||||
|
*/
|
||||||
|
new Handle:kvWeapons = INVALID_HANDLE;
|
||||||
|
|
||||||
|
#include "zr/weapons/restrict"
|
||||||
|
#include "zr/weapons/markethandler"
|
||||||
|
#include "zr/weapons/menu_weapons"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads weapon data from file.
|
||||||
|
*/
|
||||||
|
WeaponsOnMapStart()
|
||||||
|
{
|
||||||
|
// Destroy trie data if populated
|
||||||
|
if (trieWeapons != INVALID_HANDLE)
|
||||||
|
{
|
||||||
|
CloseHandle(trieWeapons);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create trie to store weapon data
|
||||||
|
trieWeapons = CreateTrie();
|
||||||
|
|
||||||
|
// Load weapon data
|
||||||
|
if (kvWeapons != INVALID_HANDLE)
|
||||||
|
{
|
||||||
|
CloseHandle(kvWeapons);
|
||||||
|
}
|
||||||
|
|
||||||
|
kvWeapons = CreateKeyValues("weapons");
|
||||||
|
|
||||||
|
decl String:path[PLATFORM_MAX_PATH];
|
||||||
|
BuildPath(Path_SM, path, sizeof(path), "configs/zr/weapons/weapons.txt");
|
||||||
|
|
||||||
|
// If file isn't found, stop plugin
|
||||||
|
if (!FileToKeyValues(kvWeapons, path))
|
||||||
|
{
|
||||||
|
SetFailState("\"%s\" missing from server", path);
|
||||||
|
}
|
||||||
|
|
||||||
|
KvRewind(kvWeapons);
|
||||||
|
if (KvGotoFirstSubKey(kvWeapons))
|
||||||
|
{
|
||||||
|
decl String:weapon[WEAPONS_MAX_LENGTH];
|
||||||
|
decl String:restrict[8];
|
||||||
|
decl String:menu[8];
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
KvGetSectionName(kvWeapons, weapon, sizeof(weapon));
|
||||||
|
KvGetString(kvWeapons, "restrict", restrict, sizeof(restrict), "no");
|
||||||
|
KvGetString(kvWeapons, "menu", menu, sizeof(menu), "yes");
|
||||||
|
|
||||||
|
new bool:config[2];
|
||||||
|
config[WEAPON_RESTRICT] = ConfigOptionToBool(restrict);
|
||||||
|
config[WEAPON_MENU] = ConfigOptionToBool(menu);
|
||||||
|
|
||||||
|
SetTrieArray(trieWeapons, weapon, config, sizeof(config), false);
|
||||||
|
|
||||||
|
} while (KvGotoNextKey(kvWeapons));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Weapon restrict
|
||||||
|
WeaponRestrictOnMapStart();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an array of all listed weapons in weapons.txt.
|
||||||
|
* @param arrayWeapons The handle of the array, don't forget to call CloseHandle
|
||||||
|
* on it when finished!
|
||||||
|
* @return The size of the array.
|
||||||
|
*/
|
||||||
|
WeaponsCreateWeaponArray(&Handle:arrayWeapons, maxlen = WEAPONS_MAX_LENGTH)
|
||||||
|
{
|
||||||
|
arrayWeapons = CreateArray(maxlen);
|
||||||
|
new count = 0;
|
||||||
|
|
||||||
|
KvRewind(kvWeapons);
|
||||||
|
if (KvGotoFirstSubKey(kvWeapons))
|
||||||
|
{
|
||||||
|
decl String:weapon[maxlen];
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
KvGetSectionName(kvWeapons, weapon, maxlen);
|
||||||
|
|
||||||
|
PushArrayString(arrayWeapons, weapon);
|
||||||
|
count++;
|
||||||
|
} while (KvGotoNextKey(kvWeapons));
|
||||||
|
}
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an array of all listed weapon groups in weapongroups.txt.
|
||||||
|
* @param arrayWeaponGroups The handle of the array, don't forget to call CloseHandle
|
||||||
|
* on it when finished!
|
||||||
|
* @return The size of the array.
|
||||||
|
*/
|
||||||
|
WeaponsCreateWeaponGroupArray(&Handle:arrayWeaponGroups, maxlen = WEAPONS_MAX_LENGTH)
|
||||||
|
{
|
||||||
|
arrayWeaponGroups = CreateArray(maxlen);
|
||||||
|
new count = 0;
|
||||||
|
|
||||||
|
KvRewind(kvWeaponGroups);
|
||||||
|
if (KvGotoFirstSubKey(kvWeaponGroups))
|
||||||
|
{
|
||||||
|
decl String:weapongroup[maxlen];
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
KvGetSectionName(kvWeaponGroups, weapongroup, maxlen);
|
||||||
|
|
||||||
|
PushArrayString(arrayWeaponGroups, weapongroup);
|
||||||
|
count++;
|
||||||
|
} while (KvGotoNextKey(kvWeaponGroups));
|
||||||
|
}
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a weapon is valid (aka listed in weapons.txt)
|
||||||
|
* @param weapon The weapon name.
|
||||||
|
* @return Returns true if valid, false it not.
|
||||||
|
*/
|
||||||
|
bool:WeaponsIsValidWeapon(const String:weapon[])
|
||||||
|
{
|
||||||
|
new bool:config[2];
|
||||||
|
|
||||||
|
return GetTrieArray(trieWeapons, weapon, config, sizeof(config));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a weapon is restricted by default.
|
||||||
|
* @param weapon The weapon name.
|
||||||
|
* @return Returns true if restricted, false it not.
|
||||||
|
*/
|
||||||
|
bool:WeaponsIsWeaponRestrict(const String:weapon[])
|
||||||
|
{
|
||||||
|
new bool:config[2];
|
||||||
|
GetTrieArray(trieWeapons, weapon, config, sizeof(config));
|
||||||
|
|
||||||
|
return config[WEAPON_RESTRICT];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a weapon restriction can be toggled by the admin menu.
|
||||||
|
* @param weapon The weapon name.
|
||||||
|
* @return Returns true if restricted, false it not.
|
||||||
|
*/
|
||||||
|
bool:WeaponsIsWeaponMenu(const String:weapon[])
|
||||||
|
{
|
||||||
|
new bool:config[2];
|
||||||
|
GetTrieArray(trieWeapons, weapon, config, sizeof(config));
|
||||||
|
|
||||||
|
return config[WEAPON_MENU];
|
||||||
|
}
|
@ -18,11 +18,11 @@ bool:ZRAdminMenu(client)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
new Handle:menu_admin = CreateMenu(ZRAdminMenuHandle);
|
new Handle:menu_zadmin = CreateMenu(ZRAdminMenuHandle);
|
||||||
|
|
||||||
SetGlobalTransTarget(client);
|
SetGlobalTransTarget(client);
|
||||||
|
|
||||||
SetMenuTitle(menu_admin, "%t\n ", "!zadmin main title");
|
SetMenuTitle(menu_zadmin, "%t\n ", "!zadmin main title");
|
||||||
|
|
||||||
decl String:knockbackm[64];
|
decl String:knockbackm[64];
|
||||||
decl String:knockback[64];
|
decl String:knockback[64];
|
||||||
@ -30,8 +30,7 @@ bool:ZRAdminMenu(client)
|
|||||||
decl String:infect[64];
|
decl String:infect[64];
|
||||||
decl String:zspawn[64];
|
decl String:zspawn[64];
|
||||||
decl String:ztele[64];
|
decl String:ztele[64];
|
||||||
decl String:restrict[64];
|
decl String:weapons[64];
|
||||||
decl String:unrestrict[64];
|
|
||||||
decl String:logflags[64];
|
decl String:logflags[64];
|
||||||
|
|
||||||
Format(knockbackm, sizeof(knockbackm), "%t", "!zadmin main knockbackm");
|
Format(knockbackm, sizeof(knockbackm), "%t", "!zadmin main knockbackm");
|
||||||
@ -40,23 +39,21 @@ bool:ZRAdminMenu(client)
|
|||||||
Format(infect, sizeof(infect), "%t", "!zadmin main infect");
|
Format(infect, sizeof(infect), "%t", "!zadmin main infect");
|
||||||
Format(zspawn, sizeof(zspawn), "%t", "!zadmin main spawn");
|
Format(zspawn, sizeof(zspawn), "%t", "!zadmin main spawn");
|
||||||
Format(ztele, sizeof(ztele), "%t", "!zadmin main tele");
|
Format(ztele, sizeof(ztele), "%t", "!zadmin main tele");
|
||||||
Format(restrict, sizeof(restrict), "%t", "!zadmin main restrict");
|
Format(weapons, sizeof(weapons), "%t", "!zadmin main weapons");
|
||||||
Format(unrestrict, sizeof(unrestrict), "%t", "!zadmin main unrestrict");
|
|
||||||
Format(logflags, sizeof(logflags), "%t", "!zadmin main logflags");
|
Format(logflags, sizeof(logflags), "%t", "!zadmin main logflags");
|
||||||
|
|
||||||
AddMenuItem(menu_admin, "knockbackm", knockbackm);
|
AddMenuItem(menu_zadmin, "knockbackm", knockbackm);
|
||||||
AddMenuItem(menu_admin, "knockback", knockback);
|
AddMenuItem(menu_zadmin, "knockback", knockback);
|
||||||
AddMenuItem(menu_admin, "nvgs", nvgs);
|
AddMenuItem(menu_zadmin, "nvgs", nvgs);
|
||||||
AddMenuItem(menu_admin, "infect", infect);
|
AddMenuItem(menu_zadmin, "infect", infect);
|
||||||
AddMenuItem(menu_admin, "zspawn", zspawn);
|
AddMenuItem(menu_zadmin, "zspawn", zspawn);
|
||||||
AddMenuItem(menu_admin, "ztele", ztele);
|
AddMenuItem(menu_zadmin, "ztele", ztele);
|
||||||
AddMenuItem(menu_admin, "restrict", restrict, ITEMDRAW_DISABLED);
|
AddMenuItem(menu_zadmin, "weapons", weapons);
|
||||||
AddMenuItem(menu_admin, "unrestrict", unrestrict, ITEMDRAW_DISABLED);
|
AddMenuItem(menu_zadmin, "logflags", logflags);
|
||||||
AddMenuItem(menu_admin, "logflags", logflags);
|
|
||||||
|
|
||||||
SetMenuExitBackButton(menu_admin, true);
|
SetMenuExitBackButton(menu_zadmin, true);
|
||||||
|
|
||||||
DisplayMenu(menu_admin, client, MENU_TIME_FOREVER);
|
DisplayMenu(menu_zadmin, client, MENU_TIME_FOREVER);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -93,13 +90,9 @@ public ZRAdminMenuHandle(Handle:menu_admin, MenuAction:action, client, slot)
|
|||||||
}
|
}
|
||||||
case 6:
|
case 6:
|
||||||
{
|
{
|
||||||
// restrict
|
WeaponsMenuMain(client);
|
||||||
}
|
}
|
||||||
case 7:
|
case 7:
|
||||||
{
|
|
||||||
// unrestrict
|
|
||||||
}
|
|
||||||
case 8:
|
|
||||||
{
|
{
|
||||||
ZRLogFlagsMenu(client);
|
ZRLogFlagsMenu(client);
|
||||||
}
|
}
|
||||||
|
@ -63,8 +63,8 @@ new bool:motherZombie[MAXPLAYERS+1];
|
|||||||
new bool:gZombie[MAXPLAYERS+1];
|
new bool:gZombie[MAXPLAYERS+1];
|
||||||
new bool:gBlockMotherInfect[MAXPLAYERS+1];
|
new bool:gBlockMotherInfect[MAXPLAYERS+1];
|
||||||
new bool:bZVision[MAXPLAYERS+1];
|
new bool:bZVision[MAXPLAYERS+1];
|
||||||
//new bool:bZVisionOn[MAXPLAYERS+1];
|
new bool:bZVisionOn[MAXPLAYERS+1];
|
||||||
//new String:ZVisionOverlay[MAXPLAYERS+1][PLATFORM_MAX_PATH];
|
new String:ZVisionOverlay[MAXPLAYERS+1][PLATFORM_MAX_PATH];
|
||||||
new bool:dispHP[MAXPLAYERS+1];
|
new bool:dispHP[MAXPLAYERS+1];
|
||||||
new bool:pProtect[MAXPLAYERS+1];
|
new bool:pProtect[MAXPLAYERS+1];
|
||||||
new bool:gKilledByWorld[MAXPLAYERS+1] = {false, ...};
|
new bool:gKilledByWorld[MAXPLAYERS+1] = {false, ...};
|
||||||
@ -106,6 +106,16 @@ new Handle:tHandles[MAXPLAYERS+1][MAXTIMERS];
|
|||||||
|
|
||||||
new QueryCookie:mat_dxlevel;
|
new QueryCookie:mat_dxlevel;
|
||||||
|
|
||||||
|
bool:ConfigOptionToBool(const String:option[])
|
||||||
|
{
|
||||||
|
if (StrEqual(option, "yes", false))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
FindClientDXLevel(client)
|
FindClientDXLevel(client)
|
||||||
{
|
{
|
||||||
if (IsFakeClient(client))
|
if (IsFakeClient(client))
|
||||||
@ -211,6 +221,18 @@ bool:IsPlayerInList(client)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool:IntToBool(intval)
|
||||||
|
{
|
||||||
|
if (intval == 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool:IsClientPlayer(client)
|
bool:IsClientPlayer(client)
|
||||||
{
|
{
|
||||||
if (client > 0 && client <= maxclients)
|
if (client > 0 && client <= maxclients)
|
||||||
|
Loading…
Reference in New Issue
Block a user