Uploaded weapongroups.txt config file
This commit is contained in:
parent
7c397715c4
commit
54931dfc82
86
cstrike/addons/sourcemod/configs/zr/weapongroups.txt
Normal file
86
cstrike/addons/sourcemod/configs/zr/weapongroups.txt
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
// 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" {}
|
||||||
|
}
|
||||||
|
}
|
@ -34,7 +34,7 @@
|
|||||||
#include "zr/menu"
|
#include "zr/menu"
|
||||||
#include "zr/sayhooks"
|
#include "zr/sayhooks"
|
||||||
#include "zr/zadmin"
|
#include "zr/zadmin"
|
||||||
#include "zr/weaponrestrict"
|
#include "zr/weapons/restrict"
|
||||||
#include "zr/damagecontrol"
|
#include "zr/damagecontrol"
|
||||||
#include "zr/commands"
|
#include "zr/commands"
|
||||||
#include "zr/event"
|
#include "zr/event"
|
||||||
@ -74,7 +74,7 @@ public OnPluginStart()
|
|||||||
HookCommands();
|
HookCommands();
|
||||||
FindOffsets();
|
FindOffsets();
|
||||||
SetupGameData();
|
SetupGameData();
|
||||||
InitWeaponRestrict();
|
WeaponRestrictInit();
|
||||||
InitDmgControl();
|
InitDmgControl();
|
||||||
|
|
||||||
// ======================================================================
|
// ======================================================================
|
||||||
@ -116,6 +116,9 @@ public OnMapStart()
|
|||||||
LoadModelData();
|
LoadModelData();
|
||||||
LoadDownloadData();
|
LoadDownloadData();
|
||||||
|
|
||||||
|
// Weapon restrict
|
||||||
|
WeaponRestrictMapStart();
|
||||||
|
|
||||||
new i;
|
new i;
|
||||||
new classindex = GetDefaultClassIndex();
|
new classindex = GetDefaultClassIndex();
|
||||||
for (i = 1; i <= MAXPLAYERS; i++)
|
for (i = 1; i <= MAXPLAYERS; i++)
|
||||||
@ -136,7 +139,6 @@ public OnConfigsExecuted()
|
|||||||
FindMapSky();
|
FindMapSky();
|
||||||
|
|
||||||
LoadClassData();
|
LoadClassData();
|
||||||
ClassLoad();
|
|
||||||
LoadAmbienceData();
|
LoadAmbienceData();
|
||||||
|
|
||||||
decl String:mapconfig[PLATFORM_MAX_PATH];
|
decl String:mapconfig[PLATFORM_MAX_PATH];
|
||||||
@ -165,7 +167,9 @@ 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;
|
||||||
|
|
||||||
ClientHookUse(client);
|
// Weapon restrict
|
||||||
|
WeaponRestrictClientInit(client);
|
||||||
|
|
||||||
ClientHookAttack(client);
|
ClientHookAttack(client);
|
||||||
|
|
||||||
FindClientDXLevel(client);
|
FindClientDXLevel(client);
|
||||||
@ -181,7 +185,9 @@ public OnClientPutInServer(client)
|
|||||||
|
|
||||||
public OnClientDisconnect(client)
|
public OnClientDisconnect(client)
|
||||||
{
|
{
|
||||||
ClientUnHookUse(client);
|
// Weapon restrict
|
||||||
|
WeaponRestrictClientDisconnect(client);
|
||||||
|
|
||||||
ClientUnHookAttack(client);
|
ClientUnHookAttack(client);
|
||||||
|
|
||||||
PlayerLeft(client);
|
PlayerLeft(client);
|
||||||
@ -202,8 +208,6 @@ public OnClientDisconnect(client)
|
|||||||
|
|
||||||
MapChangeCleanup()
|
MapChangeCleanup()
|
||||||
{
|
{
|
||||||
ClearArray(restrictedWeapons);
|
|
||||||
|
|
||||||
tRound = INVALID_HANDLE;
|
tRound = INVALID_HANDLE;
|
||||||
tInfect = INVALID_HANDLE;
|
tInfect = INVALID_HANDLE;
|
||||||
AmbienceStopAll();
|
AmbienceStopAll();
|
||||||
|
@ -16,8 +16,9 @@ CreateCommands()
|
|||||||
RegAdminCmd("zr_tele_loc", Command_TeleportToLocation, ADMFLAG_GENERIC, "Teleports you or a player to the saved location. Usage: zr_tele_loc [#userid|name]");
|
RegAdminCmd("zr_tele_loc", Command_TeleportToLocation, ADMFLAG_GENERIC, "Teleports you or a player to the saved location. Usage: zr_tele_loc [#userid|name]");
|
||||||
RegAdminCmd("zr_tele_abort", Command_TeleportAbort, ADMFLAG_GENERIC, "Aborts a teleportation or cooldown on a client. Usage: zr_tele_abort <target>");
|
RegAdminCmd("zr_tele_abort", Command_TeleportAbort, ADMFLAG_GENERIC, "Aborts a teleportation or cooldown on a client. Usage: zr_tele_abort <target>");
|
||||||
|
|
||||||
|
// Weapon restrict commands
|
||||||
RegAdminCmd("zr_restrict", Command_Restrict, ADMFLAG_GENERIC, "Restrict a specified weapon");
|
RegAdminCmd("zr_restrict", Command_Restrict, ADMFLAG_GENERIC, "Restrict a specified weapon");
|
||||||
RegAdminCmd("zr_unrestrict", Command_UnRestrict, ADMFLAG_GENERIC, "Unrestrict a specified weapon");
|
RegAdminCmd("zr_unrestrict", Command_Unrestrict, ADMFLAG_GENERIC, "Unrestrict a specified weapon");
|
||||||
|
|
||||||
RegAdminCmd("zr_set_class_knockback", Command_SetClassKnockback, ADMFLAG_GENERIC, "Sets the knockback to the specified class. Usage: zr_set_class_knockback <class name> <value>");
|
RegAdminCmd("zr_set_class_knockback", Command_SetClassKnockback, ADMFLAG_GENERIC, "Sets the knockback to the specified class. Usage: zr_set_class_knockback <class name> <value>");
|
||||||
RegAdminCmd("zr_get_class_knockback", Command_GetClassKnockback, ADMFLAG_GENERIC, "Gets the knockback to the specified class. Usage: zr_get_class_knockback <class name>");
|
RegAdminCmd("zr_get_class_knockback", Command_GetClassKnockback, ADMFLAG_GENERIC, "Gets the knockback to the specified class. Usage: zr_get_class_knockback <class name>");
|
||||||
@ -45,18 +46,19 @@ public Action:Command_Infect(client, argc)
|
|||||||
GetCmdArg(1, arg1, sizeof(arg1));
|
GetCmdArg(1, arg1, sizeof(arg1));
|
||||||
|
|
||||||
decl String:target_name_list[MAX_TARGET_LENGTH];
|
decl String:target_name_list[MAX_TARGET_LENGTH];
|
||||||
decl String:target_name[64];
|
|
||||||
decl String:client_name[64];
|
|
||||||
new targets[MAXPLAYERS];
|
new targets[MAXPLAYERS];
|
||||||
new bool:tn_is_ml;
|
new bool:tn_is_ml;
|
||||||
|
|
||||||
new tcount = ProcessTargetString(arg1, client, targets, MAXPLAYERS, COMMAND_FILTER_ALIVE, target_name_list, sizeof(target_name), tn_is_ml);
|
new tcount = ProcessTargetString(arg1, client, targets, MAXPLAYERS, COMMAND_FILTER_ALIVE, target_name_list, sizeof(target_name_list), tn_is_ml);
|
||||||
if (tcount <= 0)
|
if (tcount <= 0)
|
||||||
{
|
{
|
||||||
ReplyToTargetError(client, tcount);
|
ReplyToTargetError(client, tcount);
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
decl String:target_name[64];
|
||||||
|
decl String:client_name[64];
|
||||||
|
|
||||||
if (client > 0)
|
if (client > 0)
|
||||||
{
|
{
|
||||||
GetClientName(client, client_name, sizeof(client_name));
|
GetClientName(client, client_name, sizeof(client_name));
|
||||||
@ -82,8 +84,6 @@ public Action:Command_Infect(client, argc)
|
|||||||
public Action:Command_Respawn(client, argc)
|
public Action:Command_Respawn(client, argc)
|
||||||
{
|
{
|
||||||
new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]);
|
new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]);
|
||||||
decl String:client_name[64];
|
|
||||||
decl String:target_name[64];
|
|
||||||
if (argc < 1 || !enabled)
|
if (argc < 1 || !enabled)
|
||||||
{
|
{
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
@ -96,13 +96,16 @@ public Action:Command_Respawn(client, argc)
|
|||||||
new targets[MAXPLAYERS];
|
new targets[MAXPLAYERS];
|
||||||
new bool:tn_is_ml;
|
new bool:tn_is_ml;
|
||||||
|
|
||||||
new tcount = ProcessTargetString(arg1, client, targets, MAXPLAYERS, COMMAND_FILTER_DEAD, target_name_list, sizeof(target_name), tn_is_ml);
|
new tcount = ProcessTargetString(arg1, client, targets, MAXPLAYERS, COMMAND_FILTER_DEAD, target_name_list, sizeof(target_name_list), tn_is_ml);
|
||||||
if (tcount <= 0)
|
if (tcount <= 0)
|
||||||
{
|
{
|
||||||
ReplyToTargetError(client, tcount);
|
ReplyToTargetError(client, tcount);
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
decl String:client_name[64];
|
||||||
|
decl String:target_name[64];
|
||||||
|
|
||||||
if (client > 0)
|
if (client > 0)
|
||||||
{
|
{
|
||||||
GetClientName(client, client_name, sizeof(client_name));
|
GetClientName(client, client_name, sizeof(client_name));
|
||||||
@ -123,6 +126,7 @@ public Action:Command_Respawn(client, argc)
|
|||||||
GetClientName(targets[x], target_name, sizeof(target_name));
|
GetClientName(targets[x], target_name, sizeof(target_name));
|
||||||
ZR_LogMessageFormatted(targets[x], "admin commands", "spawn", "\"%s\" spawned player \"%s\".", true, client_name, target_name);
|
ZR_LogMessageFormatted(targets[x], "admin commands", "spawn", "\"%s\" spawned player \"%s\".", true, client_name, target_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
RespawnPlayer(targets[x]);
|
RespawnPlayer(targets[x]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -130,65 +134,53 @@ public Action:Command_Respawn(client, argc)
|
|||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param client The client index.
|
||||||
|
* @param argc Argument count.
|
||||||
|
*/
|
||||||
public Action:Command_Restrict(client, argc)
|
public Action:Command_Restrict(client, argc)
|
||||||
{
|
{
|
||||||
|
// If plugin is disabled then stop
|
||||||
new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]);
|
new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]);
|
||||||
decl String:client_name[64];
|
|
||||||
if (argc < 1 || !enabled)
|
if (argc < 1 || !enabled)
|
||||||
{
|
{
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// arg1 = weapon being restricted
|
||||||
decl String:arg1[32];
|
decl String:arg1[32];
|
||||||
GetCmdArg(1, arg1, sizeof(arg1));
|
GetCmdArg(1, arg1, sizeof(arg1));
|
||||||
|
|
||||||
new WepRestrictQuery:output = RestrictWeapon(arg1);
|
// Strip "weapon_" from entity name
|
||||||
|
ReplaceString(arg1, sizeof(arg1), "weapon_", "");
|
||||||
|
|
||||||
if (output == Existing)
|
new WpnRestrictQuery:output = WeaponRestrictRestrict(arg1);
|
||||||
{
|
|
||||||
ZR_ReplyToCommand(client, "Weapon already restricted", arg1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (LogFlagCheck(LOG_GAME_EVENTS, LOG_MODULE_COMMANDS))
|
|
||||||
{
|
|
||||||
if (client > 0)
|
|
||||||
{
|
|
||||||
GetClientName(client, client_name, sizeof(client_name));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
client_name = "Console\0";
|
|
||||||
}
|
|
||||||
ZR_LogMessageFormatted(client, "admin commands", "weapon restict", "\"%s\" restricted weapon \"%s\".", true, client_name, arg1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Plugin_Handled;
|
switch(output)
|
||||||
}
|
|
||||||
|
|
||||||
public Action:Command_UnRestrict(client, argc)
|
|
||||||
{
|
{
|
||||||
new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]);
|
case Successful_Weapon:
|
||||||
decl String:client_name[64];
|
|
||||||
if (argc < 1 || !enabled)
|
|
||||||
{
|
{
|
||||||
return Plugin_Handled;
|
ZR_ReplyToCommand(client, "Restrict weapon", arg1);
|
||||||
}
|
}
|
||||||
|
case Successful_Group:
|
||||||
|
{
|
||||||
|
decl String:weaponlist[128];
|
||||||
|
WeaponRestrictGetWeaponList(arg1, weaponlist, sizeof(weaponlist), ", ");
|
||||||
|
|
||||||
decl String:arg1[32];
|
ZR_ReplyToCommand(client, "Restrict custom weapon group", arg1, weaponlist);
|
||||||
GetCmdArg(1, arg1, sizeof(arg1));
|
}
|
||||||
|
case Invalid:
|
||||||
new WepRestrictQuery:output = UnRestrictWeapon(arg1);
|
|
||||||
|
|
||||||
if (output == Invalid)
|
|
||||||
{
|
{
|
||||||
ZR_ReplyToCommand(client, "Weapon invalid", arg1);
|
ZR_ReplyToCommand(client, "Weapon invalid", arg1);
|
||||||
|
|
||||||
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
|
||||||
if (LogFlagCheck(LOG_GAME_EVENTS, LOG_MODULE_COMMANDS))
|
if (LogFlagCheck(LOG_GAME_EVENTS, LOG_MODULE_COMMANDS))
|
||||||
{
|
{
|
||||||
|
decl String:client_name[64];
|
||||||
|
|
||||||
if (client > 0)
|
if (client > 0)
|
||||||
{
|
{
|
||||||
GetClientName(client, client_name, sizeof(client_name));
|
GetClientName(client, client_name, sizeof(client_name));
|
||||||
@ -197,8 +189,64 @@ public Action:Command_UnRestrict(client, argc)
|
|||||||
{
|
{
|
||||||
client_name = "Console\0";
|
client_name = "Console\0";
|
||||||
}
|
}
|
||||||
ZR_LogMessageFormatted(client, "admin commands", "weapon restictions", "\"%s\" removed weapon restriction on \"%s\".", true, client_name, arg1);
|
ZR_LogMessageFormatted(client, "admin commands", "weapon restict", "\"%s\" restricted weapon (group): \"%s\".", true, client_name, arg1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Action:Command_Unrestrict(client, argc)
|
||||||
|
{
|
||||||
|
// If plugin is disabled then stop
|
||||||
|
new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]);
|
||||||
|
if (argc < 1 || !enabled)
|
||||||
|
{
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
|
||||||
|
// arg1 = weapon being restricted
|
||||||
|
decl String:arg1[32];
|
||||||
|
GetCmdArg(1, arg1, sizeof(arg1));
|
||||||
|
|
||||||
|
// Strip "weapon_" from entity name
|
||||||
|
ReplaceString(arg1, sizeof(arg1), "weapon_", "");
|
||||||
|
|
||||||
|
new WpnRestrictQuery:output = WeaponRestrictUnrestrict(arg1);
|
||||||
|
|
||||||
|
switch(output)
|
||||||
|
{
|
||||||
|
case Successful_Weapon:
|
||||||
|
{
|
||||||
|
ZR_ReplyToCommand(client, "Unrestrict weapon", arg1);
|
||||||
|
}
|
||||||
|
case Successful_Group:
|
||||||
|
{
|
||||||
|
decl String:weaponlist[128];
|
||||||
|
WeaponRestrictGetWeaponList(arg1, weaponlist, sizeof(weaponlist), ", ");
|
||||||
|
|
||||||
|
ZR_ReplyToCommand(client, "Unrestrict custom weapon group", arg1, weaponlist);
|
||||||
|
}
|
||||||
|
case Invalid:
|
||||||
|
{
|
||||||
|
ZR_ReplyToCommand(client, "Weapon invalid", arg1);
|
||||||
|
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (LogFlagCheck(LOG_GAME_EVENTS, LOG_MODULE_COMMANDS))
|
||||||
|
{
|
||||||
|
decl String:client_name[64];
|
||||||
|
|
||||||
|
if (client > 0)
|
||||||
|
{
|
||||||
|
GetClientName(client, client_name, sizeof(client_name));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
client_name = "Console\0";
|
||||||
|
}
|
||||||
|
ZR_LogMessageFormatted(client, "admin commands", "weapon restict", "\"%s\" unrestricted weapon (group): \"%s\".", true, client_name, arg1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
|
@ -167,7 +167,7 @@ public bool:Market_OnWeaponSelected(client, String:weaponid[])
|
|||||||
|
|
||||||
ReplaceString(weapon, sizeof(weapon), "weapon_", "");
|
ReplaceString(weapon, sizeof(weapon), "weapon_", "");
|
||||||
|
|
||||||
if (IsWeaponRestricted(weapon))
|
if (WeaponRestrictIsRestricted(weapon))
|
||||||
{
|
{
|
||||||
ZR_PrintToChat(client, "Weapon is restricted", weapon);
|
ZR_PrintToChat(client, "Weapon is restricted", weapon);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user