diff --git a/src/zombiereloaded.sp b/src/zombiereloaded.sp index 67f2835..ceb36ac 100644 --- a/src/zombiereloaded.sp +++ b/src/zombiereloaded.sp @@ -36,7 +36,6 @@ #include "zr/roundend" #include "zr/infect" #include "zr/damage" - #include "zr/menu" #include "zr/event" #include "zr/zadmin" diff --git a/src/zr/cvars.inc b/src/zr/cvars.inc index aa3f34e..82b3e7a 100644 --- a/src/zr/cvars.inc +++ b/src/zr/cvars.inc @@ -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) diff --git a/src/zr/tools.inc b/src/zr/tools.inc index 059da71..703b083 100644 --- a/src/zr/tools.inc +++ b/src/zr/tools.inc @@ -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) diff --git a/src/zr/tools_functions.inc b/src/zr/tools_functions.inc index d6b15ff..a059ab2 100644 --- a/src/zr/tools_functions.inc +++ b/src/zr/tools_functions.inc @@ -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); } diff --git a/src/zr/weapons/weapons.inc b/src/zr/weapons/weapons.inc index fc02f50..06622d1 100644 --- a/src/zr/weapons/weapons.inc +++ b/src/zr/weapons/weapons.inc @@ -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); + } +}