ToolsSetClientAlpha now has option to change weapon alpha too. weaponsalpha module needed to track weapon alphas on pickup and drop. Removed alpha offsets, as it's already supposed by SM natives.

This commit is contained in:
Greyscale 2009-05-08 07:37:07 +02:00
parent a6e55b6653
commit e9c611b476
5 changed files with 44 additions and 21 deletions

View File

@ -36,7 +36,6 @@
#include "zr/roundend"
#include "zr/infect"
#include "zr/damage"
#include "zr/menu"
#include "zr/event"
#include "zr/zadmin"

View File

@ -421,7 +421,7 @@ CvarsCreate()
g_hCvarsList[CVAR_SPAWNPROTECT] = CreateConVar("zr_spawnprotect", "1", "");
g_hCvarsList[CVAR_SPAWNPROTECT_TIME] = CreateConVar("zr_spawnprotect_time", "10", "");
g_hCvarsList[CVAR_SPAWNPROTECT_SPEED] = CreateConVar("zr_spawnprotect_speed", "600.0", "");
g_hCvarsList[CVAR_SPAWNPROTECT_ALPHA] = CreateConVar("zr_spawnprotect_speed", "0", "");
g_hCvarsList[CVAR_SPAWNPROTECT_ALPHA] = CreateConVar("zr_spawnprotect_alpha", "0", "");
// ===========================
// Respawn (module)

View File

@ -22,8 +22,6 @@ new g_iToolsCollisionGroup;
new g_iToolsAccount;
new g_iToolsDefaultFOV;
new g_iToolsInBuyZone;
new g_iToolsRender;
new g_iToolsRenderMode;
new g_iToolsActiveWeapon;
/**
* @endsection
@ -123,20 +121,6 @@ ToolsFindOffsets()
LogMessageFormatted(-1, "Tools", "Offsets", "Offset \"CCSPlayer::m_bInBuyZone\" was not found.", LOG_FORMAT_TYPE_FATALERROR);
}
// If offset "m_clrRender" can't be found, then stop the plugin.
g_iToolsRender = FindSendPropInfo("CAI_BaseNPC", "m_clrRender");
if (g_iToolsRender == -1)
{
LogMessageFormatted(-1, "Tools", "Offsets", "Offset \"CAI_BaseNPC::m_clrRender\" was not found.", LOG_FORMAT_TYPE_FATALERROR);
}
// If offset "m_nRenderMode" can't be found, then stop the plugin.
g_iToolsRenderMode = FindSendPropInfo("CBaseAnimating", "m_nRenderMode");
if (g_iToolsRenderMode == -1)
{
LogMessageFormatted(-1, "Tools", "Offsets", "Offset \"CBaseAnimating::m_nRenderMode\" was not found.", LOG_FORMAT_TYPE_FATALERROR);
}
// If offset "m_hActiveWeapon" can't be found, then stop the plugin.
g_iToolsActiveWeapon = FindSendPropInfo("CBasePlayer", "m_hActiveWeapon");
if (g_iToolsActiveWeapon == -1)

View File

@ -139,12 +139,22 @@ ToolsClientScore(client, bool:score = true, bool:apply = true, value = 0)
*
* @param client The client index.
* @param alpha The alpha value to set client's alpha to. (0-255)
* @param weapons Apply alpha to all client's weapons.
*/
ToolsSetClientAlpha(client, alpha)
ToolsSetClientAlpha(client, alpha, bool:bWeapons = true)
{
// Turn rendermode on, on the client.
SetEntData(client, g_iToolsRenderMode, 3, 1, true);
SetEntityRenderMode(client, RENDER_TRANSALPHA);
// Set alpha value on the client.
SetEntData(client, g_iToolsRender + 3, alpha, 1, true);
SetEntityRenderColor(client, _, _, _, alpha);
// If bWeapons is false, then stop.
if (!bWeapons)
{
return;
}
// Set client's weapons' alpha.
WeaponSetWeaponAlpha(client, alpha);
}

View File

@ -378,3 +378,33 @@ WeaponForceClientDrop(client, weapon)
// Force client to drop weapon.
SDKCall(g_hToolsCSWeaponDrop, client, weapon, true, false);
}
/**
* Set's the alpha on a client's weapons.
*
* @param client The client index.
* @param alpha The alpha to set the weapons to.
*/
WeaponSetWeaponAlpha(client, alpha)
{
// Get client's list of weapons.
new weapons[WeaponsType];
WeaponsGetClientWeapons(client, weapons);
// Loop through array slots and set alpha.
// x = weapon slot.
for (new x = 0; x < WEAPONS_SLOTS_MAX; x++)
{
// If weapon is invalid, then stop.
if (weapons[x] == -1)
{
continue;
}
// Turn rendermode on, on the weapon.
SetEntityRenderMode(weapons[x], RENDER_TRANSALPHA);
// Set alpha value on the weapon.
SetEntityRenderColor(weapons[x], _, _, _, alpha);
}
}