Merged heads. Fixed conflicts in zadmin.inc.

This commit is contained in:
richard
2009-06-18 02:15:42 +02:00
29 changed files with 848 additions and 316 deletions

View File

@ -25,16 +25,56 @@
* ============================================================================
*/
/**
* Create commands specific to ZAdmin.
*/
ZAdminOnCommandsCreate()
{
// Register ZAdmin command.
RegConsoleCmd(SAYHOOKS_KEYWORD_ZADMIN, ZAdminCommand, "Opens ZR admin menu.");
}
/**
* Command callback (zadmin)
* Opens ZR admin menu.
*
* @param client The client index.
* @param argc Argument count.
*/
public Action:ZAdminCommand(client, argc)
{
// If client is console, then stop and tell them this feature is for players only.
if (ZRIsConsole(client))
{
TranslationPrintToServer("Must be player");
return Plugin_Handled;
}
// Send admin menu.
ZRAdminMenu(client);
// This stops the "Unknown command" message in client's console.
return Plugin_Handled;
}
/**
* Main admin menu.
*
* @param client The client index.
*/
bool:ZRAdminMenu(client)
{
// If client isn't an admin, then stop.
if (!ZRIsClientAdmin(client))
{
TranslationPrintToChat(client, "Must be admin");
return false;
}
// Create menu handle.
new Handle:menu = CreateMenu(ZRAdminMenuHandle);
// Set translation target as the client.
SetGlobalTransTarget(client);
SetMenuTitle(menu, "%t\n ", "!zadmin title");
@ -70,6 +110,15 @@ bool:ZRAdminMenu(client)
}
public ZRAdminMenuHandle(Handle:menu, MenuAction:action, client, slot)
/**
* Menu callback (zadmin)
* Handles options selected in the admin menu.
*
* @param menu The menu handle.
* @param action Action client is doing in menu.
* @param client The client index.
* @param slot The menu slot selected. (starting from 0)
*/
{
if (action == MenuAction_Select)
{
@ -152,7 +201,7 @@ public ZRAdminMenuHandle(Handle:menu, MenuAction:action, client, slot)
{
decl String:name[64];
GetClientName(target, name, sizeof(name));
InfectClient(target);
InfectHumanToZombie(target);
ShowActivity2(client, "[ZR] ", "Infected %s", name);
ZRInfectMenu(client);
}