Merged heads 91e3906787a1 and 3598485c84df.

This commit is contained in:
richard 2009-03-31 00:59:50 +02:00
commit 2a24a8a204
13 changed files with 545 additions and 245 deletions

View File

@ -1,4 +1,4 @@
"Phrases" "Phrases"
{ {
// =========================== // ===========================
// Chat Messages // Chat Messages
@ -41,6 +41,12 @@
"ru" "Данная функция отключена." "ru" "Данная функция отключена."
} }
"Must be admin"
{
"en" "Can only be used by admins."
"ru" "Может быть использовано только, когда жив."
}
"Must be alive" "Must be alive"
{ {
"en" "Can only be used when alive." "en" "Can only be used when alive."
@ -81,7 +87,7 @@
"Spawn protection end" "Spawn protection end"
{ {
"en" "You are now susceptible the zombie infection." "en" "You are now susceptible to zombie infection."
"ru" "Теперь вы восприимчивы к зомби инфекции." "ru" "Теперь вы восприимчивы к зомби инфекции."
} }
@ -227,13 +233,13 @@
"Unfair camping" "Unfair camping"
{ {
"en" "This area is marked as unfair. Move, go through or die..." "en" "An admin has marked this area as unfair, please move along, or die."
} }
"Unfair camper slayed" "Unfair camper slayed"
{ {
"#format" "{1:s},{2:d}" "#format" "{1:s},{2:d}"
"en" "Killed %s due to camping in a unfair area (id: %d)." "en" "Player {1} has been slayed for camping in a restricted area. (ID: {2})"
} }
"DX90 not supported" "DX90 not supported"
@ -259,6 +265,11 @@
"ru" "ZMenu (!zmenu) - Показывает все ZR команды" "ru" "ZMenu (!zmenu) - Показывает все ZR команды"
} }
"!zmenu admin"
{
"en" "ZAdmin (!zadmin) - View Admin Menu"
}
"!zmenu class" "!zmenu class"
{ {
"en" "ZClass (!zclass) - Select a zombie class" "en" "ZClass (!zclass) - Select a zombie class"
@ -313,6 +324,161 @@
"ru" "Купить снова" "ru" "Купить снова"
} }
// ===========================
// ZAdmin Menu
// ===========================
"!zadmin main title"
{
"en" "ZAdmin Menu:"
}
"!zadmin main knockbackm"
{
"en" "Modify Knockback Multiplier"
}
"!zadmin main knockback"
{
"en" "Modify Class Knockback"
}
"!zadmin main nvgs"
{
"en" "Modify Nightvision Options"
}
"!zadmin main infect"
{
"en" "Infect a Player"
}
"!zadmin main spawn"
{
"en" "Spawn All Players"
}
"!zadmin main tele"
{
"en" "ZTele Commands"
}
"!zadmin main restrict"
{
"en" "Restrict Weapon"
}
"!zadmin main unrestrict"
{
"en" "Unrestrict Weapon"
}
"!zadmin main logflags"
{
"en" "Logging Flags"
}
"!zadmin class title"
{
"en" "Select Class to Modify:"
}
"!zadmin knockbackm title"
{
"#format" "{1:f}"
"en" "Modify Knockback Multiplier\nCurrent Knockback: {1}"
}
"!zadmin knockbackm increase"
{
"#format" "{1:s}"
"en" "Increase Knockback Multiplier (+{1})"
}
"!zadmin knockbackm decrease"
{
"#format" "{1:s}"
"en" "Decrease Knockback Multiplier (-{1})"
}
"!zadmin knockback title"
{
"#format" "{1:s},{2:f}"
"en" "Modify Knockback\nClass: {1}\nCurrent Knockback: {2}"
}
"!zadmin knockback increase"
{
"#format" "{1:s}"
"en" "Increase Knockback (+{1})"
}
"!zadmin knockback decrease"
{
"#format" "{1:s}"
"en" "Decrease Knockback (-{1})"
}
"!zadmin nvgs title"
{
"#format" "{1:d}"
"en" "Override NVG Cvar\nCurrent Setting: {1}"
}
"!zadmin nvgs decrease"
{
"en" "Decrease Knockback"
}
"!zadmin nvgs no override"
{
"en" "No Override/Class Specific"
}
"!zadmin nvgs disable"
{
"en" "Disable NVGs"
}
"!zadmin nvgs enable"
{
"en" "Enable NVGs"
}
"!zadmin infect title"
{
"en" "Choose a Player to Infect:"
}
"!zadmin ztele title"
{
"en" "ZTele Admin Menu:"
}
"!zadmin ztele spawn tele"
{
"en" "Teleport a Player to Spawn"
}
"!zadmin ztele abort"
{
"en" "Abort Teleport on a Player"
}
"!zadmin ztele save"
{
"en" "Save Teleport Location"
}
"!zadmin ztele tele"
{
"en" "Teleport Player to Saved Location"
}
"!zadmin log flags title"
{
"en" "Toggle Logging Flags:"
}
// =========================== // ===========================
// HudHints // HudHints
@ -325,6 +491,12 @@
"ru" "Здоровье: {1}" "ru" "Здоровье: {1}"
} }
"Spawn Protect"
{
"#format" "{1:d}"
"en" "Zombie protection ends in: {1} seconds."
}
// =========================== // ===========================
// Server Messages // Server Messages
// =========================== // ===========================

View File

