Raised This Month: $70 Target: $400
 17% 

Shoot molotov explode in fire just like you throw it


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sandervraun
Senior Member
Join Date: May 2019
Old 05-24-2020 , 23:43   Shoot molotov explode in fire just like you throw it
Reply With Quote #1

I am currently looking for a plugin which allows you to shoot molotovs, so they explode, and do their fire effect, just like when you throw it. Can't find it anywhere on the internet. Can anyone help?
I have tried to change the following

if(StrEqual(szClassName, "weapon_hegrande"))
to
if(StrEqual(szClassName, "weapon_molotov"))

But obviously that is just the classname? But there must be something else in this plugin, which defines wether it explodes like a bomb, or firebomb.. I believe it is this function:
EmitAmbientSound("weapons/hegrenade/explode4.wav", pos, entity);
RequestFrame(TriggerExplosion, entity);"

I can also see that it has it's "hegrenade" explosion sound defined aswell.

Here's the plugin. I hope anyone can help
Cheers

Quote:
#pragma semicolon 1

#define PLUGIN_AUTHOR "Rachnus"
#define PLUGIN_VERSION "1.0"

#include <sourcemod>
#include <sdktools>
#include <cstrike>
#include <sdkhooks>

#pragma newdecls required

EngineVersion g_Game;

ConVar g_DroppedGrenadeDamage;
ConVar g_DroppedGrenadeRadius;

public Plugin myinfo =
{
name = "Explode Dropped Nades v1.0",
author = PLUGIN_AUTHOR,
description = "Shooting dropped grenades",
version = PLUGIN_VERSION,
url = "https://github.com/Rachnus"
};

public void OnPluginStart()
{
g_Game = GetEngineVersion();
if(g_Game != Engine_CSGO && g_Game != Engine_CSS)
{
SetFailState("This plugin is for CSGO/CSS only.");
}

g_DroppedGrenadeDamage = CreateConVar("dropped_grenade_damage", "80", "Amount of damage the dropped grenade should deal");
g_DroppedGrenadeRadius = CreateConVar("dropped_grenade_radius", "350", "Amount of radius the dropped grenade should have");
}

public void OnEntityCreated(int entity, const char[] classname)
{
char szClassName[32];
GetEntityClassname(entity, szClassName, sizeof(szClassName));
if(StrEqual(szClassName, "weapon_molotov"))
{
SDKHook(entity, SDKHook_Spawn, OnGrenadeSpawn);
}
}

public Action OnGrenadeSpawn(int entity)
{
SetEntProp(entity, Prop_Data, "m_takedamage", 2);
SDKHook(entity, SDKHook_OnTakeDamage, OnGrenadeTakeDamage);
}

public Action OnGrenadeTakeDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype, int &weapon, float damageForce[3], float damagePosition[3])
{
float pos[3];
GetEntPropVector(victim, Prop_Data, "m_vecOrigin", pos);
AcceptEntityInput(victim, "Kill");
CS_CreateExplosion(attacker, g_DroppedGrenadeDamage.IntValue, g_DroppedGrenadeRadius.IntValue, pos);
}

void CS_CreateExplosion(int client, int damage, int radius, float pos[3])
{
int entity;
if((entity = CreateEntityByName("env_explosion")) != -1)
{
//DispatchKeyValue(entity, "spawnflags", "552");
DispatchKeyValue(entity, "rendermode", "5");
SetEntProp(entity, Prop_Data, "m_iMagnitude", damage);
SetEntProp(entity, Prop_Data, "m_iRadiusOverride", radius);
SetEntProp(entity, Prop_Data, "m_iTeamNum", GetClientTeam(client));
SetEntPropEnt(entity, Prop_Data, "m_hOwnerEntity", client);

DispatchSpawn(entity);
TeleportEntity(entity, pos, NULL_VECTOR, NULL_VECTOR);
EmitAmbientSound("weapons/hegrenade/explode4.wav", pos, entity);
RequestFrame(TriggerExplosion, entity);
}
}

public void TriggerExplosion(int entity)
{
AcceptEntityInput(entity, "explode");
AcceptEntityInput(entity, "Kill");
}
Sandervraun is offline
zipcore
Veteran Member
Join Date: Mar 2010
Location: m_flZipcore
Old 05-29-2020 , 10:08   Re: Shoot molotov explode in fire just like you throw it
Reply With Quote #2

Here is what I did: https://gitlab.com/Zipcore/HungerGam...ents/napalm.sp
__________________
zipcore is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:21.


Powered by vBulletin®
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Theme made by Freecode