AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   Shoot molotov explode in fire just like you throw it (https://forums.alliedmods.net/showthread.php?t=324719)

Sandervraun 05-24-2020 23:43

Shoot molotov explode in fire just like you throw it
 
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");
}

zipcore 05-29-2020 10:08

Re: Shoot molotov explode in fire just like you throw it
 
Here is what I did: https://gitlab.com/Zipcore/HungerGam...ents/napalm.sp


All times are GMT -4. The time now is 06:18.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.