Games the script should work with : Half-Life 2 DeathMatch
A detailed description of what you want the script to do :
Hello Eventscripts Team and Other.
Can anybody sourcemod plugin rewrite for Source Python please?
Best perhaps both equal in one.
( This script make a explosions effect: frag_grenade, smg1_grenade, rpg_missle, slam, combine_ball, barrels etc.)
Syntax: Select all
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
//Current version of the plugin.
#define PLUGIN_VERSION "1.0.2"
new g_iEffect[2048];
new Handle:g_hDelay = INVALID_HANDLE;
new Handle:g_hVtf = INVALID_HANDLE;
new Handle:g_hVmt = INVALID_HANDLE;
new Handle:g_hSound = INVALID_HANDLE;
new Handle:g_hVtf2 = INVALID_HANDLE;
new Handle:g_hVmt2 = INVALID_HANDLE;
new Handle:g_hSound2 = INVALID_HANDLE;
new String:g_sVtf[PLATFORM_MAX_PATH], String:g_sVmt[PLATFORM_MAX_PATH], String:g_sSound[PLATFORM_MAX_PATH];
new String:g_sVtf2[PLATFORM_MAX_PATH], String:g_sVmt2[PLATFORM_MAX_PATH], String:g_sSound2[PLATFORM_MAX_PATH];
public Plugin:myinfo =
{
name = "HL2:DM Explosion",
author = "Panda",
description = "Creates an explosive entity on grenade death and barrel explosion.",
version = PLUGIN_VERSION,
url = "http://forums.alliedmodders.com"
};
public OnPluginStart()
{
g_hVtf = CreateConVar("sm_hl2dm_explosion_vtf", "particle/smokeball.vtf", "Path to specified VTF file. (GAS/BARREL)", FCVAR_NONE);
g_hVmt = CreateConVar("sm_hl2dm_explosion_vmt", "particle/smokeball.vmt", "Path to specified VMT file. (GAS/BARREL)", FCVAR_NONE);
g_hSound = CreateConVar("sm_hl2dm_explosion_sound", "effects/barrel_explode.mp3", "Sound to play. Set to \"\" to disable. (GAS/BARREL)", FCVAR_NONE);
g_hVtf2 = CreateConVar("sm_hl2dm_explosion_vtf_2", "particle/orbsmoke3.vtf", "Path to specified VTF file. (COMBINEBALL)", FCVAR_NONE);
g_hVmt2 = CreateConVar("sm_hl2dm_explosion_vmt_2", "particle/orbsmoke3.vmt", "Path to specified VMT file. (COMBINEBALL)", FCVAR_NONE);
g_hSound2 = CreateConVar("sm_hl2dm_explosion_sound_2", "effects/death_combine.mp3", "Sound to play. Set to \"\" to disable. (COMBINEBALL)", FCVAR_NONE);
g_hDelay = CreateConVar("sm_hl2dm_explosion_delay", "8.0", "Delay until deleting the created explosion.", FCVAR_NONE);
AutoExecConfig(true, "sm_hl2dm_explosion_v102");
GetConVarString(g_hVtf, g_sVtf, sizeof(g_sVtf));
GetConVarString(g_hVmt, g_sVmt, sizeof(g_sVmt));
GetConVarString(g_hSound, g_sSound, sizeof(g_sSound));
GetConVarString(g_hVtf2, g_sVtf2, sizeof(g_sVtf2));
GetConVarString(g_hVmt2, g_sVmt2, sizeof(g_sVmt2));
GetConVarString(g_hSound2, g_sSound2, sizeof(g_sSound2));
}
public OnMapStart()
{
GetConVarString(g_hVtf, g_sVtf, sizeof(g_sVtf));
GetConVarString(g_hVmt, g_sVmt, sizeof(g_sVmt));
GetConVarString(g_hSound, g_sSound, sizeof(g_sSound));
GetConVarString(g_hVtf2, g_sVtf2, sizeof(g_sVtf2));
GetConVarString(g_hVmt2, g_sVmt2, sizeof(g_sVmt2));
GetConVarString(g_hSound2, g_sSound2, sizeof(g_sSound2));
decl String:sBuffer[PLATFORM_MAX_PATH];
Format(sBuffer, sizeof(sBuffer), "materials/%s", g_sVtf);
AddFileToDownloadsTable(sBuffer);
PrecacheModel(g_sVtf, true);
Format(sBuffer, sizeof(sBuffer), "materials/%s", g_sVmt);
AddFileToDownloadsTable(sBuffer);
PrecacheModel(g_sVmt, true);
if(!StrEqual(g_sSound, ""))
{
Format(sBuffer, sizeof(sBuffer), "sound/%s", g_sSound);
AddFileToDownloadsTable(sBuffer);
PrecacheSound(g_sSound, true);
}
Format(sBuffer, sizeof(sBuffer), "materials/%s", g_sVtf2);
AddFileToDownloadsTable(sBuffer);
PrecacheModel(g_sVtf2, true);
Format(sBuffer, sizeof(sBuffer), "materials/%s", g_sVmt2);
AddFileToDownloadsTable(sBuffer);
PrecacheModel(g_sVmt2, true);
if(!StrEqual(g_sSound2, ""))
{
Format(sBuffer, sizeof(sBuffer), "sound/%s", g_sSound2);
AddFileToDownloadsTable(sBuffer);
PrecacheSound(g_sSound2, true);
}
}
public OnEntityCreated(entity, const String:classname[])
{
if(entity <= MAXPLAYERS)
return;
else if(StrContains(classname, "prop_", false) != -1)
CreateTimer(0.1, Timer_Created, EntIndexToEntRef(entity));
}
public Action:Timer_Created(Handle:timer, any:ref)
{
new entity = EntRefToEntIndex(ref);
if(entity != INVALID_ENT_REFERENCE)
{
decl String:sBuffer[PLATFORM_MAX_PATH];
GetEntPropString(entity, Prop_Data,mi "m_ModelName", sBuffer, sizeof(sBuffer));
if(StrEqual(sBuffer, "models/props_c17/oildrum001_explosive.mdl", false))
{
g_iEffect[entity] = 1;
SDKHook(entity, SDKHook_OnTakeDamage, CreateExplosion);
}
else if(StrEqual(sBuffer, "models/props_junk/gascan001a.mdl", false))
{
g_iEffect[entity] = 1;
SDKHook(entity, SDKHook_OnTakeDamage, CreateExplosion);
}
else if(StrEqual(sBuffer, "models/effects/combineball.mdl", false))
g_iEffect[entity] = 2;
}
}
public OnEntityDestroyed(entity)
{
if(entity >= 0)
{
if(IsValidEntity(entity) && g_iEffect[entity] == 2)
CreateExplosion2(entity);
g_iEffect[entity] = 0;
}
}
CreateExplosion2(entity)
{
new iExplosion = CreateEntityByName("env_ar2explosion");
if(iExplosion > 0)
{
decl Float:fOrigin[3];
GetEntPropVector(entity, Prop_Send, "m_vecOrigin", fOrigin);
DispatchKeyValue(iExplosion, "material", g_sVtf2);
DispatchSpawn(iExplosion);
TeleportEntity(iExplosion, fOrigin, NULL_VECTOR, NULL_VECTOR);
if(!StrEqual(g_sSound2, ""))
EmitAmbientSound(g_sSound2, fOrigin, entity, SNDLEVEL_ROCKET);
CreateTimer(0.1, Timer_Explode, EntIndexToEntRef(iExplosion));
}
return;
}
public Action:CreateExplosion(victim, &attacker, &inflictor, &Float:damage, &damagetype, &weapon, Float:damageForce[3], Float:damagePosition[3], damagecustom)
{
new Float:fHealth = Float:GetEntProp(victim, Prop_Data, "m_iHealth");
if((fHealth - damage) > 0.0)
return Plugin_Continue;
new iExplosion = CreateEntityByName("env_ar2explosion");
if(iExplosion > 0)
{
decl Float:fOrigin[3];
GetEntPropVector(victim, Prop_Send, "m_vecOrigin", fOrigin);
DispatchKeyValue(iExplosion, "material", g_sVtf);
DispatchSpawn(iExplosion);
TeleportEntity(iExplosion, fOrigin, NULL_VECTOR, NULL_VECTOR);
if(!StrEqual(g_sSound, ""))
EmitAmbientSound(g_sSound, fOrigin, victim, SNDLEVEL_ROCKET);
CreateTimer(0.1, Timer_Explode, EntIndexToEntRef(iExplosion));
g_iEffect[victim] = 0;
SDKUnhook(victim, SDKHook_OnTakeDamage, CreateExplosion);
}
return Plugin_Continue;
}
public Action:Timer_Explode(Handle:timer, any:ref)
{
new entity = EntRefToEntIndex(ref);
if(entity != INVALID_ENT_REFERENCE)
{
AcceptEntityInput(entity, "Explode");
CreateTimer(GetConVarFloat(g_hDelay), Timer_Kill, ref);
}
}
public Action:Timer_Kill(Handle:timer, any:ref)
{
new entity = EntRefToEntIndex(ref);
if(entity != INVALID_ENT_REFERENCE)
{
AcceptEntityInput(entity, "Kill");
}
}
AND
Syntax: Select all
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
//Current version of the plugin.
#define PLUGIN_VERSION "1.0.2"
new g_iEffect[2048];
new Handle:g_hDelay = INVALID_HANDLE;
new Handle:g_hVtf = INVALID_HANDLE;
new Handle:g_hVmt = INVALID_HANDLE;
new Handle:g_hSound = INVALID_HANDLE;
new Handle:g_hVtf2 = INVALID_HANDLE;
new Handle:g_hVmt2 = INVALID_HANDLE;
new Handle:g_hSound2 = INVALID_HANDLE;
new String:g_sVtf[PLATFORM_MAX_PATH], String:g_sVmt[PLATFORM_MAX_PATH], String:g_sSound[PLATFORM_MAX_PATH];
new String:g_sVtf2[PLATFORM_MAX_PATH], String:g_sVmt2[PLATFORM_MAX_PATH], String:g_sSound2[PLATFORM_MAX_PATH];
public Plugin:myinfo =
{
name = "HL2:DM Explosion1",
author = "Painkiller",
description = "Creates an explosive entity on grenade death and slams explosion.",
version = PLUGIN_VERSION,
url = "http://forums.alliedmodders.com"
};
public OnPluginStart()
{
g_hVtf = CreateConVar("sm_hl2dm_explosion1_vtf", "particle/particle_smokegrenade1.vtf", "Path to specified VTF file. (GAS/BARREL)", FCVAR_NONE);
g_hVmt = CreateConVar("sm_hl2dm_explosion1_vmt", "particle/particle_smokegrenade1.vmt", "Path to specified VMT file. (GAS/BARREL)", FCVAR_NONE);
g_hSound = CreateConVar("sm_hl2dm_explosion1_sound", "effects/explode.mp3", "Sound to play. Set to \"\" to disable. (GAS/BARREL)", FCVAR_NONE);
g_hVtf2 = CreateConVar("sm_hl2dm_explosion1_vtf_2", "particle/particle_smokegrenade1.vtf", "Path to specified VTF file. (COMBINEBALL)", FCVAR_NONE);
g_hVmt2 = CreateConVar("sm_hl2dm_explosion1_vmt_2", "particle/particle_smokegrenade1.vmt", "Path to specified VMT file. (COMBINEBALL)", FCVAR_NONE);
g_hSound2 = CreateConVar("sm_hl2dm_explosion1_sound_2", "effects/explode.mp3", "Sound to play. Set to \"\" to disable. (COMBINEBALL)", FCVAR_NONE);
g_hDelay = CreateConVar("sm_hl2dm_explosion1_delay", "8.0", "Delay until deleting the created explosion.", FCVAR_NONE);
AutoExecConfig(true, "sm_hl2dm_explosion_v103");
GetConVarString(g_hVtf, g_sVtf, sizeof(g_sVtf));
GetConVarString(g_hVmt, g_sVmt, sizeof(g_sVmt));
GetConVarString(g_hSound, g_sSound, sizeof(g_sSound));
GetConVarString(g_hVtf2, g_sVtf2, sizeof(g_sVtf2));
GetConVarString(g_hVmt2, g_sVmt2, sizeof(g_sVmt2));
GetConVarString(g_hSound2, g_sSound2, sizeof(g_sSound2));
}
public OnMapStart()
{
GetConVarString(g_hVtf, g_sVtf, sizeof(g_sVtf));
GetConVarString(g_hVmt, g_sVmt, sizeof(g_sVmt));
GetConVarString(g_hSound, g_sSound, sizeof(g_sSound));
GetConVarString(g_hVtf2, g_sVtf2, sizeof(g_sVtf2));
GetConVarString(g_hVmt2, g_sVmt2, sizeof(g_sVmt2));
GetConVarString(g_hSound2, g_sSound2, sizeof(g_sSound2));
decl String:sBuffer[PLATFORM_MAX_PATH];
Format(sBuffer, sizeof(sBuffer), "materials/%s", g_sVtf);
AddFileToDownloadsTable(sBuffer);
PrecacheModel(g_sVtf, true);
Format(sBuffer, sizeof(sBuffer), "materials/%s", g_sVmt);
AddFileToDownloadsTable(sBuffer);
PrecacheModel(g_sVmt, true);
if(!StrEqual(g_sSound, ""))
{
Format(sBuffer, sizeof(sBuffer), "sound/%s", g_sSound);
AddFileToDownloadsTable(sBuffer);
PrecacheSound(g_sSound, true);
}
Format(sBuffer, sizeof(sBuffer), "materials/%s", g_sVtf2);
AddFileToDownloadsTable(sBuffer);
PrecacheModel(g_sVtf2, true);
Format(sBuffer, sizeof(sBuffer), "materials/%s", g_sVmt2);
AddFileToDownloadsTable(sBuffer);
PrecacheModel(g_sVmt2, true);
if(!StrEqual(g_sSound2, ""))
{
Format(sBuffer, sizeof(sBuffer), "sound/%s", g_sSound2);
AddFileToDownloadsTable(sBuffer);
PrecacheSound(g_sSound2, true);
}
}
public OnEntityCreated(entity, const String:classname[])
{
if(entity <= MAXPLAYERS)
return;
else if(StrContains(classname, "prop_", false) != -1)
CreateTimer(0.1, Timer_Created, EntIndexToEntRef(entity));
}
public Action:Timer_Created(Handle:timer, any:ref)
{
new entity = EntRefToEntIndex(ref);
if(entity != INVALID_ENT_REFERENCE)
{
decl String:sBuffer[PLATFORM_MAX_PATH];
GetEntPropString(entity, Prop_Data, "m_ModelName", sBuffer, sizeof(sBuffer));
if(StrEqual(sBuffer, "models/items/ar2_grenade.mdl", false))
{
g_iEffect[entity] = 1;
SDKHook(entity, SDKHook_OnTakeDamage, CreateExplosion);
}
else if(StrEqual(sBuffer, "models/weapons/w_grenade.mdl", false))
{
g_iEffect[entity] = 1;
SDKHook(entity, SDKHook_OnTakeDamage, CreateExplosion);
}
else if(StrEqual(sBuffer, "models/items/ammocrate_rockets.mdl", false))
g_iEffect[entity] = 2;
}
}
public OnEntityDestroyed(entity)
{
if(entity >= 0)
{
if(IsValidEntity(entity) && g_iEffect[entity] == 2)
CreateExplosion2(entity);
g_iEffect[entity] = 0;
}
}
CreateExplosion2(entity)
{
new iExplosion = CreateEntityByName("env_ar2explosion");
if(iExplosion > 0)
{
decl Float:fOrigin[3];
GetEntPropVector(entity, Prop_Send, "m_vecOrigin", fOrigin);
DispatchKeyValue(iExplosion, "material", g_sVtf2);
DispatchSpawn(iExplosion);
TeleportEntity(iExplosion, fOrigin, NULL_VECTOR, NULL_VECTOR);
if(!StrEqual(g_sSound2, ""))
EmitAmbientSound(g_sSound2, fOrigin, entity, SNDLEVEL_ROCKET);
CreateTimer(0.1, Timer_Explode, EntIndexToEntRef(iExplosion));
}
return;
}
public Action:CreateExplosion(victim, &attacker, &inflictor, &Float:damage, &damagetype, &weapon, Float:damageForce[3], Float:damagePosition[3], damagecustom)
{
new Float:fHealth = Float:GetEntProp(victim, Prop_Data, "m_iHealth");
if((fHealth - damage) > 0.0)
return Plugin_Continue;
new iExplosion = CreateEntityByName("env_ar2explosion");
if(iExplosion > 0)
{
decl Float:fOrigin[3];
GetEntPropVector(victim, Prop_Send, "m_vecOrigin", fOrigin);
DispatchKeyValue(iExplosion, "material", g_sVtf);
DispatchSpawn(iExplosion);
TeleportEntity(iExplosion, fOrigin, NULL_VECTOR, NULL_VECTOR);
if(!StrEqual(g_sSound, ""))
EmitAmbientSound(g_sSound, fOrigin, victim, SNDLEVEL_ROCKET);
CreateTimer(0.1, Timer_Explode, EntIndexToEntRef(iExplosion));
g_iEffect[victim] = 0;
SDKUnhook(victim, SDKHook_OnTakeDamage, CreateExplosion);
}
return Plugin_Continue;
}
public Action:Timer_Explode(Handle:timer, any:ref)
{
new entity = EntRefToEntIndex(ref);
if(entity != INVALID_ENT_REFERENCE)
{
AcceptEntityInput(entity, "Explode");
CreateTimer(GetConVarFloat(g_hDelay), Timer_Kill, ref);
}
}
public Action:Timer_Kill(Handle:timer, any:ref)
{
new entity = EntRefToEntIndex(ref);
if(entity != INVALID_ENT_REFERENCE)
{
AcceptEntityInput(entity, "Kill");
}
}