2009-04-06 03:20:13 +02:00
|
|
|
/*
|
|
|
|
* ============================================================================
|
|
|
|
*
|
|
|
|
* Zombie:Reloaded
|
|
|
|
*
|
|
|
|
* File: clientoverlays.inc
|
|
|
|
* Description: Handles overlays on clients, as a part of class attributes.
|
|
|
|
*
|
|
|
|
* ============================================================================
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Timer handles for redisplaying overlays on clients.
|
|
|
|
*/
|
|
|
|
new Handle:tOverlay[MAXPLAYERS + 1];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Specifies if a client have a overlay.
|
|
|
|
*/
|
|
|
|
new bClientHasOverlay[MAXPLAYERS + 1];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Tells wether the overlay is on or not.
|
|
|
|
*/
|
|
|
|
new bClientOverlayOn[MAXPLAYERS + 1];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Path to the currently active overlay.
|
|
|
|
*/
|
2009-04-18 01:44:41 +02:00
|
|
|
new String:ActiveOverlay[MAXPLAYERS + 1][PLATFORM_MAX_PATH];
|
2009-04-06 03:20:13 +02:00
|
|
|
|
|
|
|
bool:ClientHasOverlay(client)
|
|
|
|
{
|
|
|
|
return bClientHasOverlay[client];
|
|
|
|
}
|
|
|
|
|
2009-04-11 01:56:22 +02:00
|
|
|
ClassOverlayInitialize(client, const String:overlay[])
|
2009-04-06 03:20:13 +02:00
|
|
|
{
|
|
|
|
if (IsFakeClient(client))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (strlen(overlay) == 0)
|
|
|
|
{
|
|
|
|
bClientHasOverlay[client] = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
bClientHasOverlay[client] = true;
|
|
|
|
strcopy(ActiveOverlay[client], PLATFORM_MAX_PATH, overlay);
|
|
|
|
|
|
|
|
ClassOverlayStart(client);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ClassOverlayStart(client)
|
|
|
|
{
|
|
|
|
// Kill timer if it exist.
|
|
|
|
if (tOverlay[client] != INVALID_HANDLE)
|
|
|
|
{
|
|
|
|
KillTimer(tOverlay[client]);
|
|
|
|
tOverlay[client] = INVALID_HANDLE;
|
|
|
|
}
|
|
|
|
|
2009-04-11 01:56:22 +02:00
|
|
|
ClientCommand(client, "r_screenoverlay \"%s\"", ActiveOverlay[client]);
|
2009-04-06 03:20:13 +02:00
|
|
|
bClientOverlayOn[client] = true;
|
|
|
|
|
2009-04-20 02:56:26 +02:00
|
|
|
new Float:redisplay = GetConVarFloat(g_hCvarsList[CVAR_OVERLAY_REDISPLAY]);
|
2009-04-06 03:20:13 +02:00
|
|
|
tOverlay[client] = CreateTimer(redisplay, ClassOverlayTimer, client, TIMER_REPEAT);
|
|
|
|
}
|
|
|
|
|
|
|
|
ClassOverlayStop(client)
|
|
|
|
{
|
|
|
|
// Kill timer if it exist.
|
|
|
|
if (tOverlay[client] != INVALID_HANDLE)
|
|
|
|
{
|
|
|
|
KillTimer(tOverlay[client]);
|
|
|
|
tOverlay[client] = INVALID_HANDLE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Disable client overlay.
|
|
|
|
ClientCommand(client, "r_screenoverlay \"\"");
|
|
|
|
bClientOverlayOn[client] = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Action:ClassOverlayTimer(Handle:timer, any:client)
|
|
|
|
{
|
|
|
|
if (!IsClientInGame(client) || !IsPlayerZombie(client))
|
|
|
|
{
|
|
|
|
tOverlay[client] = INVALID_HANDLE;
|
|
|
|
return Plugin_Stop;
|
|
|
|
}
|
|
|
|
|
|
|
|
ClientCommand(client, "r_screenoverlay \"%s\"", ActiveOverlay[client]);
|
|
|
|
return Plugin_Continue;
|
|
|
|
}
|