fixed napalm not disappearing and stop napalm from overlaying

removed weaponalpha completly
replaced CBaseEntity::SetAbsVelocity with CBaseEntity::m_vecAbsVelocity
This commit is contained in:
2016-08-08 10:20:23 +02:00
parent 73a72d37da
commit b286de5ce0
11 changed files with 134 additions and 360 deletions

View File

@ -591,7 +591,7 @@ public Action:RestrictCanUse(client, weapon)
// WARNING: This function is called _frequently_. Every game tick per
// player, I think. Make sure any code here is optimized.
new String:weaponentity[WEAPONS_MAX_LENGTH];
decl String:weaponentity[WEAPONS_MAX_LENGTH];
GetEdictClassname(weapon, weaponentity, sizeof(weaponentity));
// If weapon is a knife, then allow pickup.
@ -644,7 +644,7 @@ public Action:RestrictCanUse(client, weapon)
}
// Forward event to weapons module.
WeaponsOnItemPickup(client, weapon);
//WeaponsOnItemPickup(client, weapon);
// Allow pickup.
return Plugin_Continue;

View File

@ -1,155 +0,0 @@
/*
* ============================================================================
*
* Zombie:Reloaded
*
* File: weaponalpha.inc
* Type: Core
* Description: Weapon alpha functions, and alpha updating on drop/pickup.
*
* Copyright (C) 2009-2013 Greyscale, Richard Helgeby
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* ============================================================================
*/
/**
* Default alpha on any CS:S weapon.
*/
#define WEAPONALPHA_DEFAULT_VALUE 255
/**
* Client is joining the server.
*
* @param client The client index.
*/
WeaponAlphaClientInit(client)
{
return;
SDKHook(client, SDKHook_WeaponDrop, WeaponAlphaDrop);
}
/**
* Client is leaving the server.
*
* @param client The client index.
*/
WeaponAlphaOnClientDisconnect(client)
{
return;
SDKUnhook(client, SDKHook_WeaponDrop, WeaponAlphaDrop);
}
/**
* Client has just picked up a weapon.
*
* @param client The client index.
* @param weapon The weapon index.
*/
WeaponAlphaOnItemPickupPost(client, weapon)
{
return;
if (Entity_HasChildren(weapon))
{
// Don't apply alpha value if weapon has children. Render mode is
// recursively applied to child entities that may not have the render
// mode attribute - and cause errors like this:
// Native "SetEntProp" reported: Property "m_nRenderMode" not found
// (entity 666/info_particle_system)
return;
}
// Get client's current alpha.
new alpha = ToolsGetEntityAlpha(client);
// Set new alpha on weapons.
WeaponAlphaApplyWeaponAlpha(weapon, alpha);
}
/**
* Callback function for Weapon_Drop.
* Called when a client drops their weapon.
*
* @param client The client index.
* @param weapon The weapon index.
*/
public Action:WeaponAlphaDrop(client, weapon)
{
return;
// If weapon isn't a valid entity, then stop.
if (weapon < MaxClients)
{
return;
}
// Set new alpha on weapons.
WeaponAlphaApplyWeaponAlpha(weapon, WEAPONALPHA_DEFAULT_VALUE);
}
/**
* A client's alpha has been changed by the plugin.
*
* @param client The client index.
*/
WeaponAlphaOnClientAlphaChanged(client, alpha)
{
return;
// Set new alpha on weapons.
WeaponAlphaApplyWeaponAlpha(client, alpha);
}
/**
* Set's the alpha on a client's weapons.
*
* @param entity If client index is given, alpha will be set on all their weapons.
* If a non-client index is given, alpha will be set on given entity.
* @param alpha The alpha to set the weapons to.
*/
WeaponAlphaApplyWeaponAlpha(entity, alpha)
{
return;
if (entity > MaxClients)
{
// Turn rendermode on, on the weapon.
SetEntityRenderMode(entity, RENDER_TRANSALPHA);
// Set alpha value on the weapon.
SetEntityRenderColor(entity, _, _, _, alpha);
// Entity alpha has been set, so stop.
return;
}
// Get client's list of weapons.
new weapons[WeaponsSlot];
WeaponsGetClientWeapons(entity, 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);
}
}

View File

@ -94,7 +94,6 @@ new Handle:arrayWeapons = INVALID_HANDLE;
#include "zr/weapons/restrict"
#include "zr/weapons/weaponammo"
#include "zr/weapons/weaponalpha"
#include "zr/weapons/zmarket"
#include "zr/weapons/menu_weapons"
@ -319,7 +318,6 @@ WeaponsClientInit(client)
{
// Forward event to sub-modules.
RestrictClientInit(client);
WeaponAlphaClientInit(client);
ZMarketClientInit(client);
}
@ -343,7 +341,6 @@ WeaponsOnClientDisconnect(client)
{
// Forward event to sub-modules.
RestrictOnClientDisconnect(client);
WeaponAlphaOnClientDisconnect(client);
ZMarketOnClientDisconnect(client);
}
@ -381,56 +378,6 @@ WeaponsOnRoundEnd()
RestrictOnRoundEnd();
}
/**
* Called when a client picks up an item.
*
* @param client The client index.
* @param weapon The weapon index.
*/
WeaponsOnItemPickup(client, weapon)
{
// Forward event to sub-modules.
// Fire post OnItemPickup event.
// Fill datapack with event information.
new Handle:eventinfo = CreateDataPack();
WritePackCell(eventinfo, client);
WritePackCell(eventinfo, weapon);
// Create post delay timer.
CreateTimer(0.0, WeaponsOnItemPickupPost, eventinfo, TIMER_DATA_HNDL_CLOSE);
}
/**
* Called when a client picks up an item. *Post
*
* @param client The client index.
* @param weapon The weapon index.
*/
public Action:WeaponsOnItemPickupPost(Handle:timer, Handle:eventinfo)
{
// Get event info.
ResetPack(eventinfo);
new client = ReadPackCell(eventinfo);
new weapon = ReadPackCell(eventinfo);
// If client isn't in the game anymore, then stop.
if (!IsClientInGame(client))
{
return;
}
// If the weapon entity isn't valid anymore, then stop.
if (!IsValidEdict(weapon))
{
return;
}
// Forward event to sub-modules.
WeaponAlphaOnItemPickupPost(client, weapon);
}
/**
* Weapon data reading API.
*/