Veteran Member
Join Date: Jan 2012
Location: Russia
|
07-01-2018
, 09:06
Re: [CS:GO] Release: Zombie Plague 7.8fix2
|
#429
|
Quote:
Originally Posted by xkonsole
Never mentioned knockback tho. Players in csgo get movement-slowdown effect, when they're getting shot. Is it possible to implement this effect to molotov via sourcemod?
|
You can hook brun damage and reduce their speed and after increase it back
PHP Code:
/** * ============================================================================ * * Zombie Plague Mod #3 Generation * * * Copyright (C) 2015-2018 Nikita Ushakov (Ireland, Dublin) * * 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/>. * * ============================================================================ **/
#include <sourcemod> #include <sdktools> #include <sdkhooks> #include <zombieplague>
#pragma newdecls required
/** * Record plugin info. **/ public Plugin Molotov = { name = "[ZP] ExtraItem: Molotov", author = "qubka (Nikita Ushakov)", description = "Addon of extra items", version = "1.0", url = "https://forums.alliedmods.net/showthread.php?t=290657" }
/** * @section Information about extra items. **/ #define EXTRA_ITEM_NAME "Molotov" // If string has @, phrase will be taken from translation file #define EXTRA_ITEM_COST 2 #define EXTRA_ITEM_LEVEL 0 #define EXTRA_ITEM_ONLINE 0 #define EXTRA_ITEM_LIMIT 0 /** * @endsection **/ /** * @section Properties of the grenade. **/ #define GRENADE_IGNITE_DAMAGE 7.0 // Damage of molotov multiplier (2.0 = double damage) #define GRENADE_IGNITE_DURATION 5.0 // Burning duration in seconds #define GRENADE_IGNITE_SPEED_RATIO 2.0 // Burning ratio which reduce speed /** * @endsection **/ /** * @section Water levels. **/ #define WLEVEL_CSGO_DRY 0 #define WLEVEL_CSGO_FEET 1 #define WLEVEL_CSGO_HALF 2 #define WLEVEL_CSGO_FULL 3 /** * @endsection **/
// Initialize variables Handle Task_ZombieBurned[MAXPLAYERS+1] = INVALID_HANDLE; float flSpeed[MAXPLAYERS+1]; // Item index int iItem; #pragma unused iItem
/** * Called after a library is added that the current plugin references optionally. * A library is either a plugin name or extension name, as exposed via its include file. **/ public void OnLibraryAdded(const char[] sLibrary) { // Validate library if(!strcmp(sLibrary, "zombieplague", false)) { // Initilizate extra item iItem = ZP_RegisterExtraItem(EXTRA_ITEM_NAME, EXTRA_ITEM_COST, TEAM_HUMAN, EXTRA_ITEM_LEVEL, EXTRA_ITEM_ONLINE, EXTRA_ITEM_LIMIT); } }
/** * Called when a client is disconnecting from the server. * * @param clientIndex The client index. **/ public void OnClientDisconnect(int clientIndex) { // Reset variable flSpeed[clientIndex] = 0.0; // Delete timer delete Task_ZombieBurned[clientIndex]; }
/** * Called when a client became a zombie/nemesis. * * @param clientIndex The client index. * @param attackerIndex The attacker index. **/ public void ZP_OnClientInfected(int clientIndex, int attackerIndex) { // Reset variable flSpeed[clientIndex] = 0.0; // Delete timer delete Task_ZombieBurned[clientIndex]; }
/** * Called when a client became a human/survivor. * * @param clientIndex The client index. **/ public void ZP_OnClientHumanized(int clientIndex) { // Reset variable flSpeed[clientIndex] = 0.0; // Delete timer delete Task_ZombieBurned[clientIndex]; }
/** * Called after select an extraitem in the equipment menu. * * @param clientIndex The client index. * @param extraitemIndex The index of extraitem from ZP_RegisterExtraItem() native. * * @return Plugin_Handled or Plugin_Stop to block purhase. Anything else * (like Plugin_Continue) to allow purhase and taking ammopacks. **/ public Action ZP_OnClientBuyExtraItem(int clientIndex, int extraitemIndex) { // Validate client if(!IsPlayerExist(clientIndex)) { return Plugin_Handled; } // Check the item's index if(extraitemIndex == iItem) { // If you don't allowed to buy, then return ammopacks if(IsPlayerHasWeapon(clientIndex, "weapon_molotov") || IsPlayerHasWeapon(clientIndex, "weapon_incgrenade") || ZP_IsPlayerZombie(clientIndex) || ZP_IsPlayerSurvivor(clientIndex)) { return Plugin_Handled; } // Give item and select it GivePlayerItem(clientIndex, "weapon_molotov"); FakeClientCommandEx(clientIndex, "use weapon_molotov"); } // Allow buying return Plugin_Continue; }
/** * Called when a client take a fake damage. * * @param clientIndex The client index. * @param attackerIndex The attacker index. * @param damageAmount The amount of damage inflicted. * @param damageType The ditfield of damage types **/ public void ZP_OnClientDamaged(int clientIndex, int attackerIndex, float &damageAmount, int damageType) { // Validate client if(!IsPlayerExist(clientIndex)) { return; } // Client was damaged by 'fire' or 'burn' if(damageType & DMG_BURN || damageType & DMG_DIRECT) { // Verify that the victim is zombie if(ZP_IsPlayerZombie(clientIndex)) { // If the victim is in the water or freezed if(GetEntProp(clientIndex, Prop_Data, "m_nWaterLevel") > WLEVEL_CSGO_FEET || GetEntityMoveType(clientIndex) == MOVETYPE_NONE) { // This instead of 'ExtinguishEntity' function int fireIndex = GetEntPropEnt(clientIndex, Prop_Data, "m_hEffectEntity"); if(IsValidEdict(fireIndex)) { // Make sure the entity is a flame, so we can extinguish it static char sClassname[SMALL_LINE_LENGTH]; GetEdictClassname(fireIndex, sClassname, sizeof(sClassname)); if(!strcmp(sClassname, "entityflame", false)) { SetEntPropFloat(fireIndex, Prop_Data, "m_flLifetime", 0.0); } } } else { // Put the fire on if(damageType & DMG_BURN) IgniteEntity(clientIndex, GRENADE_IGNITE_DURATION);
// Return damage multiplier damageAmount *= GRENADE_IGNITE_DAMAGE; // Store the current speed if(!flSpeed[clientIndex]) flSpeed[clientIndex] = GetEntPropFloat(clientIndex, Prop_Data, "m_flLaggedMovementValue");
// Sets a new speed SetEntPropFloat(clientIndex, Prop_Data, "m_flLaggedMovementValue", flSpeed[clientIndex] / GRENADE_IGNITE_SPEED_RATIO); // Validate that timer not execute if(Task_ZombieBurned[clientIndex] == INVALID_HANDLE) { // Create timer for removing freezing delete Task_ZombieBurned[clientIndex]; Task_ZombieBurned[clientIndex] = CreateTimer(1.0, ClientRemoveBurnEffect, clientIndex, TIMER_FLAG_NO_MAPCHANGE); } // Return on success return; } } // Block damage damageAmount *= 0.0; } }
/** * Timer for remove burn effect. * * @param hTimer The timer handle. * @param clientIndex The client index. **/ public Action ClientRemoveBurnEffect(Handle hTimer, any clientIndex) { // Clear timer Task_ZombieBurned[clientIndex] = INVALID_HANDLE;
// Validate client if(IsPlayerExist(clientIndex)) { // Sets the previous speed SetEntPropFloat(clientIndex, Prop_Data, "m_flLaggedMovementValue", flSpeed[clientIndex]); }
// Reset variable flSpeed[clientIndex] = 0.0;
// Destroy timer return Plugin_Stop; }
Quote:
* Healer class added + Heal for reward.
* Blast class, shoot with energy ball which can freeze humans on explosions.
* Fire and burning should reduce speed of the zombies.
2 zclasses in progress
# TESLA CLASS (Electricty skill, like scream skill but dont deal damage, only make the confusion for the humans in the radius)
# STAMPER CLASS (Like in cso)
|
__________________
Last edited by gubka; 07-01-2018 at 09:52.
|
|