Added infect option to ZAdmin.
Fixed bug where manual infecting after the round ending caused the plugin to think their was a zombie next round. (Spawn protect activated) Updated translations.
This commit is contained in:
parent
9bc5146b73
commit
1dff60542e
@ -90,6 +90,16 @@
|
|||||||
"en" "Current value:"
|
"en" "Current value:"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"Zombie"
|
||||||
|
{
|
||||||
|
"en" "Zombie"
|
||||||
|
}
|
||||||
|
|
||||||
|
"Human"
|
||||||
|
{
|
||||||
|
"en" "Human"
|
||||||
|
}
|
||||||
|
|
||||||
// Menu
|
// Menu
|
||||||
|
|
||||||
"Menu empty"
|
"Menu empty"
|
||||||
@ -343,6 +353,13 @@
|
|||||||
"ru" "Последний зомби покинул игру и передал свою инфекцию вам."
|
"ru" "Последний зомби покинул игру и передал свою инфекцию вам."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Menu
|
||||||
|
|
||||||
|
"Infect menu clients title"
|
||||||
|
{
|
||||||
|
"en" "Zombie Management\nToggle Infection:\n[] = Infected"
|
||||||
|
}
|
||||||
|
|
||||||
// Commands
|
// Commands
|
||||||
|
|
||||||
"Infect command infect syntax"
|
"Infect command infect syntax"
|
||||||
@ -932,58 +949,23 @@
|
|||||||
// ZAdmin Menu
|
// ZAdmin Menu
|
||||||
// ===========================
|
// ===========================
|
||||||
|
|
||||||
"!zadmin title"
|
"ZAdmin main title"
|
||||||
{
|
{
|
||||||
"en" "ZAdmin\n Select Category:"
|
"en" "ZAdmin\n Select Category:"
|
||||||
}
|
}
|
||||||
|
|
||||||
"!zadmin class multipliers"
|
"ZAdmin main class multipliers"
|
||||||
{
|
{
|
||||||
"en" "Class Multipliers"
|
"en" "Class Multipliers"
|
||||||
}
|
}
|
||||||
|
|
||||||
"!zadmin weapons"
|
"ZAdmin main weapons"
|
||||||
{
|
{
|
||||||
"en" "Weapon Management"
|
"en" "Weapon Management"
|
||||||
}
|
}
|
||||||
|
|
||||||
"!zadmin main logflags"
|
"ZAdmin main zombie"
|
||||||
{
|
{
|
||||||
"en" "Logging Flags"
|
"en" "Zombie Management"
|
||||||
}
|
|
||||||
|
|
||||||
"!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:"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -343,6 +343,9 @@ InfectOnRoundStart()
|
|||||||
// Reset timer handle.
|
// Reset timer handle.
|
||||||
tInfect = INVALID_HANDLE;
|
tInfect = INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tell plugin there are no zombies.
|
||||||
|
g_bZombieSpawned = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -788,6 +791,124 @@ InfectFireEffects(client)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends list of clients to infect/human.
|
||||||
|
*
|
||||||
|
* @param client The client index.
|
||||||
|
*/
|
||||||
|
InfectMenuClients(client)
|
||||||
|
{
|
||||||
|
// Create menu handle.
|
||||||
|
new Handle:menu_infect_clients = CreateMenu(InfectMenuClientsHandle);
|
||||||
|
|
||||||
|
// Set client as translation target.
|
||||||
|
SetGlobalTransTarget(client);
|
||||||
|
|
||||||
|
SetMenuTitle(menu_infect_clients, "%t\n ", "Infect menu clients title");
|
||||||
|
|
||||||
|
decl String:clientoption[MAX_NAME_LENGTH];
|
||||||
|
decl String:clientuserid[8];
|
||||||
|
|
||||||
|
// x = Client index.
|
||||||
|
for (new x = 1; x <= MaxClients; x++)
|
||||||
|
{
|
||||||
|
// If client isn't in-game, then stop.
|
||||||
|
if (!IsClientInGame(x))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If client isn't alive, then stop.
|
||||||
|
if (!IsPlayerAlive(x))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get client info.
|
||||||
|
GetClientName(x, clientoption, sizeof(clientoption));
|
||||||
|
IntToString(GetClientUserId(x), clientuserid, sizeof(clientuserid));
|
||||||
|
|
||||||
|
// Append client's current team to the option.
|
||||||
|
if (InfectIsClientInfected(x))
|
||||||
|
{
|
||||||
|
Format(clientoption, sizeof(clientoption), "%s [%t]", clientoption, "Zombie");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Format(clientoption, sizeof(clientoption), "%s [%t]", clientoption, "Human");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add option to menu.
|
||||||
|
AddMenuItem(menu_infect_clients, clientuserid, clientoption);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a "Back" button to the main admin menu.
|
||||||
|
SetMenuExitBackButton(menu_infect_clients, true);
|
||||||
|
|
||||||
|
// Send menu.
|
||||||
|
DisplayMenu(menu_infect_clients, client, MENU_TIME_FOREVER);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when client selects option in the infect clients 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 InfectMenuClientsHandle(Handle:menu_infect_clients, MenuAction:action, client, slot)
|
||||||
|
{
|
||||||
|
// Client selected an option.
|
||||||
|
if (action == MenuAction_Select)
|
||||||
|
{
|
||||||
|
decl String:clientuserid[8];
|
||||||
|
GetMenuItem(menu_infect_clients, slot, clientuserid, sizeof(clientuserid));
|
||||||
|
|
||||||
|
// Get the targetted client through their userid which was set into the menu slot's info param.
|
||||||
|
new target = GetClientOfUserId(StringToInt(clientuserid));
|
||||||
|
|
||||||
|
// If target has left the server, then stop.
|
||||||
|
if (!target)
|
||||||
|
{
|
||||||
|
// Re-send menu.
|
||||||
|
InfectMenuClients(client);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create an array with a single slot and set target to it.
|
||||||
|
new targets[1];
|
||||||
|
targets[0] = target;
|
||||||
|
|
||||||
|
// Toggle infect on the client.
|
||||||
|
if (InfectIsClientInfected(target))
|
||||||
|
{
|
||||||
|
InfectManualHuman(client, targets, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
InfectManualInfect(client, targets, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Re-send menu.
|
||||||
|
InfectMenuClients(client);
|
||||||
|
}
|
||||||
|
// Client closed the menu.
|
||||||
|
if (action == MenuAction_Cancel)
|
||||||
|
{
|
||||||
|
// Client hit "Back" button.
|
||||||
|
if (slot == MenuCancel_ExitBack)
|
||||||
|
{
|
||||||
|
// Re-open admin menu.
|
||||||
|
ZRAdminMenu(client);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Client hit "Exit" button.
|
||||||
|
else if (action == MenuAction_End)
|
||||||
|
{
|
||||||
|
CloseHandle(menu_infect_clients);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns if a client is infected.
|
* Returns if a client is infected.
|
||||||
*
|
*
|
||||||
@ -825,37 +946,16 @@ bool:InfectIsClientHuman(client)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Command callback (zr_infect)
|
* Infecting a client manually (via zr_infect or the "Zombie Management" menu)
|
||||||
* Infects a client.
|
*
|
||||||
*
|
* @param client The client index infecting another client.
|
||||||
* @param client The client index.
|
* @param targets Array containing all clients to infect.
|
||||||
* @param argc Argument count.
|
* @param count The number of clients in the array.
|
||||||
|
* @param respawnoverride (Optional) True to override respawn cvar.
|
||||||
|
* @param respawn (Optional) True to respawn client on infect.
|
||||||
*/
|
*/
|
||||||
public Action:InfectInfectCommand(client, argc)
|
stock InfectManualInfect(client, targets[], count, bool:respawnoverride = false, bool:respawn = false)
|
||||||
{
|
{
|
||||||
// If not enough arguments given, then stop.
|
|
||||||
if (argc < 1)
|
|
||||||
{
|
|
||||||
TranslationReplyToCommand(client, "Infect command infect syntax");
|
|
||||||
return Plugin_Handled;
|
|
||||||
}
|
|
||||||
|
|
||||||
decl String:target[MAX_NAME_LENGTH], String:targetname[MAX_NAME_LENGTH];
|
|
||||||
new targets[MAXPLAYERS], bool:tn_is_ml, result;
|
|
||||||
|
|
||||||
// Get targetname.
|
|
||||||
GetCmdArg(1, target, sizeof(target));
|
|
||||||
|
|
||||||
// Find a target.
|
|
||||||
result = ProcessTargetString(target, client, targets, sizeof(targets), COMMAND_FILTER_ALIVE , targetname, sizeof(targetname), tn_is_ml);
|
|
||||||
|
|
||||||
// Check if there was a problem finding a client.
|
|
||||||
if (result <= 0)
|
|
||||||
{
|
|
||||||
ZRReplyToTargetError(client, result);
|
|
||||||
return Plugin_Handled;
|
|
||||||
}
|
|
||||||
|
|
||||||
new bool:zombiespawned = g_bZombieSpawned;
|
new bool:zombiespawned = g_bZombieSpawned;
|
||||||
|
|
||||||
// If zombie hasn't spawned, then make targetted player(s) mother zombies.
|
// If zombie hasn't spawned, then make targetted player(s) mother zombies.
|
||||||
@ -891,14 +991,19 @@ public Action:InfectInfectCommand(client, argc)
|
|||||||
g_bZombieSpawned = true;
|
g_bZombieSpawned = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
decl String:targetname[MAX_NAME_LENGTH];
|
||||||
|
|
||||||
// x = Client index.
|
// x = Client index.
|
||||||
for (new x = 0; x < result; x++)
|
for (new x = 0; x < count; x++)
|
||||||
{
|
{
|
||||||
|
// Get client's name for later use.
|
||||||
|
GetClientName(targets[x], targetname, sizeof(targetname));
|
||||||
|
|
||||||
// Check if client is a human before turning into zombie.
|
// Check if client is a human before turning into zombie.
|
||||||
if (!InfectIsClientHuman(targets[x]))
|
if (!InfectIsClientHuman(targets[x]))
|
||||||
{
|
{
|
||||||
// If there was only 1 player targetted, then let admin know the command was unsuccessful.
|
// If there was only 1 player targetted, then let admin know the command was unsuccessful.
|
||||||
if (result == 1)
|
if (count == 1)
|
||||||
{
|
{
|
||||||
// Tell admin command was unsuccessful.
|
// Tell admin command was unsuccessful.
|
||||||
TranslationReplyToCommand(client, "Infect command infect unsuccessful", targetname);
|
TranslationReplyToCommand(client, "Infect command infect unsuccessful", targetname);
|
||||||
@ -907,19 +1012,6 @@ public Action:InfectInfectCommand(client, argc)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
new bool:respawnoverride, bool:respawn;
|
|
||||||
decl String:strRespawn[8];
|
|
||||||
|
|
||||||
// Get respawn parameter.
|
|
||||||
GetCmdArg(2, strRespawn, sizeof(strRespawn));
|
|
||||||
|
|
||||||
// If parameter exists then cast it into a bool and feed it to infect function.
|
|
||||||
if (strRespawn[0])
|
|
||||||
{
|
|
||||||
respawnoverride = true;
|
|
||||||
respawn = bool:StringToInt(strRespawn);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If zombie hasn't spawned, then make targetted player(s) mother zombies.
|
// If zombie hasn't spawned, then make targetted player(s) mother zombies.
|
||||||
if (!zombiespawned)
|
if (!zombiespawned)
|
||||||
{
|
{
|
||||||
@ -927,7 +1019,7 @@ public Action:InfectInfectCommand(client, argc)
|
|||||||
InfectHumanToZombie(targets[x], _, true, respawnoverride, respawn);
|
InfectHumanToZombie(targets[x], _, true, respawnoverride, respawn);
|
||||||
|
|
||||||
// If there was only 1 player targetted, then let admin know the outcome of the command.
|
// If there was only 1 player targetted, then let admin know the outcome of the command.
|
||||||
if (result == 1)
|
if (count == 1)
|
||||||
{
|
{
|
||||||
TranslationReplyToCommand(client, "Infect command infect mother successful", targetname);
|
TranslationReplyToCommand(client, "Infect command infect mother successful", targetname);
|
||||||
}
|
}
|
||||||
@ -939,11 +1031,104 @@ public Action:InfectInfectCommand(client, argc)
|
|||||||
InfectHumanToZombie(targets[x], _, false, respawnoverride, respawn);
|
InfectHumanToZombie(targets[x], _, false, respawnoverride, respawn);
|
||||||
|
|
||||||
// If there was only 1 player targetted, then let admin know the outcome of the command.
|
// If there was only 1 player targetted, then let admin know the outcome of the command.
|
||||||
if (result == 1)
|
if (count == 1)
|
||||||
{
|
{
|
||||||
TranslationReplyToCommand(client, "Infect command infect successful", targetname);
|
TranslationReplyToCommand(client, "Infect command infect successful", targetname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Infecting a client manually (via zr_human or the "Zombie Management" menu)
|
||||||
|
*
|
||||||
|
* @param client The client index changing a zombie to human.
|
||||||
|
* @param targets Array containing all clients to make human.
|
||||||
|
* @param count The number of clients in the array.
|
||||||
|
* @param respawn (Optional) True to respawn client upon changing to human.
|
||||||
|
* @param protect (Optional) True to protect client upon changing to human.
|
||||||
|
*/
|
||||||
|
stock InfectManualHuman(client, targets[], count, bool:respawn = false, bool:protect = false)
|
||||||
|
{
|
||||||
|
decl String:targetname[MAX_NAME_LENGTH];
|
||||||
|
|
||||||
|
// x = Client index.
|
||||||
|
for (new x = 0; x < count; x++)
|
||||||
|
{
|
||||||
|
// Get client's name for later use.
|
||||||
|
GetClientName(targets[x], targetname, sizeof(targetname));
|
||||||
|
|
||||||
|
// Check if client is a human before turning into zombie.
|
||||||
|
if (InfectIsClientInfected(targets[x]))
|
||||||
|
{
|
||||||
|
// Turn client into a zombie.
|
||||||
|
InfectZombieToHuman(targets[x], respawn, protect);
|
||||||
|
|
||||||
|
// If there was only 1 player targetted, then let admin know the outcome of the command.
|
||||||
|
if (count == 1)
|
||||||
|
{
|
||||||
|
// Tell admin command was successful.
|
||||||
|
TranslationReplyToCommand(client, "Infect command human successful", targetname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// If there was only 1 player targetted, then let admin know the command was unsuccessful.
|
||||||
|
if (count == 1)
|
||||||
|
{
|
||||||
|
// Tell admin command was unsuccessful.
|
||||||
|
TranslationReplyToCommand(client, "Infect command human unsuccessful", targetname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Command callback (zr_infect)
|
||||||
|
* Infects a client.
|
||||||
|
*
|
||||||
|
* @param client The client index.
|
||||||
|
* @param argc Argument count.
|
||||||
|
*/
|
||||||
|
public Action:InfectInfectCommand(client, argc)
|
||||||
|
{
|
||||||
|
// If not enough arguments given, then stop.
|
||||||
|
if (argc < 1)
|
||||||
|
{
|
||||||
|
TranslationReplyToCommand(client, "Infect command infect syntax");
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
|
||||||
|
decl String:target[MAX_NAME_LENGTH], String:targetname[MAX_NAME_LENGTH];
|
||||||
|
new targets[MAXPLAYERS], bool:tn_is_ml, result;
|
||||||
|
|
||||||
|
// Get targetname.
|
||||||
|
GetCmdArg(1, target, sizeof(target));
|
||||||
|
|
||||||
|
// Find a target.
|
||||||
|
result = ProcessTargetString(target, client, targets, sizeof(targets), COMMAND_FILTER_ALIVE , targetname, sizeof(targetname), tn_is_ml);
|
||||||
|
|
||||||
|
// Check if there was a problem finding a client.
|
||||||
|
if (result <= 0)
|
||||||
|
{
|
||||||
|
ZRReplyToTargetError(client, result);
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get respawn parameter.
|
||||||
|
decl String:strRespawn[8];
|
||||||
|
GetCmdArg(2, strRespawn, sizeof(strRespawn));
|
||||||
|
|
||||||
|
new bool:respawnoverride, bool:respawn;
|
||||||
|
|
||||||
|
// If parameter exists then cast it into a bool and feed it to infect function.
|
||||||
|
if (strRespawn[0])
|
||||||
|
{
|
||||||
|
respawnoverride = true;
|
||||||
|
respawn = bool:StringToInt(strRespawn);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Infect player.
|
||||||
|
InfectManualInfect(client, targets, result, respawnoverride, respawn);
|
||||||
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
@ -980,43 +1165,17 @@ public Action:InfectHumanCommand(client, argc)
|
|||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
// x = Client index.
|
// Get respawn&protect parameters
|
||||||
for (new x = 0; x < result; x++)
|
decl String:strRespawn[8], String:strProtect[8];
|
||||||
{
|
GetCmdArg(2, strRespawn, sizeof(strRespawn));
|
||||||
// Check if client is a human before turning into zombie.
|
GetCmdArg(3, strProtect, sizeof(strProtect));
|
||||||
if (InfectIsClientInfected(targets[x]))
|
|
||||||
{
|
// If parameter exists then cast it into a bool and feed it to "humanize" function.
|
||||||
new bool:respawn, bool:protect;
|
new bool:respawn = (strRespawn[0]) ? (bool:StringToInt(strRespawn)) : false;
|
||||||
decl String:strRespawn[8], String:strProtect[8];
|
new bool:protect = (strProtect[0]) ? (bool:StringToInt(strProtect)) : false;
|
||||||
|
|
||||||
// Get respawn&protect parameters
|
// Turn client into human.
|
||||||
GetCmdArg(2, strRespawn, sizeof(strRespawn));
|
InfectManualHuman(client, targets, result, respawn, protect);
|
||||||
GetCmdArg(3, strProtect, sizeof(strProtect));
|
|
||||||
|
|
||||||
// If parameter exists then cast it into a bool and feed it to "humanize" function.
|
|
||||||
respawn = (strRespawn[0]) ? (bool:StringToInt(strRespawn)) : false;
|
|
||||||
protect = (strProtect[0]) ? (bool:StringToInt(strProtect)) : false;
|
|
||||||
|
|
||||||
// Turn client into a zombie.
|
|
||||||
InfectZombieToHuman(targets[x], respawn, protect);
|
|
||||||
|
|
||||||
// If there was only 1 player targetted, then let admin know the outcome of the command.
|
|
||||||
if (result == 1)
|
|
||||||
{
|
|
||||||
// Tell admin command was successful.
|
|
||||||
TranslationReplyToCommand(client, "Infect command human successful", targetname);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// If there was only 1 player targetted, then let admin know the command was unsuccessful.
|
|
||||||
if (result == 1)
|
|
||||||
{
|
|
||||||
// Tell admin command was unsuccessful.
|
|
||||||
TranslationReplyToCommand(client, "Infect command human unsuccessful", targetname);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
@ -162,12 +162,16 @@ public Action:SpawnProtectTimer(Handle:timer, any:client)
|
|||||||
// If client leaves, then stop timer.
|
// If client leaves, then stop timer.
|
||||||
if (!IsClientInGame(client))
|
if (!IsClientInGame(client))
|
||||||
{
|
{
|
||||||
|
// Reset timer handle.
|
||||||
|
tSpawnProtect[client] = INVALID_HANDLE;
|
||||||
return Plugin_Stop;
|
return Plugin_Stop;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If client has become a zombie, then stop timer.
|
// If client has become a zombie, then stop timer.
|
||||||
if (!InfectIsClientHuman(client))
|
if (!InfectIsClientHuman(client))
|
||||||
{
|
{
|
||||||
|
// Reset timer handle.
|
||||||
|
tSpawnProtect[client] = INVALID_HANDLE;
|
||||||
return Plugin_Stop;
|
return Plugin_Stop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ new g_iWeaponsCurType[MAXPLAYERS + 1];
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends main weapon menu to client.
|
* Sends main weapon menu to client.
|
||||||
|
*
|
||||||
* @param client The client index.
|
* @param client The client index.
|
||||||
*/
|
*/
|
||||||
bool:WeaponsMenuMain(client)
|
bool:WeaponsMenuMain(client)
|
||||||
@ -71,6 +72,7 @@ bool:WeaponsMenuMain(client)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when client selects option in the weapons main menu, and handles it.
|
* Called when client selects option in the weapons main menu, and handles it.
|
||||||
|
*
|
||||||
* @param menu_weapons_main Handle of the menu being used.
|
* @param menu_weapons_main Handle of the menu being used.
|
||||||
* @param action The action done on the menu (see menus.inc, enum MenuAction).
|
* @param action The action done on the menu (see menus.inc, enum MenuAction).
|
||||||
* @param client The client index.
|
* @param client The client index.
|
||||||
@ -114,6 +116,7 @@ public WeaponsMenuMainHandle(Handle:menu_weapons_main, MenuAction:action, client
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends weapon type list to client.
|
* Sends weapon type list to client.
|
||||||
|
*
|
||||||
* @param client The client index.
|
* @param client The client index.
|
||||||
*/
|
*/
|
||||||
WeaponsMenuTypes(client)
|
WeaponsMenuTypes(client)
|
||||||
@ -155,6 +158,7 @@ WeaponsMenuTypes(client)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when client selects option in the weapons list menu, and handles it.
|
* Called when client selects option in the weapons list menu, and handles it.
|
||||||
|
*
|
||||||
* @param menu_weapons_types Handle of the menu being used.
|
* @param menu_weapons_types Handle of the menu being used.
|
||||||
* @param action The action done on the menu (see menus.inc, enum MenuAction).
|
* @param action The action done on the menu (see menus.inc, enum MenuAction).
|
||||||
* @param client The client index.
|
* @param client The client index.
|
||||||
@ -189,6 +193,7 @@ public WeaponsMenuTypesHandle(Handle:menu_weapons_types, MenuAction:action, clie
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a list of weapons of a certain type in a menu to the client.
|
* Sends a list of weapons of a certain type in a menu to the client.
|
||||||
|
*
|
||||||
* @param client The client index.
|
* @param client The client index.
|
||||||
*/
|
*/
|
||||||
WeaponsMenuTypeWeapons(client)
|
WeaponsMenuTypeWeapons(client)
|
||||||
@ -249,6 +254,7 @@ WeaponsMenuTypeWeapons(client)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when client selects option in the weapon group menu, and handles it.
|
* Called when client selects option in the weapon group menu, and handles it.
|
||||||
|
*
|
||||||
* @param menu_weapons_typeweapons Handle of the menu being used.
|
* @param menu_weapons_typeweapons Handle of the menu being used.
|
||||||
* @param action The action done on the menu (see menus.inc, enum MenuAction).
|
* @param action The action done on the menu (see menus.inc, enum MenuAction).
|
||||||
* @param client The client index.
|
* @param client The client index.
|
||||||
@ -338,6 +344,7 @@ public WeaponsMenuTypeWeaponsHandle(Handle:menu_weapons_typeweapons, MenuAction:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends ZMarket options menu to client.
|
* Sends ZMarket options menu to client.
|
||||||
|
*
|
||||||
* @param client The client index.
|
* @param client The client index.
|
||||||
*/
|
*/
|
||||||
WeaponsMenuZMarket(client)
|
WeaponsMenuZMarket(client)
|
||||||
@ -368,6 +375,7 @@ WeaponsMenuZMarket(client)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when client selects option in the weapons main menu, and handles it.
|
* Called when client selects option in the weapons main menu, and handles it.
|
||||||
|
*
|
||||||
* @param menu_weapons_market Handle of the menu being used.
|
* @param menu_weapons_market Handle of the menu being used.
|
||||||
* @param action The action done on the menu (see menus.inc, enum MenuAction).
|
* @param action The action done on the menu (see menus.inc, enum MenuAction).
|
||||||
* @param client The client index.
|
* @param client The client index.
|
||||||
|
@ -72,44 +72,43 @@ bool:ZRAdminMenu(client)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create menu handle.
|
// Create menu handle.
|
||||||
new Handle:menu = CreateMenu(ZRAdminMenuHandle);
|
new Handle:menu_zadmin = CreateMenu(ZRAdminMenuHandle);
|
||||||
|
|
||||||
// Set translation target as the client.
|
// Set translation target as the client.
|
||||||
SetGlobalTransTarget(client);
|
SetGlobalTransTarget(client);
|
||||||
|
|
||||||
SetMenuTitle(menu, "%t\n ", "!zadmin title");
|
SetMenuTitle(menu_zadmin, "%t\n ", "ZAdmin main title");
|
||||||
|
|
||||||
decl String:classmultipliers[64];
|
decl String:classmultipliers[64];
|
||||||
//decl String:infect[64];
|
|
||||||
//decl String:zspawn[64];
|
//decl String:zspawn[64];
|
||||||
//decl String:ztele[64];
|
//decl String:ztele[64];
|
||||||
decl String:weapons[64];
|
decl String:weapons[64];
|
||||||
|
decl String:infect[64];
|
||||||
//decl String:logflags[64];
|
//decl String:logflags[64];
|
||||||
|
|
||||||
Format(classmultipliers, sizeof(classmultipliers), "%t", "!zadmin class multipliers");
|
Format(classmultipliers, sizeof(classmultipliers), "%t", "ZAdmin main class multipliers");
|
||||||
//Format(infect, sizeof(infect), "%t", "!zadmin main infect");
|
Format(weapons, sizeof(weapons), "%t", "ZAdmin main weapons");
|
||||||
|
Format(infect, sizeof(infect), "%t", "ZAdmin main zombie");
|
||||||
//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(weapons, sizeof(weapons), "%t", "!zadmin weapons");
|
|
||||||
//Format(logflags, sizeof(logflags), "%t", "!zadmin main logflags");
|
//Format(logflags, sizeof(logflags), "%t", "!zadmin main logflags");
|
||||||
|
|
||||||
AddMenuItem(menu, "classmultipliers", classmultipliers);
|
AddMenuItem(menu_zadmin, "classmultipliers", classmultipliers);
|
||||||
//AddMenuItem(menu_zadmin, "infect", infect);
|
AddMenuItem(menu_zadmin, "weapons", weapons);
|
||||||
|
AddMenuItem(menu_zadmin, "infect", infect);
|
||||||
//AddMenuItem(menu_zadmin, "zspawn", zspawn);
|
//AddMenuItem(menu_zadmin, "zspawn", zspawn);
|
||||||
//AddMenuItem(menu_zadmin, "ztele", ztele, ITEMDRAW_DISABLED);
|
//AddMenuItem(menu_zadmin, "ztele", ztele, ITEMDRAW_DISABLED);
|
||||||
AddMenuItem(menu, "weapons", weapons);
|
|
||||||
//AddMenuItem(menu_zadmin, "logflags", logflags);
|
//AddMenuItem(menu_zadmin, "logflags", logflags);
|
||||||
|
|
||||||
// Set "Back" button.
|
// Set "Back" button.
|
||||||
SetMenuExitBackButton(menu, true);
|
SetMenuExitBackButton(menu_zadmin, true);
|
||||||
|
|
||||||
// Send menu to client.
|
// Send menu to client.
|
||||||
DisplayMenu(menu, client, MENU_TIME_FOREVER);
|
DisplayMenu(menu_zadmin, client, MENU_TIME_FOREVER);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ZRAdminMenuHandle(Handle:menu, MenuAction:action, client, slot)
|
|
||||||
/**
|
/**
|
||||||
* Menu callback (zadmin)
|
* Menu callback (zadmin)
|
||||||
* Handles options selected in the admin menu.
|
* Handles options selected in the admin menu.
|
||||||
@ -119,6 +118,7 @@ public ZRAdminMenuHandle(Handle:menu, MenuAction:action, client, slot)
|
|||||||
* @param client The client index.
|
* @param client The client index.
|
||||||
* @param slot The menu slot selected. (starting from 0)
|
* @param slot The menu slot selected. (starting from 0)
|
||||||
*/
|
*/
|
||||||
|
public ZRAdminMenuHandle(Handle:menu_zadmin, MenuAction:action, client, slot)
|
||||||
{
|
{
|
||||||
if (action == MenuAction_Select)
|
if (action == MenuAction_Select)
|
||||||
{
|
{
|
||||||
@ -127,16 +127,25 @@ public ZRAdminMenuHandle(Handle:menu, MenuAction:action, client, slot)
|
|||||||
|
|
||||||
switch(slot)
|
switch(slot)
|
||||||
{
|
{
|
||||||
|
// Class multipliers.
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
resend = !ClassTeamSelect(client);
|
resend = !ClassTeamSelect(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Weapon management.
|
// Weapon management.
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
resend = !WeaponsMenuMain(client);
|
resend = !WeaponsMenuMain(client);
|
||||||
}
|
}
|
||||||
|
// Zombie management.
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
// We're not resending this menu.
|
||||||
|
resend = false;
|
||||||
|
|
||||||
|
// Send list of clients to infect.
|
||||||
|
InfectMenuClients(client);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Re-send menu if selection failed.
|
// Re-send menu if selection failed.
|
||||||
@ -156,184 +165,6 @@ public ZRAdminMenuHandle(Handle:menu, MenuAction:action, client, slot)
|
|||||||
}
|
}
|
||||||
else if (action == MenuAction_End)
|
else if (action == MenuAction_End)
|
||||||
{
|
{
|
||||||
CloseHandle(menu);
|
CloseHandle(menu_zadmin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*ZRInfectMenu(client)
|
|
||||||
{
|
|
||||||
new Handle:menu_infect = CreateMenu(ZRInfectHandle);
|
|
||||||
|
|
||||||
SetGlobalTransTarget(client);
|
|
||||||
|
|
||||||
SetMenuTitle(menu_infect, "%t\n ", "!zadmin infect title");
|
|
||||||
|
|
||||||
AddTargetsToMenu(menu_infect, client, true, true);
|
|
||||||
|
|
||||||
SetMenuExitBackButton(menu_infect, true);
|
|
||||||
|
|
||||||
DisplayMenu(menu_infect, client, MENU_TIME_FOREVER);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/*public ZRInfectHandle(Handle:menu_infect, MenuAction:action, client, slot)
|
|
||||||
{
|
|
||||||
if (action == MenuAction_Select)
|
|
||||||
{
|
|
||||||
decl String:info[32];
|
|
||||||
new userid, target;
|
|
||||||
|
|
||||||
GetMenuItem(menu_infect, slot, info, sizeof(info));
|
|
||||||
userid = StringToInt(info);
|
|
||||||
|
|
||||||
if ((target = GetClientOfUserId(userid)) == 0)
|
|
||||||
{
|
|
||||||
ReplyToCommand(client, "[ZR] Player no longer available");
|
|
||||||
}
|
|
||||||
else if (!CanUserTarget(client, target))
|
|
||||||
{
|
|
||||||
ReplyToCommand(client, "[ZR] Unable to target player");
|
|
||||||
}
|
|
||||||
else if (!IsPlayerAlive(target))
|
|
||||||
{
|
|
||||||
ReplyToCommand(client, "[ZR] Player is dead");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
decl String:name[64];
|
|
||||||
GetClientName(target, name, sizeof(name));
|
|
||||||
InfectHumanToZombie(target);
|
|
||||||
ShowActivity2(client, "[ZR] ", "Infected %s", name);
|
|
||||||
ZRInfectMenu(client);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (action == MenuAction_Cancel)
|
|
||||||
{
|
|
||||||
if (slot == MenuCancel_ExitBack)
|
|
||||||
{
|
|
||||||
ZRAdminMenu(client);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (action == MenuAction_End)
|
|
||||||
{
|
|
||||||
CloseHandle(menu_infect);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/*ZRSpawnAll(client)
|
|
||||||
{
|
|
||||||
// x = client index.
|
|
||||||
for (new x = 1; x < MaxClients; x++)
|
|
||||||
{
|
|
||||||
if (IsClientInGame(x))
|
|
||||||
{
|
|
||||||
ZSpawnClient(x);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ZRAdminMenu(client);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/*ZRZTeleMenu(client)
|
|
||||||
{
|
|
||||||
new Handle:menu_ztele = CreateMenu(ZRTeleHandle);
|
|
||||||
|
|
||||||
SetGlobalTransTarget(client);
|
|
||||||
|
|
||||||
SetMenuTitle(menu_ztele, "%t\n ", "!zadmin ztele title");
|
|
||||||
|
|
||||||
decl String:ztele_spawntele[64];
|
|
||||||
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:menu_ztele , MenuAction:action, client, slot)
|
|
||||||
{
|
|
||||||
if (action == MenuAction_Select)
|
|
||||||
{
|
|
||||||
switch(slot)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
{
|
|
||||||
// Teleport player.
|
|
||||||
}
|
|
||||||
case 1:
|
|
||||||
{
|
|
||||||
// Abort teleport.
|
|
||||||
}
|
|
||||||
case 2:
|
|
||||||
{
|
|
||||||
// Save location.
|
|
||||||
}
|
|
||||||
case 3:
|
|
||||||
{
|
|
||||||
// Teleport to location.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (action == MenuAction_Cancel)
|
|
||||||
{
|
|
||||||
if (slot == MenuCancel_ExitBack)
|
|
||||||
{
|
|
||||||
ZRAdminMenu(client);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (action == MenuAction_End)
|
|
||||||
{
|
|
||||||
CloseHandle(menu_ztele);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/*ZRLogFlagsMenu(client)
|
|
||||||
{
|
|
||||||
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 item_state = (client_flags & ADMFLAG_ROOT) ? ITEMDRAW_DEFAULT : ITEMDRAW_DISABLED;
|
|
||||||
|
|
||||||
//decl String:z_log_core[64];
|
|
||||||
|
|
||||||
//Format(z_log_core, sizeof(z_log_core), "Log core events (%d)", LogCheckFlag(LOG_CORE_EVENTS));
|
|
||||||
|
|
||||||
//AddMenuItem(menu_log_flags, z_log_core, z_log_core, item_state);
|
|
||||||
|
|
||||||
SetMenuExitBackButton(menu_log_flags, true);
|
|
||||||
DisplayMenu(menu_log_flags, client, MENU_TIME_FOREVER);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/*public ZRLogFlagsMenuHandle(Handle:menu_log_flags, MenuAction:action, client, slot)
|
|
||||||
{
|
|
||||||
if (action == MenuAction_Select)
|
|
||||||
{
|
|
||||||
switch(slot)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (action == MenuAction_Cancel)
|
|
||||||
{
|
|
||||||
if (slot == MenuCancel_ExitBack)
|
|
||||||
{
|
|
||||||
ZRAdminMenu(client);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (action == MenuAction_End)
|
|
||||||
{
|
|
||||||
CloseHandle(menu_log_flags);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
@ -61,6 +61,9 @@ Float:ZRConvertUnitsFloat(Float:number, Float:conversion)
|
|||||||
*
|
*
|
||||||
* @param arrayEligibleClients The handle of the array, don't forget to call CloseHandle
|
* @param arrayEligibleClients The handle of the array, don't forget to call CloseHandle
|
||||||
* on it when finished!
|
* on it when finished!
|
||||||
|
* @param team Client is only eligible if on a team.
|
||||||
|
* @param alive Client is only eligible if alive.
|
||||||
|
* @param human Client is only eligible if human.
|
||||||
* @param immunity True to ignore clients immune from mother infect, false to count them.
|
* @param immunity True to ignore clients immune from mother infect, false to count them.
|
||||||
*/
|
*/
|
||||||
stock ZRCreateEligibleClientList(&Handle:arrayEligibleClients, bool:team = false, bool:alive = false, bool:human = false)
|
stock ZRCreateEligibleClientList(&Handle:arrayEligibleClients, bool:team = false, bool:alive = false, bool:human = false)
|
||||||
|
Loading…
Reference in New Issue
Block a user