Raised This Month: $ Target: $400
 0% 

need help with smoke from smoke nade


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Voi
Veteran Member
Join Date: Sep 2006
Location: Gdansk, Poland
Old 11-21-2006 , 13:16   need help with smoke from smoke nade
Reply With Quote #1

hi, i need help with this code(its taken from ghw chronic's nade 'em)
all i wanna do is to connect smoke_explosion1 to a smoke from "smoke nade"(and replace it), so when a "smoke nade" explodes the smoke dont appear(or its deleted) and the new smoke from this plugin is created

the main purpose of this plugin is to fix lags when close to a smoke from "smoke nade"

ps. dont shoot me for the effect, i will finish it when i find a way to replace the smoke, so pls help me guys

Code:

Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> #include <fun> #include <fakemeta> new smokesprite new smokespritex public plugin_init() {     register_plugin("SmokeNadeFix","0.1","GHW_Chronic") } public plugin_precache() {     smokesprite = precache_model("sprites/smokepuff.spr")         smokespritex = precache_model("sprites/wall_puff1.spr") } public smoke_explode1(id) {     if(!pev_valid(id))     {         return PLUGIN_HANDLED     }     emit_sound(id,CHAN_WEAPON,"weapons/sg_explode.wav",1.0,ATTN_NORM,0,PITCH_NORM)     set_task(0.6,"smoke_explode",id,"",0,"a",34)     set_task(0.6,"smoke_explodex",id,"",0,"a",34)     set_task(20.5,"smoke_delete",id)     set_task(20.6,"smoke_delete",id)     return PLUGIN_HANDLED } public smoke_explodex(id) {     if(!pev_valid(id))     {         return PLUGIN_HANDLED     }     new Float:origin2[3]     pev(id,pev_origin,origin2)     new origin[3]     origin[0] = floatround(origin2[0]) + random_num(-75,75)     origin[1] = floatround(origin2[1]) + random_num(-75,75)     origin[2] = floatround(origin2[2]) + random_num(0,65)     message_begin( MSG_BROADCAST,SVC_TEMPENTITY,origin)     write_byte( 3 )     write_coord(origin[0])  // start position     write_coord(origin[1])     write_coord(origin[2])     write_short(smokespritex)     write_byte( 60 ) // byte (scale in 0.1's) 188     write_byte( 5 ) // byte (framerate)     write_byte( 14 ) // byte flags     message_end()     return PLUGIN_HANDLED } public smoke_explode(id) {     if(!pev_valid(id))     {         return PLUGIN_HANDLED     }     new Float:origin2[3]     pev(id,pev_origin,origin2)     new origin[3]     origin[0] = floatround(origin2[0]) + random_num(-75,75)     origin[1] = floatround(origin2[1]) + random_num(-75,75)     origin[2] = floatround(origin2[2]) + random_num(0,65)     message_begin( MSG_BROADCAST,SVC_TEMPENTITY,origin)     write_byte( 3 )     write_coord(origin[0])  // start position     write_coord(origin[1])     write_coord(origin[2])     write_short(smokesprite)     write_byte( 30 ) // byte (scale in 0.1's) 188     write_byte( 5 ) // byte (framerate)     write_byte( 14 ) // byte flags     message_end()     return PLUGIN_HANDLED } public smoke_delete(id) {     if(!pev_valid(id))     {         return PLUGIN_HANDLED     }     engfunc(EngFunc_RemoveEntity,id)     return PLUGIN_HANDLED } public set_velocities(id) {     if(!pev_valid(id))     {         return PLUGIN_HANDLED     }     new Float:velocity[3]     pev(id,pev_velocity,velocity)     velocity[0] *= 0.9     velocity[1] *= 0.9     velocity[2] *= 0.9     set_pev(id,pev_velocity,velocity)     return PLUGIN_HANDLED }
__________________
Voi is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 11-21-2006 , 14:53   Re: need help with smoke from smoke nade
Reply With Quote #2

