Veteran Member
Join Date: Jan 2012
Location: Russia
|
07-24-2018
, 12:45
Re: [CS:GO] Experimental: Zombie Plague 8.1.0
|
#552
|
Quote:
Originally Posted by romeo7
write pm.
|
Next update will have new things for forwards in infect/humanize to avoid checking the nemesis or survivor state, the forward will pass thats cells
The big focus it to create goood cbaseweapons for custom attack weapons, if lasers will work i will add chainsaw and janus 7 from cso1
For example , the etherial in next update will be look like that, so it will be similar to the full custom attack weapons like there was in cs 1.6 zombie plague cso sersers
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 myinfo = { name = "[ZP] Weapon: Ethereal", author = "qubka (Nikita Ushakov)", description = "Addon of survivor weapon", version = "2.0", url = "https://forums.alliedmods.net/showthread.php?t=290657" }
/** * @section Information about weapon. **/ #define WEAPON_REFERANCE "Etherial" // Models and other properties in the 'weapons.ini' #define WEAPON_LASER_DAMAGE GetRandomFloat(150.0, 200.0) /** * @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 int gWeapon;
// Variables for the key sound block int gSound;
/** * Called after a zombie core is loaded. **/ public void ZP_OnEngineExecute(/*void*/) { // Initilizate weapon gWeapon = ZP_GetWeaponNameID(WEAPON_REFERANCE); if(gWeapon == -1) SetFailState("[ZP] Custom weapon ID from name : \"%s\" wasn't find", WEAPON_REFERANCE);
// Sounds gSound = ZP_GetSoundKeyID("ETHERIAL_SHOOT_SOUNDS"); }
//********************************************************************* //* Don't modify the code below this line unless * //* you know _exactly_ what you are doing!!! * //*********************************************************************
void Weapon_OnReload(const int clientIndex, const int weaponIndex, const int iClip, const int iAmmo, const float flCurrentTime) { #pragma unused clientIndex, weaponIndex, iClip, iAmmo, flCurrentTime
// Block the real attack SetEntPropFloat(weaponIndex, Prop_Send, "m_flNextPrimaryAttack", flCurrentTime + 9999.9);
// Sets the next attack time SetEntPropFloat(weaponIndex, Prop_Send, "m_flEncodedController", flCurrentTime + ZP_GetWeaponReload(gWeapon)); }
void Weapon_OnHolster(const int clientIndex, const int weaponIndex, const int iClip, const int iAmmo, const float flCurrentTime) { #pragma unused clientIndex, weaponIndex, iClip, iAmmo, flCurrentTime // Validate animation delay if(GetEntPropFloat(weaponIndex, Prop_Send, "m_flEncodedController") > flCurrentTime) { return; }
// Validate ammo if(iClip < ZP_GetWeaponClip(gWeapon)) { // Reset for allowing reload SetEntPropFloat(weaponIndex, Prop_Send, "m_flNextPrimaryAttack", flCurrentTime); } }
void Weapon_OnDeploy(const int clientIndex, const int weaponIndex, const int iClip, const int iAmmo, const float flCurrentTime) { #pragma unused clientIndex, weaponIndex, iClip, iAmmo, flCurrentTime
// Block the real attack SetEntPropFloat(weaponIndex, Prop_Send, "m_flNextPrimaryAttack", flCurrentTime + 9999.9);
// Sets the next attack time SetEntPropFloat(weaponIndex, Prop_Send, "m_flEncodedController", flCurrentTime + ZP_GetWeaponDeploy(gWeapon)); }
void Weapon_OnPrimaryAttack(const int clientIndex, const int weaponIndex, int iClip, const int iAmmo, const float flCurrentTime) { #pragma unused clientIndex, weaponIndex, iClip, iAmmo, flCurrentTime
// Validate ammo if(iClip <= 0) { Weapon_OnHolster(clientIndex, weaponIndex, iClip, iAmmo, flCurrentTime); return; }
// Validate animation delay if(GetEntPropFloat(weaponIndex, Prop_Send, "m_flEncodedController") > flCurrentTime) { return; }
// Validate water if(GetEntProp(clientIndex, Prop_Data, "m_nWaterLevel") == WLEVEL_CSGO_FULL) { return; }
// Substract ammo iClip -= 1; SetEntProp(weaponIndex, Prop_Send, "m_iClip1", iClip); if(!iClip) Weapon_OnHolster(clientIndex, weaponIndex, iClip, iAmmo, flCurrentTime + ZP_GetWeaponSpeed(gWeapon));
// Sets the next attack time SetEntPropFloat(weaponIndex, Prop_Send, "m_flEncodedController", flCurrentTime + ZP_GetWeaponSpeed(gWeapon));
// Emit sound ZP_EmitSoundKeyID(weaponIndex, gSound, SNDCHAN_WEAPON, 1); // Sets the attack animation ZP_SetWeaponAnimation(clientIndex, 1); // Create a trace Weapon_OnCreateTrace(clientIndex);
// Apply the kick back Weapon_OnKickBack(clientIndex, GetRandomFloat(-5.0, 5.0), GetRandomFloat(-5.0, 5.0), GetRandomFloat(-2.0, 2.0)); }
void Weapon_OnCreateTrace(const int attackerIndex) { #pragma unused attackerIndex
// Initialize vectors static float vBulletPosition[3]; static float vEntAngle[3]; static float vEntPosition[3];
// Gets attacker position GetClientEyeAngles(attackerIndex, vEntAngle); GetClientEyePosition(attackerIndex, vEntPosition);
// Calculate the infinite trace Handle hTrace = TR_TraceRayFilterEx(vEntPosition, vEntAngle, MASK_ALL, RayType_Infinite, TraceFilter, attackerIndex); // Gets the client viewmodel int viewModel = ZP_GetClientViewModel(clientIndex, true); /// True for getting the custom one
// Create a muzzleflesh FakeDispatchEffect(viewModel, "weapon_muzzle_flash_taser", "ParticleEffect", vEntPosition, vEntPosition, _, 1); TE_SendToClient(attackerIndex);
// Validate trace if(TR_DidHit(hTrace)) { // Gets the victim index int victimIndex = TR_GetEntityIndex(hTrace);
// Gets the end point TR_GetEndPosition(vBulletPosition);
// Create a tracer FakeDispatchEffect(viewModel, "weapon_tracers_taser", "ParticleEffect", vEntPosition, vBulletPosition, _, 1); TE_SendToClient(attackerIndex);
// Create a glow impact FakeDispatchEffect(_, "weapon_taser_glow_impact", "ParticleEffect", vBulletPosition, vBulletPosition); TE_SendToAll();
// Validate victim if(IsPlayerExist(victimIndex) && ZP_IsPlayerZombie(victimIndex)) { // Create the damage for a victim SDKHooks_TakeDamage(victimIndex, attackerIndex, attackerIndex, WEAPON_LASER_DAMAGE); } }
// Close the trace CloseHandle(hTrace); }
void Weapon_OnKickBack(const int clientIndex, const float flYaw = 0.0, const float flPitch = 0.0, const float flRoll = 0.0) { #pragma unused clientIndex, flYaw, flPitch, flRoll
// Initialize vectors static float vVelocity[3]; static float vPunchAngle[3];
// Gets the punch angle vPunchAngle[0] = flYaw; vPunchAngle[1] = flPitch; vPunchAngle[2] = flRoll; // Gets the client flags int iFlags = GetEntityFlags(clientIndex);
// Gets the client velocity GetEntPropVector(clientIndex, Prop_Data, "m_vecVelocity", vVelocity);
/// Apply kick back
if(!(SquareRoot(Pow(vVelocity[0], 2.0) + Pow(vVelocity[1], 2.0)))) { //vPunchAngle[0] *= 1.0; vPunchAngle[1] *= 1.0; vPunchAngle[2] *= 1.0; SetEntPropVector(clientIndex, Prop_Send, "m_aimPunchAngle", vPunchAngle); SetEntPropVector(clientIndex, Prop_Send, "m_viewPunchAngle", vPunchAngle); } else if (!(iFlags & FL_ONGROUND)) { vPunchAngle[0] *= 2.0; vPunchAngle[1] *= 2.0; vPunchAngle[2] *= 2.0; SetEntPropVector(clientIndex, Prop_Send, "m_aimPunchAngle", vPunchAngle); SetEntPropVector(clientIndex, Prop_Send, "m_viewPunchAngle", vPunchAngle); } else if (iFlags & FL_DUCKING) { vPunchAngle[0] *= 0.5; vPunchAngle[1] *= 0.5; vPunchAngle[2] *= 0.5; SetEntPropVector(clientIndex, Prop_Send, "m_aimPunchAngle", vPunchAngle); SetEntPropVector(clientIndex, Prop_Send, "m_viewPunchAngle", vPunchAngle); } else { vPunchAngle[0] *= 1.5; vPunchAngle[1] *= 1.5; vPunchAngle[2] *= 1.5; SetEntPropVector(clientIndex, Prop_Send, "m_aimPunchAngle", vPunchAngle); SetEntPropVector(clientIndex, Prop_Send, "m_viewPunchAngle", vPunchAngle); } }
//********************************************** //* Item (weapon) hooks. * //**********************************************
#define _call.%0(%1,%2) \ \ Weapon_On%0 \ ( \ %1, \ %2, \ \ GetEntProp(%2, Prop_Send, "m_iClip1"), \ \ GetEntProp(%2, Prop_Send, "m_iPrimaryReserveAmmoCount"), \ \ GetGameTime() \ ) /** * Called once a client is authorized and fully in-game, and * after all post-connection authorizations have been performed. * * This callback is gauranteed to occur on all clients, and always * after each OnClientPutInServer() call. * * @param clientIndex The client index. **/ public void OnClientPostAdminCheck(int clientIndex) { // Hook entity callbacks SDKHook(clientIndex, SDKHook_WeaponSwitchPost, WeaponOnDeployPost); }
/** * Called after a custom weapon is created. * * @param weaponIndex The weapon index. * @param weaponID The weapon id. **/ public void ZP_OnWeaponCreated(int weaponIndex, int weaponID) { // Validate custom weapon if(weaponID == gWeapon) { // Hook entity callbacks SDKHook(weaponIndex, SDKHook_ReloadPost, WeaponOnReloadPost); } }
/** * Hook: WeaponSwitchPost * Player deploy any weapon. * * @param clientIndex The client index. * @param weaponIndex The weapon index. **/ public void WeaponOnDeployPost(int clientIndex, int weaponIndex) { // Apply fake deploy hook on the next frame RequestFrame(view_as<RequestFrameCallback>(WeaponOnFakeDeployPost), GetClientUserId(clientIndex)); }
/** * FakeHook: WeaponSwitchPost * * @param userID The user id. **/ public void WeaponOnFakeDeployPost(int userID) { // Gets the client index from the user ID int clientIndex = GetClientOfUserId(userID); int weaponIndex;
// Validate weapon if(ZP_IsPlayerHoldWeapon(clientIndex, weaponIndex, gWeapon)) { // Call event _call.Deploy(clientIndex, weaponIndex); } }
/** * Hook: WeaponReloadPost * Weapon is reloaded. * * @param weaponIndex The weapon index. **/ public Action WeaponOnReloadPost(int weaponIndex) { // Apply fake reload hook on the next frame RequestFrame(view_as<RequestFrameCallback>(WeaponOnFakeReloadPost), EntIndexToEntRef(weaponIndex)); }
/** * FakeHook: WeaponReloadPost * * @param referenceIndex The reference index. **/ public void WeaponOnFakeReloadPost(int referenceIndex) { // Get the weapon index from the reference int entityIndex = EntRefToEntIndex(referenceIndex);
// Validate weapon if(entityIndex != INVALID_ENT_REFERENCE) { // Gets the weapon owner int clientIndex = GetEntPropEnt(entityIndex, Prop_Send, "m_hOwner");
// Validate owner if(IsPlayerExist(clientIndex)) { // Call event _call.Reload(clientIndex, entityIndex); } } }
/** * Event: WeaponPostFrame * Weapon is holding. * * @param clientIndex The client index. * @param iButtons Copyback buffer containing the current commands (as bitflags - see entity_prop_stocks.inc). * @param iImpulse Copyback buffer containing the current impulse command. * @param flVelocity Players desired velocity. * @param flAngles Players desired view angles. * @param weaponID The entity index of the new weapon if player switches weapon, 0 otherwise. * @param iSubType Weapon subtype when selected from a menu. * @param iCmdNum Command number. Increments from the first command sent. * @param iTickCount Tick count. A client prediction based on the server GetGameTickCount value. * @param iSeed Random seed. Used to determine weapon recoil, spread, and other predicted elements. * @param iMouse Mouse direction (x, y). **/ public Action OnPlayerRunCmd(int clientIndex, int &iButtons, int &iImpulse, float flVelocity[3], float flAngles[3], int &weaponID, int &iSubType, int &iCmdNum, int &iTickCount, int &iSeed, int iMouse[2]) { // Validate weapon static int weaponIndex; if(ZP_IsPlayerHoldWeapon(clientIndex, weaponIndex, gWeapon)) { // Button primary attack press if(iButtons & IN_ATTACK) { // Call event _call.PrimaryAttack(clientIndex, weaponIndex); iButtons &= (~IN_ATTACK); //! Bugfix return Plugin_Changed; }
// Button reload press if(iButtons & IN_RELOAD) { // Call event _call.Holster(clientIndex, weaponIndex); } } // Allow button return Plugin_Continue; }
//********************************************** //* Item (laser) stocks. * //**********************************************
/** * Trace filter. * * @param entityIndex The entity index. * @param contentsMask The contents mask. * @param clientIndex The client index. * * @return True or false. **/ public bool TraceFilter(int entityIndex, int contentsMask, any clientIndex) { // If entity is a player, continue tracing return clientIndex != entityIndex; }
__________________
Last edited by gubka; 07-24-2018 at 12:57.
|
|