Merged heads.

This commit is contained in:
richard 2009-07-22 14:06:42 +02:00
commit 9077a6ba69
8 changed files with 86 additions and 50 deletions

View File

@ -597,42 +597,6 @@ InfectHumanToZombie(client, attacker = -1, bool:motherinfect = false, bool:respa
ZHPOnHealthInfectGain(attacker);
}
// Switch the player to terrorists.
// TODO: A solution to stop confusing bots? Respawn and teleport?
CS_SwitchTeam(client, CS_TEAM_T);
// If respawn is enabled, then teleport mother zombie back to spawnpoint.
if (motherinfect)
{
new bool:zombierespawn = GetConVarBool(g_hCvarsList[CVAR_INFECT_MZOMBIE_RESPAWN]);
if(zombierespawn)
{
ZTeleTeleportClient(client);
}
}
// Check override.
else
{
if (respawnoverride && respawn)
{
ZTeleTeleportClient(client);
}
}
// Set client as translation target.
SetGlobalTransTarget(client);
// Print message to client.
TranslationPrintToChat(client, "Infect infected");
// Forward event to modules.
ClassOnClientInfected(client, motherinfect);
RoundEndOnClientInfected();
DamageOnClientInfected(client, motherinfect);
SEffectsOnClientInfected(client);
ZTeleOnClientInfected(client);
ZHPOnClientInfected(client);
// Get a list of all client's weapon indexes.
new weapons[WeaponsSlot];
WeaponsGetClientWeapons(client, weapons);
@ -674,6 +638,39 @@ InfectHumanToZombie(client, attacker = -1, bool:motherinfect = false, bool:respa
// Give zombie a new knife. (If you leave the old one there will be glitches with the knife positioning)
GivePlayerItem(client, "weapon_knife");
// Switch the player to terrorists.
// TODO: A solution to stop confusing bots? Respawn and teleport?
CS_SwitchTeam(client, CS_TEAM_T);
// If respawn is enabled, then teleport mother zombie back to spawnpoint.
if (motherinfect)
{
new bool:zombierespawn = GetConVarBool(g_hCvarsList[CVAR_INFECT_MZOMBIE_RESPAWN]);
if(zombierespawn)
{
ZTeleTeleportClient(client);
}
}
// Check override.
else
{
if (respawnoverride && respawn)
{
ZTeleTeleportClient(client);
}
}
// Print message to client.
TranslationPrintToChat(client, "Infect infected");
// Forward event to modules.
ClassOnClientInfected(client, motherinfect);
RoundEndOnClientInfected();
DamageOnClientInfected(client, motherinfect);
SEffectsOnClientInfected(client);
ZTeleOnClientInfected(client);
ZHPOnClientInfected(client);
}
/**

View File

@ -202,9 +202,12 @@ public ZMenuMainHandle(Handle:menu, MenuAction:action, client, slot)
*
* @param client The client index.
* @param handler The menu handler.
* @param team If true, only clients on a team will be displayed.
* @param alive If true, only clients that are alive will be displayed.
* @param dead If true, only clients that are dead will be displayed.
* @param any Title is a translations phrase.
*/
stock MenuClientList(client, MenuHandler:handler, any:...)
stock MenuClientList(client, MenuHandler:handler, bool:team = false, bool:alive = false, bool:dead = false, any:...)
{
// Create menu handle.
new Handle:menu_clients = CreateMenu(handler);
@ -214,7 +217,7 @@ stock MenuClientList(client, MenuHandler:handler, any:...)
// Translate phrase.
decl String:translation[TRANSLATION_MAX_LENGTH_CHAT];
VFormat(translation, sizeof(translation), "%t", 3);
VFormat(translation, sizeof(translation), "%t", 6);
// Set menu title to the translated phrase.
SetMenuTitle(menu_clients, translation);
@ -222,6 +225,8 @@ stock MenuClientList(client, MenuHandler:handler, any:...)
decl String:clientoption[MAX_NAME_LENGTH];
decl String:clientuserid[8];
new count = 0;
// x = Client index.
for (new x = 1; x <= MaxClients; x++)
{
@ -231,12 +236,42 @@ stock MenuClientList(client, MenuHandler:handler, any:...)
continue;
}
// If client isn't on a team, then stop.
if (team && !ZRIsClientOnTeam(x))
{
continue;
}
// If client is dead, then stop.
if (alive && !IsPlayerAlive(x))
{
continue;
}
// If client is alive, then stop.
if (dead && IsPlayerAlive(x))
{
continue;
}
// Get client info.
GetClientName(x, clientoption, sizeof(clientoption));
IntToString(GetClientUserId(x), clientuserid, sizeof(clientuserid));
// Add option to menu.
AddMenuItem(menu_clients, clientuserid, clientoption);
// Increment count.
count++;
}
// If there are no clients, add an "(Empty)" line.
if (count == 0)
{
decl String:empty[64];
Format(empty, sizeof(empty), "%t", "Menu empty");
AddMenuItem(menu_clients, "empty", empty, ITEMDRAW_DISABLED);
}
// Create a "Back" button to the main admin menu.