Look in "Teleport Smoke Grenade" plugin ( http://forums.alliedmods.net/search.php ), i've blocked the smoke there.
VEN is offline
Voi
Veteran Member
Join Date: Sep 2006
Location: Gdansk, Poland
Old 11-21-2006 , 15:44   Re: need help with smoke from smoke nade
Reply With Quote #3

thx, hope im not too noob to connect this
__________________
Voi is offline
Voi
Veteran Member
Join Date: Sep 2006
Location: Gdansk, Poland
Old 11-21-2006 , 16:28   Re: need help with smoke from smoke nade
Reply With Quote #4

Code:

Code:
/* AMX Mod X *   Teleport Smoke Grenade * * (c) Copyright 2006 by VEN * * This file is provided as is (no warranties) * *     DESCRIPTION *       Plugin changes the smoke grenade to teleport grenade with a bit of smoke. *       Usage: drop the grenade, you will be teleported to the spot of explosion. *       Try to crouch if the height of the spot are small for uncrouched player. * *     CREDITS *       Dread Pirate - idea */ #include <amxmodx> #include <fakemeta> #define PLUGIN_NAME "Teleport Smoke Grenade" #define PLUGIN_VERSION "0.1" #define PLUGIN_AUTHOR "VEN" #define SMOKE_SCALE 30 #define SMOKE_FRAMERATE 12 #define SMOKE_GROUND_OFFSET 6 // do not edit new const g_sound_explosion[] = "weapons/sg_explode.wav" new const g_classname_grenade[] = "grenade" new const Float:g_sign[4][2] = {{1.0, 1.0}, {1.0, -1.0}, {-1.0, -1.0}, {-1.0, 1.0}} new g_spriteid_steam1 new g_eventid_createsmoke public plugin_init() {     register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)     register_forward(FM_EmitSound, "forward_emitsound")     register_forward(FM_PlaybackEvent, "forward_playbackevent")     // we do not precaching, but retrieving the indexes     g_spriteid_steam1 = engfunc(EngFunc_PrecacheModel, "sprites/steam1.spr")     g_eventid_createsmoke = engfunc(EngFunc_PrecacheEvent, 1, "events/createsmoke.sc") } public forward_emitsound(ent, channel, const sound[]) {     if (!equal(sound, g_sound_explosion) || !is_grenade(ent))         return FMRES_IGNORED     static id, Float:origin[3]     id = pev(ent, pev_owner)     pev(ent, pev_origin, origin)     engfunc(EngFunc_EmitSound, ent, CHAN_WEAPON, g_sound_explosion, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)     engfunc(EngFunc_RemoveEntity, ent)     origin[2] += SMOKE_GROUND_OFFSET     create_smoke(origin)     if (is_user_alive(id)) {         static Float:mins[3], hull         pev(id, pev_mins, mins)         origin[2] -= mins[2] + SMOKE_GROUND_OFFSET         hull = pev(id, pev_flags) & FL_DUCKING ? HULL_HEAD : HULL_HUMAN         if (is_hull_vacant(origin, hull))             engfunc(EngFunc_SetOrigin, id, origin)         else { // close to a solid object, trying to find a vacant spot             static Float:vec[3]             vec[2] = origin[2]             for (new i; i < sizeof g_sign; ++i) {                 vec[0] = origin[0] - mins[0] * g_sign[i][0]                 vec[1] = origin[1] - mins[1] * g_sign[i][1]                 if (is_hull_vacant(vec, hull)) {                     engfunc(EngFunc_SetOrigin, id, vec)                     break                 }             }         }     }     return FMRES_SUPERCEDE } public forward_playbackevent(flags, invoker, eventindex) {     // we do not need a large amount of smoke     if (eventindex == g_eventid_createsmoke)         return FMRES_SUPERCEDE     return FMRES_IGNORED } bool:is_grenade(ent) {     if (!pev_valid(ent))         return false     static classname[sizeof g_classname_grenade + 1]     pev(ent, pev_classname, classname, sizeof g_classname_grenade)     if (equal(classname, g_classname_grenade))         return true     return false } create_smoke(const Float:origin[3]) {     // engfunc because origin are float     engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin, 0)     write_byte(TE_SMOKE)     engfunc(EngFunc_WriteCoord, origin[0])     engfunc(EngFunc_WriteCoord, origin[1])     engfunc(EngFunc_WriteCoord, origin[2])     write_short(g_spriteid_steam1)     write_byte(SMOKE_SCALE)     write_byte(SMOKE_FRAMERATE)     message_end() } stock bool:is_hull_vacant(const Float:origin[3], hull) {     new tr = 0     engfunc(EngFunc_TraceHull, origin, origin, 0, hull, 0, tr)     if (!get_tr2(tr, TR_StartSolid) && !get_tr2(tr, TR_AllSolid) && get_tr2(tr, TR_InOpen))         return true         return false }
argh im blind or too noob, pls tell me what part is for smoke dissapear
__________________
Voi is offline
Voi
Veteran Member
Join Date: Sep 2006
Location: Gdansk, Poland
Old 11-22-2006 , 11:02   Re: need help with smoke from smoke nade
Reply With Quote #5

ok i've got this:

Code:

Code:
/* AMX Mod X *   Teleport Smoke Grenade * * (c) Copyright 2006 by VEN * * This file is provided as is (no warranties) * *     DESCRIPTION *       Plugin changes the smoke grenade to teleport grenade with a bit of smoke. *       Usage: drop the grenade, you will be teleported to the spot of explosion. *       Try to crouch if the height of the spot are small for uncrouched player. * *     CREDITS *       Dread Pirate - idea */ #include <amxmodx> #include <fakemeta> #define PLUGIN_NAME "SmokeNadeFixer" #define PLUGIN_VERSION "0.1" #define PLUGIN_AUTHOR "VEN/GHW CHRONIC/VoivoD" #define SMOKE_SCALE 30 #define SMOKE_FRAMERATE 12 #define SMOKE_GROUND_OFFSET 6 // do not edit new const g_sound_explosion[] = "weapons/sg_explode.wav" new const g_classname_grenade[] = "grenade" new smokesprite new smokespritex new const Float:g_sign[4][2] = {{1.0, 1.0}, {1.0, -1.0}, {-1.0, -1.0}, {-1.0, 1.0}} new ent = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString, "info_target")) new g_spriteid_steam1 new g_eventid_createsmoke public plugin_init() {     register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)     register_forward(FM_EmitSound, "forward_emitsound")     register_forward(FM_PlaybackEvent, "forward_playbackevent")     // we do not precaching, but retrieving the indexes     g_spriteid_steam1 = engfunc(EngFunc_PrecacheModel, "sprites/steam1.spr")         g_eventid_createsmoke = engfunc(EngFunc_PrecacheEvent, 1, "events/createsmoke.sc") } public plugin_precache() {     smokesprite = precache_model("sprites/smokepuff.spr")         smokespritex = precache_model("sprites/wall_puff1.spr") } public forward_emitsound(ent, channel, const sound[]) {     if (!equal(sound, g_sound_explosion) || !is_grenade(ent))         return FMRES_IGNORED     static id, Float:origin[3]     id = pev(ent, pev_owner)     pev(ent, pev_origin, origin)     engfunc(EngFunc_EmitSound, ent, CHAN_WEAPON, g_sound_explosion, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)     engfunc(EngFunc_RemoveEntity, ent)     origin[2] += SMOKE_GROUND_OFFSET     create_smoke(origin)     set_task(2.0,"smoke_explode1",ent)     return PLUGIN_HANDLED } public forward_playbackevent(flags, invoker, eventindex) {     // we do not need a large amount of smoke     if (eventindex == g_eventid_createsmoke)         return FMRES_SUPERCEDE     return FMRES_IGNORED } bool:is_grenade(ent) {     if (!pev_valid(ent))         return false     static classname[sizeof g_classname_grenade + 1]     pev(ent, pev_classname, classname, sizeof g_classname_grenade)     if (equal(classname, g_classname_grenade))         return true     return false } create_smoke(const Float:origin[3]) {     // engfunc because origin are float     engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin, 0)     write_byte(TE_SMOKE)     engfunc(EngFunc_WriteCoord, origin[0])     engfunc(EngFunc_WriteCoord, origin[1])     engfunc(EngFunc_WriteCoord, origin[2])     write_short(g_spriteid_steam1)     write_byte(SMOKE_SCALE)     write_byte(SMOKE_FRAMERATE)     message_end() } stock bool:is_hull_vacant(const Float:origin[3], hull) {     new tr = 0     engfunc(EngFunc_TraceHull, origin, origin, 0, hull, 0, tr)     if (!get_tr2(tr, TR_StartSolid) && !get_tr2(tr, TR_AllSolid) && get_tr2(tr, TR_InOpen))         return true         return false } public smoke_explode1(id) {     if(!pev_valid(id))     {         return PLUGIN_HANDLED     }     emit_sound(id,CHAN_WEAPON,"weapons/sg_explode.wav",1.0,ATTN_NORM,0,PITCH_NORM)     set_task(0.6,"smoke_explode",id,"",0,"a",34)     set_task(20.5,"smoke_delete",id)     return PLUGIN_HANDLED } public smoke_explode(id) {     if(!pev_valid(id))     {         return PLUGIN_HANDLED     }     new Float:origin2[3]     pev(id,pev_origin,origin2)     new origin[3]     origin[0] = floatround(origin2[0]) + random_num(-75,75)     origin[1] = floatround(origin2[1]) + random_num(-75,75)     origin[2] = floatround(origin2[2]) + random_num(0,65)     message_begin( MSG_BROADCAST,SVC_TEMPENTITY,origin)     write_byte( 3 )     write_coord(origin[0])  // start position     write_coord(origin[1])     write_coord(origin[2])     write_short(smokesprite)     write_byte( 60 ) // byte (scale in 0.1's) 188     write_byte( 5 ) // byte (framerate)     write_byte( 14 ) // byte flags     message_end()     return PLUGIN_HANDLED } public smoke_delete(id) {     if(!pev_valid(id))     {         return PLUGIN_HANDLED     }     engfunc(EngFunc_RemoveEntity,id)     return PLUGIN_HANDLED }
anyone know how to connect smoke_explode1 to the rest of the plugin?
sorry for code mess i will clean it up...
__________________
Voi 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 06:54.


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