@ -32,7 +32,7 @@
#include "zr/zombie" #include "zr/zombie"
#include "zr/menu" #include "zr/menu"
#include "zr/sayhooks" #include "zr/sayhooks"
#include "zr/zradmin" #include "zr/zadmin"
#include "zr/weaponrestrict" #include "zr/weaponrestrict"
#include "zr/damagecontrol" #include "zr/damagecontrol"
#include "zr/commands" #include "zr/commands"
@ -156,6 +156,7 @@ public OnClientPutInServer(client)
{ {
pClass[client] = GetDefaultClassIndex(); pClass[client] = GetDefaultClassIndex();
gBlockMotherInfect[client] = false; gBlockMotherInfect[client] = false;
gKilledByWorld[client] = false;
bZVision[client] = !IsFakeClient(client); bZVision[client] = !IsFakeClient(client);

View File

@ -289,7 +289,7 @@ public Action:Command_TeleMenu(client, argc)
{ {
if (IsClientPlayer(client)) if (IsClientPlayer(client))
{ {
ZRTeleMenu(client); ZRZTeleMenu(client);
} }
else else
{ {

View File

@ -26,6 +26,7 @@ enum ZRSettings
Handle:CVAR_ZOMBIE_JUMP_DISTANCE, Handle:CVAR_ZOMBIE_JUMP_DISTANCE,
Handle:CVAR_ZOMBIE_JUMP_HEIGHT, Handle:CVAR_ZOMBIE_JUMP_HEIGHT,
Handle:CVAR_ZOMBIE_KNOCKBACK, Handle:CVAR_ZOMBIE_KNOCKBACK,
Handle:CVAR_ZOMBIE_KNOCKBACK_GRENADE,
Handle:CVAR_ZOMBIE_NVGS, Handle:CVAR_ZOMBIE_NVGS,
Handle:CVAR_ZOMBIE_FOV, Handle:CVAR_ZOMBIE_FOV,
Handle:CVAR_ZOMBIE_REGEN, Handle:CVAR_ZOMBIE_REGEN,
@ -111,7 +112,8 @@ CreateCvars()
gCvars[CVAR_ZOMBIE_JUMP_DISTANCE] = CreateConVar("zr_zombie_jump_distance", "0.1", "How far the zombie jumps, (0: Regular jump distance)"); gCvars[CVAR_ZOMBIE_JUMP_DISTANCE] = CreateConVar("zr_zombie_jump_distance", "0.1", "How far the zombie jumps, (0: Regular jump distance)");
gCvars[CVAR_ZOMBIE_JUMP_HEIGHT] = CreateConVar("zr_zombie_jump_height", "10.0", "How high a zombie jumps (0: Regular jump height)"); gCvars[CVAR_ZOMBIE_JUMP_HEIGHT] = CreateConVar("zr_zombie_jump_height", "10.0", "How high a zombie jumps (0: Regular jump height)");
gCvars[CVAR_ZOMBIE_KNOCKBACK] = CreateConVar("zr_zombie_knockback", "1", "How far zombies are pushed back when shot. If classes are enabled: This one is a multiplier for class knockback values (1: Default)"); gCvars[CVAR_ZOMBIE_KNOCKBACK] = CreateConVar("zr_zombie_knockback", "1", "How far zombies are pushed back when shot. If classes are enabled: This one is a multiplier for class knockback values (1: Default)");
gCvars[CVAR_ZOMBIE_NVGS] = CreateConVar("zr_zombie_nvgs", "-1", "Zombies will be equipped with nightvision. Also used to override class nvgs if non-negative. (-1: No override/Nvgs on, 0: No nvgs, 1: Nvgs on)"); gCvars[CVAR_ZOMBIE_KNOCKBACK_GRENADE] = CreateConVar("zr_zombie_knockback_grenade", "4.0", "Knockback multiplier when a grenade inflicts damage on a zombie. (4.0: Default)");
gCvars[CVAR_ZOMBIE_NVGS] = CreateConVar("zr_zombie_nvgs", "-1", "Zombies will be equipped with nightvision. Also used to override class nvgs if non-negative. (-1: No override, uses class setting, 0: No nvgs, 1: Nvgs on)");
gCvars[CVAR_ZOMBIE_FOV] = CreateConVar("zr_zombie_fov", "110", "The field of vision of zombies (90: Default vision)"); gCvars[CVAR_ZOMBIE_FOV] = CreateConVar("zr_zombie_fov", "110", "The field of vision of zombies (90: Default vision)");
gCvars[CVAR_ZOMBIE_REGEN] = CreateConVar("zr_zombie_regen", "0", "Zombies will regenerate health"); gCvars[CVAR_ZOMBIE_REGEN] = CreateConVar("zr_zombie_regen", "0", "Zombies will regenerate health");
gCvars[CVAR_ZOMBIE_REGEN_HEALTH] = CreateConVar("zr_zombie_regen_health", "1", "How much health is regenerated when zr_zombie_regen is 1"); gCvars[CVAR_ZOMBIE_REGEN_HEALTH] = CreateConVar("zr_zombie_regen_health", "1", "How much health is regenerated when zr_zombie_regen is 1");
@ -137,7 +139,7 @@ CreateCvars()
gCvars[CVAR_RESPAWN_DELAY] = CreateConVar("zr_respawn_delay", "1", "How long to wait after death to respawn, in seconds"); gCvars[CVAR_RESPAWN_DELAY] = CreateConVar("zr_respawn_delay", "1", "How long to wait after death to respawn, in seconds");
gCvars[CVAR_SUICIDE] = CreateConVar("zr_suicide", "1", "Stops players from suiciding"); gCvars[CVAR_SUICIDE] = CreateConVar("zr_suicide", "1", "Stops players from suiciding");
gCvars[CVAR_SUICIDE_ECHO] = CreateConVar("zr_suicide_echo", "0", "Log suicide attempts to admin chat."); gCvars[CVAR_SUICIDE_ECHO] = CreateConVar("zr_suicide_echo", "0", "Log suicide attempts to admin chat.");
gCvars[CVAR_SUICIDE_WORLD_DAMAGE] = CreateConVar("zr_suicide_world_damage", "1", "Respawn zombies as zombies if they was killed by the world, like elevators, doors and lasers."); gCvars[CVAR_SUICIDE_WORLD_DAMAGE] = CreateConVar("zr_suicide_world_damage", "1", "Respawn zombies as zombies if they were killed by the world, like elevators, doors and lasers. (0: Disable)");
gCvars[CVAR_SPAWN_MIN] = CreateConVar("zr_spawn_min", "30", "Minimum time a player is picked to be zombie after the round starts, in seconds"); gCvars[CVAR_SPAWN_MIN] = CreateConVar("zr_spawn_min", "30", "Minimum time a player is picked to be zombie after the round starts, in seconds");
gCvars[CVAR_SPAWN_MAX] = CreateConVar("zr_spawn_max", "50", "Maximum time a player is picked to be zombie after the round starts, in seconds"); gCvars[CVAR_SPAWN_MAX] = CreateConVar("zr_spawn_max", "50", "Maximum time a player is picked to be zombie after the round starts, in seconds");
gCvars[CVAR_PROTECT] = CreateConVar("zr_protect", "10", "Players that join late will be protected for this long, in seconds (0: Disable)"); gCvars[CVAR_PROTECT] = CreateConVar("zr_protect", "10", "Players that join late will be protected for this long, in seconds (0: Disable)");

View File

@ -38,13 +38,13 @@ public Action:RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
if (tRound != INVALID_HANDLE) if (tRound != INVALID_HANDLE)
{ {
CloseHandle(tRound); KillTimer(tRound);
tRound = INVALID_HANDLE; tRound = INVALID_HANDLE;
} }
if (tInfect != INVALID_HANDLE) if (tInfect != INVALID_HANDLE)
{ {
CloseHandle(tInfect); KillTimer(tInfect);
tInfect = INVALID_HANDLE; tInfect = INVALID_HANDLE;
} }
@ -57,7 +57,7 @@ public Action:RoundFreezeEnd(Handle:event, const String:name[], bool:dontBroadca
if (tRound != INVALID_HANDLE) if (tRound != INVALID_HANDLE)
{ {
CloseHandle(tRound); KillTimer(tRound);
} }
new Float:roundlen = GetConVarFloat(FindConVar("mp_roundtime")) * 60.0; new Float:roundlen = GetConVarFloat(FindConVar("mp_roundtime")) * 60.0;
@ -65,7 +65,7 @@ public Action:RoundFreezeEnd(Handle:event, const String:name[], bool:dontBroadca
if (tInfect != INVALID_HANDLE) if (tInfect != INVALID_HANDLE)
{ {
CloseHandle(tInfect); KillTimer(tInfect);
} }
new Float:min = GetConVarFloat(gCvars[CVAR_SPAWN_MIN]); new Float:min = GetConVarFloat(gCvars[CVAR_SPAWN_MIN]);
@ -81,13 +81,13 @@ public Action:RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
{ {
if (tRound != INVALID_HANDLE) if (tRound != INVALID_HANDLE)
{ {
CloseHandle(tRound); KillTimer(tRound);
tRound = INVALID_HANDLE; tRound = INVALID_HANDLE;
} }
if (tInfect != INVALID_HANDLE) if (tInfect != INVALID_HANDLE)
{ {
CloseHandle(tInfect); KillTimer(tInfect);
tInfect = INVALID_HANDLE; tInfect = INVALID_HANDLE;
} }
@ -156,7 +156,7 @@ public Action:PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
if (tHandles[index][x] != INVALID_HANDLE) if (tHandles[index][x] != INVALID_HANDLE)
{ {
CloseHandle(tHandles[index][x]); KillTimer(tHandles[index][x]);
tHandles[index][x] = INVALID_HANDLE; tHandles[index][x] = INVALID_HANDLE;
} }
} }
@ -213,7 +213,7 @@ public Action:PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
decl String:respawnteam[32]; decl String:respawnteam[32];
GetConVarString(gCvars[CVAR_RESPAWN_TEAM], respawnteam, sizeof(respawnteam)); GetConVarString(gCvars[CVAR_RESPAWN_TEAM], respawnteam, sizeof(respawnteam));
if (!StrEqual(respawnteam, "zombie", false)) if (!StrEqual(respawnteam, "zombie", false) && !(GetConVarBool(gCvars[CVAR_SUICIDE_WORLD_DAMAGE]) && gKilledByWorld[index]))
{ {
SetPlayerAlpha(index, 0); SetPlayerAlpha(index, 0);
SetPlayerSpeed(index, 600.0); SetPlayerSpeed(index, 600.0);
@ -224,14 +224,14 @@ public Action:PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
if (tHandles[index][TPROTECT] != INVALID_HANDLE) if (tHandles[index][TPROTECT] != INVALID_HANDLE)
{ {
CloseHandle(tHandles[index][TPROTECT]); KillTimer(tHandles[index][TPROTECT]);
} }
protCount[index] = protect; pTimeLeft[index] = protect;
PrintHintText(index, "%d", protCount[index]);
protCount[index]--;
tHandles[index][TPROTECT] = CreateTimer(1.0, EndProtect, index, TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT); PrintHintText(index, "%d", pTimeLeft[index]);
tHandles[index][TPROTECT] = CreateTimer(1.0, ProtectTimer, index, TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT);
} }
} }
} }
@ -304,18 +304,21 @@ public Action:PlayerHurt(Handle:event, const String:name[], bool:dontBroadcast)
if (!StrEqual(weapon, "hegrenade")) if (!StrEqual(weapon, "hegrenade"))
{ {
GetClientAbsOrigin(attacker, attackerloc); GetPlayerEyePosition(attacker, attackerloc);
new bool:shotgun = (StrEqual(weapon, "m3") || StrEqual(weapon, "xm1014")); new Float:attackerang[3];
GetPlayerEyeAngles(attacker, attackerang);
KnockBack(index, clientloc, attackerloc, knockback, dmg, shotgun); TR_TraceRayFilter(attackerloc, attackerang, MASK_ALL, RayType_Infinite, TraceRayFilter);
TR_GetEndPosition(clientloc);
KnockBack(index, clientloc, attackerloc, knockback, dmg, false);
} }
else else
{ {
new Float:heLoc[3]; FindExplodingGrenade(attackerloc);
FindExplodingGrenade(heLoc);
KnockBack(index, clientloc, heLoc, knockback, dmg, true); KnockBack(index, clientloc, attackerloc, knockback, dmg, true);
} }
} }
} }
@ -360,6 +363,16 @@ public Action:PlayerHurt(Handle:event, const String:name[], bool:dontBroadcast)
UpdateAlphaDamaged(index); UpdateAlphaDamaged(index);
} }
public bool:TraceRayFilter(entity, contentsMask)
{
if (entity > 0 && entity < MAXPLAYERS)
{
return false;
}
return true;
}
FindExplodingGrenade(Float:heLoc[3]) FindExplodingGrenade(Float:heLoc[3])
{ {
decl String:classname[64]; decl String:classname[64];

View File

@ -15,6 +15,7 @@ MainMenu(client)
SetMenuTitle(menu_main, "%t\n ", "!zmenu title"); SetMenuTitle(menu_main, "%t\n ", "!zmenu title");
decl String:zmenu[128]; decl String:zmenu[128];
decl String:zadmin[128];
decl String:zclass[128]; decl String:zclass[128];
decl String:zmarket[128]; decl String:zmarket[128];
decl String:zspawn[128]; decl String:zspawn[128];
@ -23,6 +24,7 @@ MainMenu(client)
decl String:zhp[128]; decl String:zhp[128];
Format(zmenu, sizeof(zmenu), "%t", "!zmenu menu"); Format(zmenu, sizeof(zmenu), "%t", "!zmenu menu");
Format(zadmin, sizeof(zadmin), "%t", "!zmenu admin");
Format(zclass, sizeof(zclass), "%t", "!zmenu class"); Format(zclass, sizeof(zclass), "%t", "!zmenu class");
Format(zmarket, sizeof(zmarket), "%t", "!zmenu market"); Format(zmarket, sizeof(zmarket), "%t", "!zmenu market");
Format(zspawn, sizeof(zspawn), "%t", "!zmenu spawn"); Format(zspawn, sizeof(zspawn), "%t", "!zmenu spawn");
@ -31,6 +33,16 @@ MainMenu(client)
Format(zhp, sizeof(zhp), "%t (%d HP)", "!zmenu hp", GetClientHealth(client)); Format(zhp, sizeof(zhp), "%t (%d HP)", "!zmenu hp", GetClientHealth(client));
AddMenuItem(menu_main, "zmenu", zmenu, ITEMDRAW_DISABLED); AddMenuItem(menu_main, "zmenu", zmenu, ITEMDRAW_DISABLED);
if (GetAdminFlag(GetUserAdmin(client), Admin_Generic))
{
AddMenuItem(menu_main, "zadmin", zadmin);
}
else
{
AddMenuItem(menu_main, "zadmin", zadmin, ITEMDRAW_DISABLED);
}
AddMenuItem(menu_main, "zclass", zclass); AddMenuItem(menu_main, "zclass", zclass);
if (market) if (market)
@ -58,32 +70,42 @@ public MainMenuHandle(Handle:menu_main, MenuAction:action, client, slot)
{ {
case 1: case 1:
{ {
if (!ZClass(client)) if (!ZRAdminMenu(client))
{ {
MainMenu(client); MainMenu(client);
} }
} }
case 2: case 2:
{ {
if (!ZMarket(client)) if (!ZClass(client))
{ {
MainMenu(client); MainMenu(client);
} }
} }
case 3: case 3:
{ {
ZSpawn(client); if (!ZMarket(client))
{
MainMenu(client);
}
} }
case 4: case 4:
{ {
if (!ZTeleClientCheck(client)) MainMenu(client); ZSpawn(client);
} }
case 5: case 5:
{
if (!ZTele(client))
{
MainMenu(client);
}
}
case 6:
{ {
ZStuck(client); ZStuck(client);
MainMenu(client); MainMenu(client);
} }
case 6: case 7:
{ {
ZHP(client); ZHP(client);
MainMenu(client); MainMenu(client);

View File

@ -6,7 +6,6 @@
* ==================== * ====================
*/ */
new offsBaseVelocity;
new offsGetVelocity0; new offsGetVelocity0;
new offsGetVelocity1; new offsGetVelocity1;
new offsGetVelocity2; new offsGetVelocity2;
@ -23,15 +22,11 @@ new offsRender;
new Handle:g_hGameConf = INVALID_HANDLE; new Handle:g_hGameConf = INVALID_HANDLE;
new Handle:g_hRemoveAllItems = INVALID_HANDLE; new Handle:g_hRemoveAllItems = INVALID_HANDLE;
new Handle:g_hTerminateRound = INVALID_HANDLE; new Handle:g_hTerminateRound = INVALID_HANDLE;
new Handle:g_hEyePosition = INVALID_HANDLE;
new Handle:g_hEyeAngles = INVALID_HANDLE;
FindOffsets() FindOffsets()
{ {
offsBaseVelocity = FindSendPropInfo("CBasePlayer", "m_vecBaseVelocity");
if (offsBaseVelocity == -1)
{
SetFailState("Couldn't find \"m_vecBaseVelocity\"!");
}
offsGetVelocity0 = FindSendPropInfo("CBasePlayer", "m_vecVelocity[0]"); offsGetVelocity0 = FindSendPropInfo("CBasePlayer", "m_vecVelocity[0]");
if (offsGetVelocity0 == -1) if (offsGetVelocity0 == -1)
{ {
@ -111,6 +106,16 @@ SetupGameData()
PrepSDKCall_SetFromConf(g_hGameConf, SDKConf_Virtual, "RemoveAllItems"); PrepSDKCall_SetFromConf(g_hGameConf, SDKConf_Virtual, "RemoveAllItems");
g_hRemoveAllItems = EndPrepSDKCall(); g_hRemoveAllItems = EndPrepSDKCall();
StartPrepSDKCall(SDKCall_Player);
PrepSDKCall_SetFromConf(g_hGameConf, SDKConf_Virtual, "EyePosition");
PrepSDKCall_SetReturnInfo(SDKType_QAngle, SDKPass_ByValue);
g_hEyePosition = EndPrepSDKCall();
StartPrepSDKCall(SDKCall_Player);
PrepSDKCall_SetFromConf(g_hGameConf, SDKConf_Virtual, "EyeAngles");
PrepSDKCall_SetReturnInfo(SDKType_QAngle, SDKPass_ByValue);
g_hEyeAngles = EndPrepSDKCall();
StartPrepSDKCall(SDKCall_GameRules); StartPrepSDKCall(SDKCall_GameRules);
PrepSDKCall_SetFromConf(g_hGameConf, SDKConf_Signature, "TerminateRound"); PrepSDKCall_SetFromConf(g_hGameConf, SDKConf_Signature, "TerminateRound");
PrepSDKCall_AddParameter(SDKType_Float, SDKPass_Plain); PrepSDKCall_AddParameter(SDKType_Float, SDKPass_Plain);
@ -118,9 +123,21 @@ SetupGameData()
g_hTerminateRound = EndPrepSDKCall(); g_hTerminateRound = EndPrepSDKCall();
} }
SetPlayerVelocity(client, const Float:vec[3]) SetPlayerVelocity(client, const Float:vec[3], bool:reset)
{ {
SetEntDataVector(client, offsBaseVelocity, vec, true); if (reset)
{
TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, vec);
}
else
{
new Float:fVelocity[3];
GetPlayerVelocity(client, fVelocity);
AddVectors(vec, fVelocity, fVelocity);
TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, fVelocity);
}
} }
GetPlayerVelocity(client, Float:vel[3]) GetPlayerVelocity(client, Float:vel[3])
@ -190,6 +207,16 @@ RemoveAllPlayersWeapons(client)
SDKCall(g_hRemoveAllItems, client); SDKCall(g_hRemoveAllItems, client);
} }
GetPlayerEyePosition(client, Float:vec[3])
{
SDKCall(g_hEyePosition, client, vec);
}
GetPlayerEyeAngles(client, Float:ang[3])
{
SDKCall(g_hEyeAngles, client, ang);
}
TerminateRound(Float:delay, reason) TerminateRound(Float:delay, reason)
{ {
if (g_hTerminateRound == INVALID_HANDLE) return; if (g_hTerminateRound == INVALID_HANDLE) return;

View File

@ -30,6 +30,11 @@ public Action:SayCommand(client, argc)
MainMenu(client); MainMenu(client);
} }
if (StrEqual(args, "!zadmin", false))
{
ZRAdminMenu(client);
}
else if (StrEqual(args, "!zclass", false)) else if (StrEqual(args, "!zclass", false))
{ {
ZClass(client); ZClass(client);
@ -50,7 +55,7 @@ public Action:SayCommand(client, argc)
StrEqual(args, "!tele", false) || StrEqual(args, "!tele", false) ||
StrEqual(args, "!teleport", false)) StrEqual(args, "!teleport", false))
{ {
ZTeleClientCheck(client); ZTele(client);
} }
else if (StrEqual(args, "!teleabort", false)) else if (StrEqual(args, "!teleabort", false))
@ -268,7 +273,7 @@ ZStuck(client)
nudge[0] = x; nudge[0] = x;
nudge[1] = y; nudge[1] = y;
SetPlayerVelocity(client, nudge); SetPlayerVelocity(client, nudge, true);
} }
public Action:CollisionOn(Handle:timer, any:index) public Action:CollisionOn(Handle:timer, any:index)

View File

@ -333,7 +333,7 @@ public Action:Command_TeleportAbort(client, argc)
return Plugin_Handled; return Plugin_Handled;
} }
bool:ZTeleClientCheck(client) bool:ZTele(client)
{ {
// Check if the teleporter is disabled. // Check if the teleporter is disabled.
new bool:tele = GetConVarBool(gCvars[CVAR_ZTELE]); new bool:tele = GetConVarBool(gCvars[CVAR_ZTELE]);

View File

@ -175,7 +175,7 @@ stock ZR_PrintToAdminChat(String:message[])
Format(buffer, sizeof(buffer), "[ZR] %s", message); Format(buffer, sizeof(buffer), "[ZR] %s", message);
for (new client = 1; client < maxclients; client++) for (new client = 1; client < maxclients; client++)
{ {
if (IsClientConnected(client) && IsClientInGame(client) && GetUserAdmin(client) != INVALID_ADMIN_ID) if (IsClientConnected(client) && IsClientInGame(client) && GetAdminFlag(GetUserAdmin(client), Admin_Generic))
{ {
PrintToChat(client, buffer); PrintToChat(client, buffer);
} }

360
src/zr/zradmin.inc → src/zr/zadmin.inc Executable file → Normal file
View File

@ -7,38 +7,61 @@
*/ */
#include "include/adminmenu.inc" #include "include/adminmenu.inc"
new SelectedClassIndex[MAXPLAYERS]; new curMenuClass[MAXPLAYERS+1];
ZRAdminMenu(client) bool:ZRAdminMenu(client)
{ {
new Handle:zr_admin_menu = CreateMenu(ZRAdminMenuHandle); if (!GetAdminFlag(GetUserAdmin(client), Admin_Generic))
{
ZR_PrintToChat(client, "Must be admin");
SetMenuTitle(zr_admin_menu, "ZR admin menu"); return false;
}
decl String:zknockbackm[] = "Change knockback multiplier"; new Handle:menu_admin = CreateMenu(ZRAdminMenuHandle);
decl String:zknockback[] = "Change class knockback";
decl String:znvgs[] = "Change night vision settings";
decl String:zinfect[] = "Infect a player";
decl String:zspawn[] = "Spawn all players";
decl String:ztele[] = "Teleporter commands";
decl String:zrestrict[] = "Restrict a weapon";
decl String:zunrestrict[] = "Unrestrict a weapon";
decl String:zlogflags[] = "Logging flags";
AddMenuItem(zr_admin_menu, "zknockbackm", zknockbackm); SetGlobalTransTarget(client);
AddMenuItem(zr_admin_menu, "zknockback", zknockback);
AddMenuItem(zr_admin_menu, "znvgs", znvgs);
AddMenuItem(zr_admin_menu, "zinfect", zinfect);
AddMenuItem(zr_admin_menu, "zspawn", zspawn);
AddMenuItem(zr_admin_menu, "ztele", ztele);
AddMenuItem(zr_admin_menu, "zrestrict", zrestrict, ITEMDRAW_DISABLED);
AddMenuItem(zr_admin_menu, "zunrestrict", zunrestrict, ITEMDRAW_DISABLED);
AddMenuItem(zr_admin_menu, "zlogflags", zlogflags);
DisplayMenu(zr_admin_menu, client, MENU_TIME_FOREVER); SetMenuTitle(menu_admin, "%t\n ", "!zadmin main title");
decl String:knockbackm[64];
decl String:knockback[64];
decl String:nvgs[64];
decl String:infect[64];
decl String:zspawn[64];
decl String:ztele[64];
decl String:restrict[64];
decl String:unrestrict[64];
decl String:logflags[64];
Format(knockbackm, sizeof(knockbackm), "%t", "!zadmin main knockbackm");
Format(knockback, sizeof(knockback), "%t", "!zadmin main knockback");
Format(nvgs, sizeof(nvgs), "%t", "!zadmin main nvgs");
Format(infect, sizeof(infect), "%t", "!zadmin main infect");
Format(zspawn, sizeof(zspawn), "%t", "!zadmin main spawn");
Format(ztele, sizeof(ztele), "%t", "!zadmin main tele");
Format(restrict, sizeof(restrict), "%t", "!zadmin main restrict");
Format(unrestrict, sizeof(unrestrict), "%t", "!zadmin main unrestrict");
Format(logflags, sizeof(logflags), "%t", "!zadmin main logflags");
AddMenuItem(menu_admin, "knockbackm", knockbackm);
AddMenuItem(menu_admin, "knockback", knockback);
AddMenuItem(menu_admin, "nvgs", nvgs);
AddMenuItem(menu_admin, "infect", infect);
AddMenuItem(menu_admin, "zspawn", zspawn);
AddMenuItem(menu_admin, "ztele", ztele);
AddMenuItem(menu_admin, "restrict", restrict, ITEMDRAW_DISABLED);
AddMenuItem(menu_admin, "unrestrict", unrestrict, ITEMDRAW_DISABLED);
AddMenuItem(menu_admin, "logflags", logflags);
SetMenuExitBackButton(menu_admin, true);
DisplayMenu(menu_admin, client, MENU_TIME_FOREVER);
return true;
} }
public ZRAdminMenuHandle(Handle:zr_admin_menu, MenuAction:action, client, slot) public ZRAdminMenuHandle(Handle:menu_admin, MenuAction:action, client, slot)
{ {
if (action == MenuAction_Select) if (action == MenuAction_Select)
{ {
@ -66,7 +89,7 @@ public ZRAdminMenuHandle(Handle:zr_admin_menu, MenuAction:action, client, slot)
} }
case 5: case 5:
{ {
ZRTeleMenu(client); ZRZTeleMenu(client);
} }
case 6: case 6:
{ {
@ -82,35 +105,50 @@ public ZRAdminMenuHandle(Handle:zr_admin_menu, MenuAction:action, client, slot)
} }
} }
} }
if (action == MenuAction_End)
if (action == MenuAction_Cancel)
{ {
CloseHandle(zr_admin_menu); if (slot == MenuCancel_ExitBack)
{
MainMenu(client);
}
}
else if (action == MenuAction_End)
{
CloseHandle(menu_admin);
} }
} }
ZRKnockbackMMenu(client) ZRKnockbackMMenu(client)
{ {
new Handle:zr_knockbackm_menu = CreateMenu(ZRKnockbackMHandle); new Handle:menu_knockbackm = CreateMenu(ZRKnockbackMHandle);
new Float:current_knockback = GetConVarFloat(gCvars[CVAR_ZOMBIE_KNOCKBACK]); new Float:curknockback = GetConVarFloat(gCvars[CVAR_ZOMBIE_KNOCKBACK]);
SetMenuTitle(zr_knockbackm_menu, "Change knockback multiplier\nCurrent value: %f\n\n", current_knockback); SetGlobalTransTarget(client);
decl String:zincreasehalf[] = "Increase by 0.5"; SetMenuTitle(menu_knockbackm, "%t\n ", "!zadmin knockbackm title", curknockback);
decl String:zincreasedeca[] = "Increase by 0.1";
decl String:zdecreasedeci[] = "Decrease by 0.1";
decl String:zdecreasehalf[] = "Decrease by 0.5";
AddMenuItem(zr_knockbackm_menu, "zincreasehalf", zincreasehalf); decl String:knockbackmincrease1[64];
AddMenuItem(zr_knockbackm_menu, "zincreasedeca", zincreasedeca); decl String:knockbackmdecrease1[64];
AddMenuItem(zr_knockbackm_menu, "zdecreasedeci", zdecreasedeci); decl String:knockbackmincrease2[64];
AddMenuItem(zr_knockbackm_menu, "zdecreasehalf", zdecreasehalf); decl String:knockbackmdecrease2[64];
SetMenuExitBackButton(zr_knockbackm_menu, true); Format(knockbackmincrease1, sizeof(knockbackmincrease1), "%t", "!zadmin knockbackm increase", "0.1");
Format(knockbackmdecrease1, sizeof(knockbackmdecrease1), "%t", "!zadmin knockbackm decrease", "0.1");
Format(knockbackmincrease2, sizeof(knockbackmincrease2), "%t", "!zadmin knockbackm increase", "0.5");
Format(knockbackmdecrease2, sizeof(knockbackmdecrease2), "%t", "!zadmin knockbackm decrease", "0.5");
DisplayMenu(zr_knockbackm_menu, client, MENU_TIME_FOREVER); AddMenuItem(menu_knockbackm, "knockbackmincrease1", knockbackmincrease1);
AddMenuItem(menu_knockbackm, "knockbackmdecrease1", knockbackmdecrease1);
AddMenuItem(menu_knockbackm, "knockbackmincrease2", knockbackmincrease2);
AddMenuItem(menu_knockbackm, "knockbackmdecrease2", knockbackmdecrease2);
SetMenuExitBackButton(menu_knockbackm, true);
DisplayMenu(menu_knockbackm, client, MENU_TIME_FOREVER);
} }
public ZRKnockbackMHandle(Handle:zr_knockbackm_menu, MenuAction:action, client, slot) public ZRKnockbackMHandle(Handle:menu_knockbackm, MenuAction:action, client, slot)
{ {
if (action == MenuAction_Select) if (action == MenuAction_Select)
{ {
@ -118,17 +156,17 @@ public ZRKnockbackMHandle(Handle:zr_knockbackm_menu, MenuAction:action, client,
{ {
case 0: case 0:
{ {
AddToKnockbackMultiplier(0.5); AddToKnockbackMultiplier(0.1);
ZRKnockbackMMenu(client); ZRKnockbackMMenu(client);
} }
case 1: case 1:
{ {
AddToKnockbackMultiplier(0.1); AddToKnockbackMultiplier(-0.1);
ZRKnockbackMMenu(client); ZRKnockbackMMenu(client);
} }
case 2: case 2:
{ {
AddToKnockbackMultiplier(-0.1); AddToKnockbackMultiplier(0.5);
ZRKnockbackMMenu(client); ZRKnockbackMMenu(client);
} }
case 3: case 3:
@ -147,31 +185,33 @@ public ZRKnockbackMHandle(Handle:zr_knockbackm_menu, MenuAction:action, client,
} }
if (action == MenuAction_End) if (action == MenuAction_End)
{ {
CloseHandle(zr_knockbackm_menu); CloseHandle(menu_knockbackm);
} }
} }
ZRClassSelectMenu(client) ZRClassSelectMenu(client)
{ {
new Handle:zr_class_select_menu = CreateMenu(ZRClassSelectHandle); new Handle:menu_class = CreateMenu(ZRClassSelectHandle);
new classindex;
SetMenuTitle(zr_class_select_menu, "Select class to change:\n"); SetGlobalTransTarget(client);
for (classindex = 0; classindex < classCount; classindex++) SetMenuTitle(menu_class, "%t\n ", "!zadmin class title");
// x = index of class
for (new x = 0; x < classCount; x++)
{ {
AddMenuItem(zr_class_select_menu, arrayClasses[classindex][data_name], arrayClasses[classindex][data_name]); AddMenuItem(menu_class, arrayClasses[x][data_name], arrayClasses[x][data_name]);
} }
SetMenuExitBackButton(zr_class_select_menu, true); SetMenuExitBackButton(menu_class, true);
DisplayMenu(zr_class_select_menu, client, MENU_TIME_FOREVER); DisplayMenu(menu_class, client, MENU_TIME_FOREVER);
} }
public ZRClassSelectHandle(Handle:zr_class_select_menu, MenuAction:action, client, slot) public ZRClassSelectHandle(Handle:menu_class, MenuAction:action, client, slot)
{ {
if (action == MenuAction_Select) if (action == MenuAction_Select)
{ {
SelectedClassIndex[client] = slot; curMenuClass[client] = slot;
ZRClassKnockbackMenu(client, slot); ZRClassKnockbackMenu(client, slot);
} }
if (action == MenuAction_Cancel) if (action == MenuAction_Cancel)
@ -183,35 +223,44 @@ public ZRClassSelectHandle(Handle:zr_class_select_menu, MenuAction:action, clien
} }
if (action == MenuAction_End) if (action == MenuAction_End)
{ {
CloseHandle(zr_class_select_menu); CloseHandle(menu_class);
} }
} }
ZRClassKnockbackMenu(client, classindex) ZRClassKnockbackMenu(client, classindex)
{ {
new Handle:zr_knockback_menu = CreateMenu(ZRClassKnockbackHandle); new Handle:menu_knockback = CreateMenu(ZRClassKnockbackHandle);
new Float:current_knockback = arrayClasses[classindex][data_knockback];
new Float:curknockback = arrayClasses[classindex][data_knockback];
new String:classname[64]; new String:classname[64];
GetClassName(classindex, classname, sizeof(classname)); GetClassName(classindex, classname, sizeof(classname));
SetMenuTitle(zr_knockback_menu, "Change %s knockback\nCurrent value: %f\n\n", classname, current_knockback); SetGlobalTransTarget(client);
decl String:zincreasehalf[] = "Increase by 0.5"; SetMenuTitle(menu_knockback, "%t\n ", "!zadmin knockback title", classname, curknockback);
decl String:zincreasedeca[] = "Increase by 0.1";
decl String:zdecreasedeci[] = "Decrease by 0.1";
decl String:zdecreasehalf[] = "Decrease by 0.5";
AddMenuItem(zr_knockback_menu, "zincreasehalf", zincreasehalf); decl String:knockbackincrease1[64];
AddMenuItem(zr_knockback_menu, "zincreasedeca", zincreasedeca); decl String:knockbackdecrease1[64];
AddMenuItem(zr_knockback_menu, "zdecreasedeci", zdecreasedeci); decl String:knockbackincrease2[64];
AddMenuItem(zr_knockback_menu, "zdecreasehalf", zdecreasehalf); decl String:knockbackdecrease2[64];
SetMenuExitBackButton(zr_knockback_menu, true); Format(knockbackincrease1, sizeof(knockbackincrease1), "%t", "!zadmin knockback increase", "0.1");
Format(knockbackdecrease1, sizeof(knockbackdecrease1), "%t", "!zadmin knockback decrease", "0.1");
Format(knockbackincrease2, sizeof(knockbackincrease2), "%t", "!zadmin knockback increase", "0.5");
Format(knockbackdecrease2, sizeof(knockbackdecrease2), "%t", "!zadmin knockback decrease", "0.5");
DisplayMenu(zr_knockback_menu, client, MENU_TIME_FOREVER); AddMenuItem(menu_knockback, "knockbackincrease1", knockbackincrease1);
AddMenuItem(menu_knockback, "knockbackdecrease1", knockbackdecrease1);
AddMenuItem(menu_knockback, "knockbackincrease2", knockbackincrease2);
AddMenuItem(menu_knockback, "knockbackdecrease2", knockbackdecrease2);
SetMenuExitBackButton(menu_knockback, true);
DisplayMenu(menu_knockback, client, MENU_TIME_FOREVER);
} }
public ZRClassKnockbackHandle(Handle:zr_knockback_menu, MenuAction:action, client, slot) public ZRClassKnockbackHandle(Handle:menu_knockback, MenuAction:action, client, slot)
{ {
if (action == MenuAction_Select) if (action == MenuAction_Select)
{ {
@ -219,25 +268,23 @@ public ZRClassKnockbackHandle(Handle:zr_knockback_menu, MenuAction:action, clien
{ {
case 0: case 0:
{ {
AddToClassKnockback(SelectedClassIndex[client], 0.5); AddToClassKnockback(curMenuClass[client], 0.1);
ZRClassKnockbackMenu(client, SelectedClassIndex[client]);
} }
case 1: case 1:
{ {
AddToClassKnockback(SelectedClassIndex[client], 0.1); AddToClassKnockback(curMenuClass[client], -0.1);
ZRClassKnockbackMenu(client, SelectedClassIndex[client]);
} }
case 2: case 2:
{ {
AddToClassKnockback(SelectedClassIndex[client], -0.1); AddToClassKnockback(curMenuClass[client], 0.5);
ZRClassKnockbackMenu(client, SelectedClassIndex[client]);
} }
case 3: case 3:
{ {
AddToClassKnockback(SelectedClassIndex[client], -0.5); AddToClassKnockback(curMenuClass[client], -0.5);
ZRClassKnockbackMenu(client, SelectedClassIndex[client]);
} }
} }
ZRClassKnockbackMenu(client, curMenuClass[client]);
} }
if (action == MenuAction_Cancel) if (action == MenuAction_Cancel)
{ {
@ -248,31 +295,37 @@ public ZRClassKnockbackHandle(Handle:zr_knockback_menu, MenuAction:action, clien
} }
if (action == MenuAction_End) if (action == MenuAction_End)
{ {
CloseHandle(zr_knockback_menu); CloseHandle(menu_knockback);
} }
} }
ZRNVGSMenu(client) ZRNVGSMenu(client)
{ {
new Handle:zr_nvgs_menu = CreateMenu(ZRNVGSHandle); new Handle:menu_nvgs = CreateMenu(ZRNVGSHandle);
new current_nvgs = GetConVarInt(gCvars[CVAR_ZOMBIE_NVGS]); new curnvgs = GetConVarInt(gCvars[CVAR_ZOMBIE_NVGS]);
SetMenuTitle(zr_nvgs_menu, "Change night vision settings\nCurrent value: %i\n", current_nvgs); SetGlobalTransTarget(client);
decl String:znooverride[] = "-1: No override/Default"; SetMenuTitle(menu_nvgs, "%t\n ", "!zadmin nvgs title", curnvgs);
decl String:zoff[] = "0: Never give nvgs";
decl String:zon[] = "1: Always give nvgs";
AddMenuItem(zr_nvgs_menu, "znooverride", znooverride); decl String:nooverride[64];
AddMenuItem(zr_nvgs_menu, "zoff", zoff); decl String:disable[64];
AddMenuItem(zr_nvgs_menu, "zon", zon); decl String:enable[64];
SetMenuExitBackButton(zr_nvgs_menu, true); Format(nooverride, sizeof(nooverride), "%t", "!zadmin nvgs no override");
Format(disable, sizeof(disable), "%t", "!zadmin nvgs disable");
Format(enable, sizeof(enable), "%t", "!zadmin nvgs enable");
DisplayMenu(zr_nvgs_menu, client, MENU_TIME_FOREVER); AddMenuItem(menu_nvgs, "nooverride", nooverride);
AddMenuItem(menu_nvgs, "disable", disable);
AddMenuItem(menu_nvgs, "enable", enable);
SetMenuExitBackButton(menu_nvgs, true);
DisplayMenu(menu_nvgs, client, MENU_TIME_FOREVER);
} }
public ZRNVGSHandle(Handle:zr_nvgs_menu, MenuAction:action, client, slot) public ZRNVGSHandle(Handle:menu_nvgs, MenuAction:action, client, slot)
{ {
if (action == MenuAction_Select) if (action == MenuAction_Select)
{ {
@ -304,28 +357,33 @@ public ZRNVGSHandle(Handle:zr_nvgs_menu, MenuAction:action, client, slot)
} }
if (action == MenuAction_End) if (action == MenuAction_End)
{ {
CloseHandle(zr_nvgs_menu); CloseHandle(menu_nvgs);
} }
} }
ZRInfectMenu(client) ZRInfectMenu(client)
{ {
new Handle:zr_infect_menu = CreateMenu(ZRInfectHandle); new Handle:menu_infect = CreateMenu(ZRInfectHandle);
SetMenuTitle(zr_infect_menu, "Infect a player:"); SetGlobalTransTarget(client);
AddTargetsToMenu(zr_infect_menu, client, true, true);
SetMenuExitBackButton(zr_infect_menu, true); SetMenuTitle(menu_infect, "%t\n ", "!zadmin infect title");
DisplayMenu(zr_infect_menu, client, MENU_TIME_FOREVER);
AddTargetsToMenu(menu_infect, client, true, true);
SetMenuExitBackButton(menu_infect, true);
DisplayMenu(menu_infect, client, MENU_TIME_FOREVER);
} }
public ZRInfectHandle(Handle:zr_infect_menu, MenuAction:action, client, slot) public ZRInfectHandle(Handle:menu_infect, MenuAction:action, client, slot)
{ {
if (action == MenuAction_Select) if (action == MenuAction_Select)
{ {
decl String:info[32]; decl String:info[32];
new userid, target; new userid, target;
GetMenuItem(zr_infect_menu, slot, info, sizeof(info)); GetMenuItem(menu_infect, slot, info, sizeof(info));
userid = StringToInt(info); userid = StringToInt(info);
if ((target = GetClientOfUserId(userid)) == 0) if ((target = GetClientOfUserId(userid)) == 0)
@ -358,42 +416,50 @@ public ZRInfectHandle(Handle:zr_infect_menu, MenuAction:action, client, slot)
} }
if (action == MenuAction_End) if (action == MenuAction_End)
{ {
CloseHandle(zr_infect_menu); CloseHandle(menu_infect);
} }
} }
ZRSpawnAll(client) ZRSpawnAll(client)
{ {
for (new c = 1; c < maxclients; c++) for (new x = 1; x < maxclients; x++)
{ {
if (IsClientConnected(c) && IsClientInGame(c)) if (IsClientInGame(x))
{ {
ZSpawn(c); ZSpawn(x);
} }
} }
ZRAdminMenu(client); ZRAdminMenu(client);
} }
ZRTeleMenu(client) ZRZTeleMenu(client)
{ {
new Handle:zr_tele_menu = CreateMenu(ZRTeleHandle); new Handle:menu_ztele = CreateMenu(ZRTeleHandle);
decl String:ztele_player[] = "Teleport players"; SetGlobalTransTarget(client);
decl String:ztele_abort[] = "Abort teleport on players";
decl String:ztele_save[] = "Save player location";
decl String:ztele_teleloc[] = "Teleport player to saved location";
SetMenuTitle(zr_tele_menu, "Teleport menu"); SetMenuTitle(menu_ztele, "%t\n ", "!zadmin ztele title");
AddMenuItem(zr_tele_menu, "ztele_player", ztele_player);
AddMenuItem(zr_tele_menu, "ztele_abort", ztele_abort);
AddMenuItem(zr_tele_menu, "ztele_save", ztele_save);
AddMenuItem(zr_tele_menu, "ztele_teleloc", ztele_teleloc);
SetMenuExitBackButton(zr_tele_menu, true); decl String:ztele_spawntele[64];
DisplayMenu(zr_tele_menu, client, MENU_TIME_FOREVER); decl String:ztele_abort[64];
decl String:ztele_save[64];
decl String:ztele_tele[64];
Format(ztele_spawntele, sizeof(ztele_spawntele), "%t", "!zadmin ztele spawn tele");
Format(ztele_abort, sizeof(ztele_abort), "%t", "!zadmin ztele abort");
Format(ztele_save, sizeof(ztele_save), "%t", "!zadmin ztele save");
Format(ztele_tele, sizeof(ztele_tele), "%t", "!zadmin ztele tele");
AddMenuItem(menu_ztele, "ztele_spawntele", ztele_spawntele);
AddMenuItem(menu_ztele, "ztele_abort", ztele_abort);
AddMenuItem(menu_ztele, "ztele_save", ztele_save);
AddMenuItem(menu_ztele, "ztele_tele", ztele_tele);
SetMenuExitBackButton(menu_ztele, true);
DisplayMenu(menu_ztele, client, MENU_TIME_FOREVER);
} }
public ZRTeleHandle(Handle:zr_tele_menu , MenuAction:action, client, slot) public ZRTeleHandle(Handle:menu_ztele , MenuAction:action, client, slot)
{ {
if (action == MenuAction_Select) if (action == MenuAction_Select)
{ {
@ -426,13 +492,18 @@ public ZRTeleHandle(Handle:zr_tele_menu , MenuAction:action, client, slot)
} }
if (action == MenuAction_End) if (action == MenuAction_End)
{ {
CloseHandle(zr_tele_menu); CloseHandle(menu_ztele);
} }
} }
ZRLogFlagsMenu(client) ZRLogFlagsMenu(client)
{ {
new Handle:zr_log_flags_menu = CreateMenu(ZRLogFlagsMenuHandle); new Handle:menu_log_flags = CreateMenu(ZRLogFlagsMenuHandle);
SetGlobalTransTarget(client);
SetMenuTitle(menu_log_flags, "%t\n ", "!zadmin log flags title");
new client_flags = GetUserFlagBits(client); new client_flags = GetUserFlagBits(client);
new item_disabled = (client_flags & ADMFLAG_ROOT) ? ITEMDRAW_DEFAULT : ITEMDRAW_DISABLED; new item_disabled = (client_flags & ADMFLAG_ROOT) ? ITEMDRAW_DEFAULT : ITEMDRAW_DISABLED;
@ -480,34 +551,33 @@ ZRLogFlagsMenu(client)
Format(z_log_module_damagecontrol, sizeof(z_log_module_damagecontrol), "Damage control (suicides) (%d)", LogHasFlag(LOG_MODULE_DAMAGECONTROL)); Format(z_log_module_damagecontrol, sizeof(z_log_module_damagecontrol), "Damage control (suicides) (%d)", LogHasFlag(LOG_MODULE_DAMAGECONTROL));
Format(z_log_module_offsets, sizeof(z_log_module_offsets), "Offsets (properties) (%d)", LogHasFlag(LOG_MODULE_OFFSETS)); Format(z_log_module_offsets, sizeof(z_log_module_offsets), "Offsets (properties) (%d)", LogHasFlag(LOG_MODULE_OFFSETS));
SetMenuTitle(zr_log_flags_menu, "Toggle logging flags"); AddMenuItem(menu_log_flags, z_log_core, z_log_core, item_disabled);
AddMenuItem(zr_log_flags_menu, z_log_core, z_log_core, item_disabled); AddMenuItem(menu_log_flags, z_log_game, z_log_game, item_disabled);
AddMenuItem(zr_log_flags_menu, z_log_game, z_log_game, item_disabled); AddMenuItem(menu_log_flags, z_log_player, z_log_player, item_disabled);
AddMenuItem(zr_log_flags_menu, z_log_player, z_log_player, item_disabled); AddMenuItem(menu_log_flags, z_log_debug, z_log_debug, item_disabled);
AddMenuItem(zr_log_flags_menu, z_log_debug, z_log_debug, item_disabled); AddMenuItem(menu_log_flags, z_log_debug_detail, z_log_debug_detail, item_disabled);
AddMenuItem(zr_log_flags_menu, z_log_debug_detail, z_log_debug_detail, item_disabled); AddMenuItem(menu_log_flags, z_log_debug_max, z_log_debug_max, item_disabled);
AddMenuItem(zr_log_flags_menu, z_log_debug_max, z_log_debug_max, item_disabled); AddMenuItem(menu_log_flags, z_log_admins, z_log_admins);
AddMenuItem(zr_log_flags_menu, z_log_admins, z_log_admins); AddMenuItem(menu_log_flags, z_log_client, z_log_client);
AddMenuItem(zr_log_flags_menu, z_log_client, z_log_client); AddMenuItem(menu_log_flags, z_log_ignore_console, z_log_ignore_console, item_disabled);
AddMenuItem(zr_log_flags_menu, z_log_ignore_console, z_log_ignore_console, item_disabled); AddMenuItem(menu_log_flags, z_log_modules_enabled, z_log_modules_enabled, item_disabled);
AddMenuItem(zr_log_flags_menu, z_log_modules_enabled, z_log_modules_enabled, item_disabled); AddMenuItem(menu_log_flags, z_log_module_zombie, z_log_module_zombie, item_disabled);
AddMenuItem(zr_log_flags_menu, z_log_module_zombie, z_log_module_zombie, item_disabled); AddMenuItem(menu_log_flags, z_log_module_ambience, z_log_module_ambience, item_disabled);
AddMenuItem(zr_log_flags_menu, z_log_module_ambience, z_log_module_ambience, item_disabled); AddMenuItem(menu_log_flags, z_log_module_overlays, z_log_module_overlays, item_disabled);
AddMenuItem(zr_log_flags_menu, z_log_module_overlays, z_log_module_overlays, item_disabled); AddMenuItem(menu_log_flags, z_log_module_saytriggers, z_log_module_saytriggers, item_disabled);
AddMenuItem(zr_log_flags_menu, z_log_module_saytriggers, z_log_module_saytriggers, item_disabled); AddMenuItem(menu_log_flags, z_log_module_teleport, z_log_module_teleport, item_disabled);
AddMenuItem(zr_log_flags_menu, z_log_module_teleport, z_log_module_teleport, item_disabled); AddMenuItem(menu_log_flags, z_log_module_classes, z_log_module_classes, item_disabled);
AddMenuItem(zr_log_flags_menu, z_log_module_classes, z_log_module_classes, item_disabled); AddMenuItem(menu_log_flags, z_log_module_weaponrestrict, z_log_module_weaponrestrict, item_disabled);
AddMenuItem(zr_log_flags_menu, z_log_module_weaponrestrict, z_log_module_weaponrestrict, item_disabled); AddMenuItem(menu_log_flags, z_log_module_commands, z_log_module_commands, item_disabled);
AddMenuItem(zr_log_flags_menu, z_log_module_commands, z_log_module_commands, item_disabled); AddMenuItem(menu_log_flags, z_log_module_anticamp, z_log_module_anticamp, item_disabled);
AddMenuItem(zr_log_flags_menu, z_log_module_anticamp, z_log_module_anticamp, item_disabled); AddMenuItem(menu_log_flags, z_log_module_damagecontrol, z_log_module_damagecontrol, item_disabled);
AddMenuItem(zr_log_flags_menu, z_log_module_damagecontrol, z_log_module_damagecontrol, item_disabled); AddMenuItem(menu_log_flags, z_log_module_offsets, z_log_module_offsets, item_disabled);
AddMenuItem(zr_log_flags_menu, z_log_module_offsets, z_log_module_offsets, item_disabled);
SetMenuExitBackButton(zr_log_flags_menu, true); SetMenuExitBackButton(menu_log_flags, true);
DisplayMenu(zr_log_flags_menu, client, MENU_TIME_FOREVER); DisplayMenu(menu_log_flags, client, MENU_TIME_FOREVER);
} }
public ZRLogFlagsMenuHandle(Handle:zr_log_flags_menu , MenuAction:action, client, slot) public ZRLogFlagsMenuHandle(Handle:menu_log_flags , MenuAction:action, client, slot)
{ {
if (action == MenuAction_Select) if (action == MenuAction_Select)
{ {
@ -629,7 +699,7 @@ public ZRLogFlagsMenuHandle(Handle:zr_log_flags_menu , MenuAction:action, client
} }
if (action == MenuAction_End) if (action == MenuAction_End)
{ {
CloseHandle(zr_log_flags_menu ); CloseHandle(menu_log_flags );
} }
} }
@ -648,6 +718,7 @@ ToggleLogFlag(flag)
{ {
new log_flags; new log_flags;
log_flags = GetConVarInt(gCvars[CVAR_LOG]); log_flags = GetConVarInt(gCvars[CVAR_LOG]);
if (log_flags & flag) if (log_flags & flag)
{ {
log_flags = log_flags - flag; log_flags = log_flags - flag;
@ -656,5 +727,6 @@ ToggleLogFlag(flag)
{ {
log_flags = log_flags + flag; log_flags = log_flags + flag;
} }
SetConVarInt(gCvars[CVAR_LOG], log_flags); SetConVarInt(gCvars[CVAR_LOG], log_flags);
} }

View File

@ -200,20 +200,22 @@ Zombify_Mother(client)
{ {
if (tHandles[client][TMOAN] != INVALID_HANDLE) if (tHandles[client][TMOAN] != INVALID_HANDLE)
{ {
CloseHandle(tHandles[client][TMOAN]); KillTimer(tHandles[client][TMOAN]);
} }
tHandles[client][TMOAN] = CreateTimer(interval, ZombieMoanTimer, client, TIMER_REPEAT); tHandles[client][TMOAN] = CreateTimer(interval, ZombieMoanTimer, client, TIMER_REPEAT);
} }
if (tHandles[client][TPROTECT] != INVALID_HANDLE) if (tHandles[client][TPROTECT] != INVALID_HANDLE)
{ {
TriggerTimer(tHandles[client][TPROTECT]); pProtect[client] = false;
KillTimer(tHandles[client][TPROTECT]);
tHandles[client][TPROTECT] = INVALID_HANDLE; tHandles[client][TPROTECT] = INVALID_HANDLE;
} }
if (tHandles[client][TZHP] != INVALID_HANDLE) if (tHandles[client][TZHP] != INVALID_HANDLE)
{ {
CloseHandle(tHandles[client][TZHP]); KillTimer(tHandles[client][TZHP]);
tHandles[client][TZHP] = INVALID_HANDLE; tHandles[client][TZHP] = INVALID_HANDLE;
} }
@ -279,20 +281,22 @@ Zombify(client, attacker)
{ {
if (tHandles[client][TMOAN] != INVALID_HANDLE) if (tHandles[client][TMOAN] != INVALID_HANDLE)
{ {
CloseHandle(tHandles[client][TMOAN]); KillTimer(tHandles[client][TMOAN]);
} }
tHandles[client][TMOAN] = CreateTimer(interval, ZombieMoanTimer, client, TIMER_REPEAT); tHandles[client][TMOAN] = CreateTimer(interval, ZombieMoanTimer, client, TIMER_REPEAT);
} }
if (tHandles[client][TPROTECT] != INVALID_HANDLE) if (tHandles[client][TPROTECT] != INVALID_HANDLE)
{ {
TriggerTimer(tHandles[client][TPROTECT]); pProtect[client] = false;
KillTimer(tHandles[client][TPROTECT]);
tHandles[client][TPROTECT] = INVALID_HANDLE; tHandles[client][TPROTECT] = INVALID_HANDLE;
} }
if (tHandles[client][TZHP] != INVALID_HANDLE) if (tHandles[client][TZHP] != INVALID_HANDLE)
{ {
CloseHandle(tHandles[client][TZHP]); KillTimer(tHandles[client][TZHP]);
tHandles[client][TZHP] = INVALID_HANDLE; tHandles[client][TZHP] = INVALID_HANDLE;
} }
@ -424,7 +428,7 @@ ApplyZombieAlpha(client)
SetPlayerAlpha(client, alpha); SetPlayerAlpha(client, alpha);
} }
KnockBack(client, const Float:clientloc[3], const Float:attackerloc[3], Float:power, dmg, bool:boost) KnockBack(client, const Float:clientloc[3], const Float:attackerloc[3], Float:power, dmg, bool:grenade)
{ {
if (!IsPlayerZombie(client)) if (!IsPlayerZombie(client))
{ {
@ -434,18 +438,20 @@ KnockBack(client, const Float:clientloc[3], const Float:attackerloc[3], Float:po
new Float:vector[3]; new Float:vector[3];
MakeVectorFromPoints(attackerloc, clientloc, vector); MakeVectorFromPoints(attackerloc, clientloc, vector);
NormalizeVector(vector, vector); NormalizeVector(vector, vector);
vector[0] *= power * (float(dmg) * 1.5); vector[0] *= power * (float(dmg) * 1.5);
vector[1] *= power * (float(dmg) * 1.5); vector[1] *= power * (float(dmg) * 1.5);
vector[2] *= power * (float(dmg) * 1.5); vector[2] *= power * (float(dmg) * 1.5);
if (boost) if (grenade)
{ {
ScaleVector(vector, 4.0); new Float:knockback_grenade = GetConVarFloat(gCvars[CVAR_ZOMBIE_KNOCKBACK_GRENADE]);
ScaleVector(vector, knockback_grenade);
} }
SetPlayerVelocity(client, vector); SetPlayerVelocity(client, vector, false);
} }
JumpBoost(client, Float:distance, Float:height) JumpBoost(client, Float:distance, Float:height)
@ -458,7 +464,7 @@ JumpBoost(client, Float:distance, Float:height)
vel[1] *= distance; vel[1] *= distance;
vel[2] = height; vel[2] = height;
SetPlayerVelocity(client, vel); SetPlayerVelocity(client, vel, false);
} }
PlayerLeft(client) PlayerLeft(client)
@ -842,7 +848,7 @@ public Action:ZHPTimer(Handle:timer, any:index)
return Plugin_Continue; return Plugin_Continue;
} }
public Action:EndProtect(Handle:timer, any:index) public Action:ProtectTimer(Handle:timer, any:index)
{ {
if (!IsClientInGame(index)) if (!IsClientInGame(index))
{ {
@ -850,45 +856,26 @@ public Action:EndProtect(Handle:timer, any:index)
return Plugin_Stop; return Plugin_Stop;
} }
if (protCount[index] > 0) { pTimeLeft[index]--;
PrintHintText(index, "%d", protCount[index]); ZR_HudHint(index, "Spawn Protect", pTimeLeft[index]);
protCount[index]--;
return Plugin_Continue; if (pTimeLeft[index] <= 0)
} else { {
pProtect[index] = false; pProtect[index] = false;
if (IsPlayerHuman(index)) if (IsPlayerHuman(index))
{ {
ZR_PrintCenterText(index, "Spawn protection end"); ZR_HudHint(index, "Spawn protection end");
SetPlayerAlpha(index, 255);
SetPlayerSpeed(index, 300.0);
} }
SetPlayerAlpha(index, 255);
SetPlayerSpeed(index, 300.0);
tHandles[index][TPROTECT] = INVALID_HANDLE; tHandles[index][TPROTECT] = INVALID_HANDLE;
return Plugin_Stop; return Plugin_Stop;
} }
}
ProtectionAbort(client) return Plugin_Continue;
{
if (tHandles[client][TPROTECT] != INVALID_HANDLE)
{
KillTimer(tHandles[client][TPROTECT]);
tHandles[client][TPROTECT] = INVALID_HANDLE;
}
if (!IsClientInGame(client))
{
return;
}
pProtect[client] = false;
SetPlayerAlpha(client, 255);
SetPlayerSpeed(client, 300.0);
} }
RespawnPlayer(client) RespawnPlayer(client)
@ -916,7 +903,6 @@ RespawnPlayer(client)
if (GetConVarBool(gCvars[CVAR_SUICIDE_WORLD_DAMAGE]) && gKilledByWorld[client]) if (GetConVarBool(gCvars[CVAR_SUICIDE_WORLD_DAMAGE]) && gKilledByWorld[client])
{ {
ProtectionAbort(client);
Zombify(client, 0); Zombify(client, 0);
gKilledByWorld[client] = false; gKilledByWorld[client] = false;
} }

View File

@ -72,18 +72,18 @@ new bool:gKilledByWorld[MAXPLAYERS+1] = {false, ...};
new pClass[MAXPLAYERS+1]; new pClass[MAXPLAYERS+1];
new pNextClass[MAXPLAYERS+1]; new pNextClass[MAXPLAYERS+1];
new protCount[MAXPLAYERS+1]; new pTimeLeft[MAXPLAYERS+1];
new Float:spawnLoc[MAXPLAYERS + 1][3]; new Float:spawnLoc[MAXPLAYERS+1][3];
new Float:bufferLoc[MAXPLAYERS + 1][3]; new Float:bufferLoc[MAXPLAYERS+1][3];
new bool:ztele_spawned[MAXPLAYERS + 1] = {false, ...}; new bool:ztele_spawned[MAXPLAYERS+1] = {false, ...};
new bool:bufferLocSaved[MAXPLAYERS + 1] = {false, ...}; new bool:bufferLocSaved[MAXPLAYERS+1] = {false, ...};
new ztele_countdown[MAXPLAYERS + 1] = {-1, ...}; new ztele_countdown[MAXPLAYERS+1] = {-1, ...};
new ztele_count[MAXPLAYERS + 1]; new ztele_count[MAXPLAYERS+1];
new bool:ztele_online = false; new bool:ztele_online = false;
new Handle:ztele_startup_timer = INVALID_HANDLE; new Handle:ztele_startup_timer = INVALID_HANDLE;
new Handle:ztele_countdown_timer[MAXPLAYERS + 1] = {INVALID_HANDLE, ...}; new Handle:ztele_countdown_timer[MAXPLAYERS+1] = {INVALID_HANDLE, ...};
new Handle:ztele_cooldown_timer[MAXPLAYERS + 1] = {INVALID_HANDLE, ...}; new Handle:ztele_cooldown_timer[MAXPLAYERS+1] = {INVALID_HANDLE, ...};
new maxclients; new maxclients;