Uploaded weapongroups.txt config file

This commit is contained in:
Greyscale 2009-04-09 06:49:15 +02:00
parent 7c397715c4
commit 54931dfc82
4 changed files with 193 additions and 55 deletions

View 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" {}
}
}

View File

@ -34,7 +34,7 @@
#include "zr/menu"
#include "zr/sayhooks"
#include "zr/zadmin"
#include "zr/weaponrestrict"
#include "zr/weapons/restrict"
#include "zr/damagecontrol"
#include "zr/commands"
#include "zr/event"
@ -74,7 +74,7 @@ public OnPluginStart()
HookCommands();
FindOffsets();
SetupGameData();
InitWeaponRestrict();
WeaponRestrictInit();
InitDmgControl();
// ======================================================================
@ -116,6 +116,9 @@ public OnMapStart()
LoadModelData();
LoadDownloadData();
// Weapon restrict
WeaponRestrictMapStart();
new i;
new classindex = GetDefaultClassIndex();
for (i = 1; i <= MAXPLAYERS; i++)
@ -136,7 +139,6 @@ public OnConfigsExecuted()
FindMapSky();
LoadClassData();
ClassLoad();
LoadAmbienceData();
decl String:mapconfig[PLATFORM_MAX_PATH];
@ -165,7 +167,9 @@ public OnClientPutInServer(client)
new bool:zhp = GetConVarBool(gCvars[CVAR_ZHP_DEFAULT]);
dispHP[client] = zhp;
ClientHookUse(client);
// Weapon restrict
WeaponRestrictClientInit(client);
ClientHookAttack(client);
FindClientDXLevel(client);
@ -181,7 +185,9 @@ public OnClientPutInServer(client)
public OnClientDisconnect(client)
{
ClientUnHookUse(client);
// Weapon restrict
WeaponRestrictClientDisconnect(client);
ClientUnHookAttack(client);
PlayerLeft(client);
@ -202,8 +208,6 @@ public OnClientDisconnect(client)
MapChangeCleanup()
{
ClearArray(restrictedWeapons);
tRound = INVALID_HANDLE;
tInfect = INVALID_HANDLE;
AmbienceStopAll();
@ -245,4 +249,4 @@ ZREnd()
}
}
}
}
}

View File

@ -10,18 +10,19 @@ CreateCommands()
{
RegAdminCmd("zr_infect", Command_Infect, ADMFLAG_GENERIC, "Infects the specified player");
RegAdminCmd("zr_spawn", Command_Respawn, ADMFLAG_GENERIC, "Respawns the specified player following auto-respawning rules");
RegAdminCmd("zr_teleport", Command_Teleport, ADMFLAG_GENERIC, "Teleports one or more players to spawn. Usage: zr_teleport <target>");
RegAdminCmd("zr_tele_saveloc", Command_TeleSaveLocation, ADMFLAG_GENERIC, "Saves your or a players location to a buffer. Usage: zr_tele_saveloc [#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>");
// Weapon restrict commands
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_get_class_knockback", Command_GetClassKnockback, ADMFLAG_GENERIC, "Gets the knockback to the specified class. Usage: zr_get_class_knockback <class name>");
RegAdminCmd("zr_admin", Command_AdminMenu, ADMFLAG_GENERIC, "Displays the admin menu for Zombie: Reloaded.");
RegAdminCmd("zr_knockback_m", Command_KnockbackMMenu, ADMFLAG_GENERIC, "Displays the knockback multiplier menu.");
RegAdminCmd("zr_teleadmin", Command_TeleMenu, ADMFLAG_GENERIC, "Displays the teleport admin menu for Zombie: Reloaded.");
@ -45,18 +46,19 @@ public Action:Command_Infect(client, argc)
GetCmdArg(1, arg1, sizeof(arg1));
decl String:target_name_list[MAX_TARGET_LENGTH];
decl String:target_name[64];
decl String:client_name[64];
new targets[MAXPLAYERS];
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)
{
ReplyToTargetError(client, tcount);
return Plugin_Handled;
}
decl String:target_name[64];
decl String:client_name[64];
if (client > 0)
{
GetClientName(client, client_name, sizeof(client_name));
@ -82,8 +84,6 @@ public Action:Command_Infect(client, argc)
public Action:Command_Respawn(client, argc)
{
new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]);
decl String:client_name[64];
decl String:target_name[64];
if (argc < 1 || !enabled)
{
return Plugin_Handled;
@ -96,13 +96,16 @@ public Action:Command_Respawn(client, argc)
new targets[MAXPLAYERS];
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)
{
ReplyToTargetError(client, tcount);
return Plugin_Handled;
}
decl String:client_name[64];
decl String:target_name[64];
if (client > 0)
{
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));
ZR_LogMessageFormatted(targets[x], "admin commands", "spawn", "\"%s\" spawned player \"%s\".", true, client_name, target_name);
}
RespawnPlayer(targets[x]);
}
}
@ -130,75 +134,119 @@ public Action:Command_Respawn(client, argc)
return Plugin_Handled;
}
/**
* @param client The client index.
* @param argc Argument count.
*/
public Action:Command_Restrict(client, argc)
{
// If plugin is disabled then stop
new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]);
decl String:client_name[64];
if (argc < 1 || !enabled)
{
return Plugin_Handled;
}
// arg1 = weapon being restricted
decl String:arg1[32];
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);
switch(output)
{
ZR_ReplyToCommand(client, "Weapon already restricted", arg1);
}
else
{
if (LogFlagCheck(LOG_GAME_EVENTS, LOG_MODULE_COMMANDS))
case Successful_Weapon:
{
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);
ZR_ReplyToCommand(client, "Restrict weapon", arg1);
}
case Successful_Group:
{
decl String:weaponlist[128];
WeaponRestrictGetWeaponList(arg1, weaponlist, sizeof(weaponlist), ", ");
ZR_ReplyToCommand(client, "Restrict 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\" restricted weapon (group): \"%s\".", true, client_name, arg1);
}
return Plugin_Handled;
}
public Action:Command_UnRestrict(client, argc)
public Action:Command_Unrestrict(client, argc)
{
// If plugin is disabled then stop
new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]);
decl String:client_name[64];
if (argc < 1 || !enabled)
{
return Plugin_Handled;
}
// arg1 = weapon being restricted
decl String:arg1[32];
GetCmdArg(1, arg1, sizeof(arg1));
new WepRestrictQuery:output = UnRestrictWeapon(arg1);
// Strip "weapon_" from entity name
ReplaceString(arg1, sizeof(arg1), "weapon_", "");
if (output == Invalid)
new WpnRestrictQuery:output = WeaponRestrictUnrestrict(arg1);
switch(output)
{
ZR_ReplyToCommand(client, "Weapon invalid", arg1);
}
else
{
if (LogFlagCheck(LOG_GAME_EVENTS, LOG_MODULE_COMMANDS))
case Successful_Weapon:
{
if (client > 0)
{
GetClientName(client, client_name, sizeof(client_name));
}
else
{
client_name = "Console\0";
}
ZR_LogMessageFormatted(client, "admin commands", "weapon restictions", "\"%s\" removed weapon restriction on \"%s\".", true, client_name, arg1);
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;

View File

@ -167,7 +167,7 @@ public bool:Market_OnWeaponSelected(client, String:weaponid[])
ReplaceString(weapon, sizeof(weapon), "weapon_", "");
if (IsWeaponRestricted(weapon))
if (WeaponRestrictIsRestricted(weapon))
{
ZR_PrintToChat(client, "Weapon is restricted", weapon);