View File

@ -198,7 +198,7 @@ public Action:NapalmIgniteGrenade(Handle:timer)
for (new x = 0; x <= maxentities; x++)
{
// If entity is invalid, then stop.
if(!IsValidEdict(x))
if(!IsValidEntity(x))
{
continue;
}

View File

@ -72,7 +72,7 @@ RoundStartOnRoundStart()
/**
* Kills all objective entities.
*/
RoundStartKillObjectives()
stock RoundStartKillObjectives()
{
decl String:classname[64];
@ -92,12 +92,10 @@ RoundStartKillObjectives()
GetEdictClassname(x, classname, sizeof(classname));
// Check if it matches any objective entities, then stop if it doesn't.
if(StrContains(ROUNDSTART_OBJECTIVE_ENTITIES, classname) == -1)
if(StrContains(ROUNDSTART_OBJECTIVE_ENTITIES, classname) > -1)
{
continue;
}
// Entity is an objective, kill it.
RemoveEdict(x);
}
}
}

View File

@ -222,6 +222,12 @@ RestrictOnRoundEnd()
*/
public Action:RestrictBuyCommand(client, argc)
{
// If client isn't in-game, then stop.
if (!IsClientInGame(client))
{
return Plugin_Continue;
}
// If player is a zombie, then block command.
if (InfectIsClientInfected(client))
{
@ -242,7 +248,7 @@ public Action:RestrictBuyCommand(client, argc)
// If weapon isn't configged, then allow pickup.
if (index == -1)
{
// Allow pickup.
// Allow command.
return Plugin_Continue;
}

View File

@ -165,7 +165,7 @@ public ZAdminMenuHandle(Handle:menu_zadmin, MenuAction:action, client, slot)
resend = false;
// Send list of clients to infect.
MenuClientList(client, ZSpawnForceHandle, "ZSpawn clients title");
MenuClientList(client, ZSpawnForceHandle, true, false, true, "ZSpawn clients title");
}
// Force ZTele.
case 5:
@ -174,7 +174,7 @@ public ZAdminMenuHandle(Handle:menu_zadmin, MenuAction:action, client, slot)
resend = false;
// Send list of clients to infect.
MenuClientList(client, ZTeleForceHandle, "ZTele clients title");
MenuClientList(client, ZTeleForceHandle, true, true, false, "ZTele clients title");
}
}

View File

@ -302,7 +302,7 @@ public ZSpawnForceHandle(Handle:menu_zspawn_force, MenuAction:action, client, sl
}
// Re-send the menu.
MenuClientList(client, ZSpawnForceHandle, "ZSpawn clients title");
MenuClientList(client, ZSpawnForceHandle, true, false, true, "ZSpawn clients title");
}
// Client closed the menu.
if (action == MenuAction_Cancel)

View File

@ -271,7 +271,7 @@ public ZTeleForceHandle(Handle:menu_ztele_force, MenuAction:action, client, slot
}
// Re-send the menu.
MenuClientList(client, ZTeleForceHandle, "ZTele clients title");
MenuClientList(client, ZTeleForceHandle, true, true, false, "ZTele clients title");
}
// Client closed the menu.
if (action == MenuAction_Cancel)