Fixed weaponalpha from changing weapon's rendermode before spawn which caused display problems.

This commit is contained in:
Greyscale 2009-05-18 23:14:18 -07:00
parent 0b3524e8df
commit d466ab8b24
4 changed files with 71 additions and 6 deletions

View File

@ -71,6 +71,7 @@ public Action:EventRoundStart(Handle:event, const String:name[], bool:dontBroadc
// Forward event to sub-modules.
OverlaysOnRoundStart();
WeaponsOnRoundStart();
RoundEndOnRoundStart();
InfectOnRoundStart();
SEffectsOnRoundStart();
@ -111,6 +112,7 @@ public Action:EventRoundEnd(Handle:event, const String:name[], bool:dontBroadcas
new reason = GetEventInt(event, "reason");
// Forward event to modules.
WeaponsOnRoundEnd();
RoundEndOnRoundEnd(reason);
InfectOnRoundEnd();
SEffectsOnRoundEnd();
@ -202,6 +204,12 @@ public Action:EventPlayerSpawn(Handle:event, const String:name[], bool:dontBroad
*/
public Action:EventPlayerSpawnPost(Handle:timer, any:index)
{
// If client isn't in-game, then stop.
if (!IsClientInGame(index))
{
return;
}
// Forward event to modules.
SpawnProtectOnClientSpawnPost(index);
}

View File

@ -374,12 +374,6 @@ WpnRestrictQuery:RestrictUnrestrict(const String:weapon[], String:display[] = ""
// Check if weapon is a custom group name.
if (RestrictIsWeaponGroup(weapon))
{
// Return restrict failed if group isn't restricted.
if (RestrictIsGroupUnrestricted(weapon))
{
return Failed_Group;
}
// Jump to weapon group key.
KvRewind(kvWeaponGroups);
KvJumpToKey(kvWeaponGroups, weapon);
@ -387,6 +381,12 @@ WpnRestrictQuery:RestrictUnrestrict(const String:weapon[], String:display[] = ""
// Get display name of the weapon group.
KvGetSectionName(kvWeaponGroups, display, WEAPONS_MAX_LENGTH);
// Return restrict failed if group isn't restricted.
if (RestrictIsGroupUnrestricted(weapon))
{
return Failed_Group;
}
// Traverse into the group's weapons.
if (KvGotoFirstSubKey(kvWeaponGroups))
{

View File

@ -20,6 +20,11 @@
*/
new g_iWeaponDropHookID[MAXPLAYERS + 1] = {-1, ...};
/**
* Global variable that stops render mode modifying
*/
new bool:g_bWeaponAlpha;
/**
* Client is joining the server.
*
@ -46,6 +51,26 @@ WeaponAlphaOnClientDisconnect(client)
}
}
/**
* The round is starting.
*/
WeaponAlphaOnRoundStart()
{
// Allow weapon render mode to be modified.
g_bWeaponAlpha = true;
}
/**
* The round is ending.
*
* @param reason Reason the round has ended.
*/
WeaponAlphaOnRoundEnd()
{
// Disallow weapon render mode to be modified.
g_bWeaponAlpha = false;
}
/**
* Client has just picked up a weapon.
*
@ -54,6 +79,12 @@ WeaponAlphaOnClientDisconnect(client)
*/
WeaponAlphaOnItemPickup(client, weapon)
{
// If weapon alpha updating is disabled, then stop.
if (!g_bWeaponAlpha)
{
return;
}
// Get client's current alpha.
new alpha = ToolsGetEntityAlpha(client);
@ -70,6 +101,12 @@ WeaponAlphaOnItemPickup(client, weapon)
*/
public ZRTools_Action:WeaponAlphaDrop(client, weapon)
{
// If weapon alpha updating is disabled, then stop.
if (!g_bWeaponAlpha)
{
return;
}
// If weapon isn't a valid entity, then stop.
if (weapon < MaxClients)
{

View File

@ -174,6 +174,26 @@ WeaponsOnClientDisconnect(client)
WeaponAlphaOnClientDisconnect(client);
}
/**
* The round is starting.
*/
WeaponsOnRoundStart()
{
// Forward event to sub-modules
WeaponAlphaOnRoundStart();
}
/**
* The round is ending.
*
* @param reason Reason the round has ended.
*/
WeaponsOnRoundEnd()
{
// Forward event to sub-modules
WeaponAlphaOnRoundEnd();
}
/**
* Creates an array of all listed weapons in weapons.txt.
* @param arrayWeapons The handle of the array, don't forget to call CloseHandle