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:
parent
a6e55b6653
commit
e9c611b476
|
@ -36,7 +36,6 @@
|
||||||
#include "zr/roundend"
|
#include "zr/roundend"
|
||||||
#include "zr/infect"
|
#include "zr/infect"
|
||||||
#include "zr/damage"
|
#include "zr/damage"
|
||||||
|
|
||||||
#include "zr/menu"
|
#include "zr/menu"
|
||||||
#include "zr/event"
|
#include "zr/event"
|
||||||
#include "zr/zadmin"
|
#include "zr/zadmin"
|
||||||
|
|
|
@ -421,7 +421,7 @@ CvarsCreate()
|
||||||
g_hCvarsList[CVAR_SPAWNPROTECT] = CreateConVar("zr_spawnprotect", "1", "");
|
g_hCvarsList[CVAR_SPAWNPROTECT] = CreateConVar("zr_spawnprotect", "1", "");
|
||||||
g_hCvarsList[CVAR_SPAWNPROTECT_TIME] = CreateConVar("zr_spawnprotect_time", "10", "");
|
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_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)
|
// Respawn (module)
|
||||||
|
|
|
@ -22,8 +22,6 @@ new g_iToolsCollisionGroup;
|
||||||
new g_iToolsAccount;
|
new g_iToolsAccount;
|
||||||
new g_iToolsDefaultFOV;
|
new g_iToolsDefaultFOV;
|
||||||
new g_iToolsInBuyZone;
|
new g_iToolsInBuyZone;
|
||||||
new g_iToolsRender;
|
|
||||||
new g_iToolsRenderMode;
|
|
||||||
new g_iToolsActiveWeapon;
|
new g_iToolsActiveWeapon;
|
||||||
/**
|
/**
|
||||||
* @endsection
|
* @endsection
|
||||||
|
@ -123,20 +121,6 @@ ToolsFindOffsets()
|
||||||
LogMessageFormatted(-1, "Tools", "Offsets", "Offset \"CCSPlayer::m_bInBuyZone\" was not found.", LOG_FORMAT_TYPE_FATALERROR);
|
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.
|
// If offset "m_hActiveWeapon" can't be found, then stop the plugin.
|
||||||
g_iToolsActiveWeapon = FindSendPropInfo("CBasePlayer", "m_hActiveWeapon");
|
g_iToolsActiveWeapon = FindSendPropInfo("CBasePlayer", "m_hActiveWeapon");
|
||||||
if (g_iToolsActiveWeapon == -1)
|
if (g_iToolsActiveWeapon == -1)
|
||||||
|
|
|
@ -139,12 +139,22 @@ ToolsClientScore(client, bool:score = true, bool:apply = true, value = 0)
|
||||||
*
|
*
|
||||||
* @param client The client index.
|
* @param client The client index.
|
||||||
* @param alpha The alpha value to set client's alpha to. (0-255)
|
* @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.
|
// Turn rendermode on, on the client.
|
||||||
SetEntData(client, g_iToolsRenderMode, 3, 1, true);
|
SetEntityRenderMode(client, RENDER_TRANSALPHA);
|
||||||
|
|
||||||
// Set alpha value on the client.
|
// 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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -378,3 +378,33 @@ WeaponForceClientDrop(client, weapon)
|
||||||
// Force client to drop weapon.
|
// Force client to drop weapon.
|
||||||
SDKCall(g_hToolsCSWeaponDrop, client, weapon, true, false);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user