Raised This Month: $51 Target: $400
 12% 

[REQ] Plz Fix The Smoke Grenade! (1.6)


Post New Thread Reply   
 
Thread Tools Display Modes
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 04-04-2016 , 07:57   Re: [REQ] Plz Fix The Smoke Grenade! (1.6)
Reply With Quote #11

Well, I did it yesterday and forgot to post. Here it is:
Code:
#include <amxmodx> #include <fakemeta> #include <okapi> const m_usEvent     = 114 const CustomGrenade = 6789 new okapi_func:CGrenade_SG_Detonate new okapi_func:CGrenade_ShootSmokeGrenade public plugin_init() {     new CGrenade_FunctionAddress         new const SG_DetonateWindowsSymbol[] = "?SG_Detonate@CGrenade@@QAEXXZ"     new const SG_DetonateLinuxSymbol  [] = "SG_Detonate__8CGrenade"         if     (         (CGrenade_FunctionAddress = okapi_mod_get_symbol_ptr(SG_DetonateWindowsSymbol)) ||         (CGrenade_FunctionAddress = okapi_mod_get_symbol_ptr(SG_DetonateLinuxSymbol))     )     {         CGrenade_SG_Detonate = okapi_build_method(CGrenade_FunctionAddress, arg_void, arg_cbase)         okapi_add_hook(CGrenade_SG_Detonate, "OnSG_Detonate", true)     }         new const ShootSmokeGrenadeSignature[] =     {         0x56,0x57,0xFF,0xDEF,0xDEF,0xDEF,0xDEF,0xDEF,0x85,0xDEF,0x75,0xDEF,0x33,0xDEF,0xEB,         0xDEF,0x8D,0xDEF,0xDEF,0xDEF,0xDEF,0xDEF,0x8B,0xDEF,0xDEF,0xDEF,0xDEF,0xDEF,0x85,         0xDEF,0x74,0xDEF,0x8B,0xDEF,0xDEF,0x85,0xDEF,0x75,0xDEF,0x68,0xDEF,0xDEF,0xDEF,         0xDEF,0x50,0xFF,0xDEF,0xDEF,0xDEF,0xDEF,0xDEF,0x8B,0xDEF,0x83,0xDEF,0xDEF,0x85,         0xDEF,0x74,0xDEF,0x8B,0xDEF,0xE8,0xDEF,0xDEF,0xDEF,0xDEF,0xC7,0xDEF,0xDEF,0xDEF,         0xDEF,0xDEF,0xEB,0xDEF,0x33,0xDEF,0x89,0xDEF,0xDEF,0x8B,0xDEF,0x8B,0xDEF,0xFF,0xDEF,         0x8B,0xDEF,0xDEF,0x8D,0xDEF,0xDEF,0xDEF,0x51,0x52,0xE8,0xDEF,0xDEF,0xDEF,0xDEF,0x8B,         0xDEF,0xDEF,0x8B,0xDEF,0xDEF,0xDEF,0x8B,0xDEF,0xDEF,0xDEF,0x83,0xDEF,0xDEF,0xD9,0xDEF,0xDEF,0xDEF,0x89,         0xDEF,0x8B,0xDEF,0xDEF,0xDEF,0x83,0xDEF,0xDEF,0x89,0xDEF,0xDEF,0x89,0xDEF,0xDEF,0x8B,0xDEF,0xDEF,0xDEF,         0x8B,0xDEF,0xDEF,0x8D,0xDEF,0xDEF,0x83,0xDEF,0xDEF,0x8B,0xDEF,0x89,0xDEF,0x8B,0xDEF,0xDEF,0x89,0xDEF,         0xDEF,0x8B,0xDEF,0xDEF,0x89,0xDEF,0xDEF,0x8B,0xDEF,0xDEF,0x8B,0xDEF,0xDEF,0xDEF,0xDEF,0xDEF,0x66     }         new const ShootSmokeGrenadeSymbol[] = "_ZN8CGrenade17ShootSmokeGrenadeEP9entvars_s6VectorS2_ft"         if     (         (CGrenade_FunctionAddress = okapi_mod_get_symbol_ptr(ShootSmokeGrenadeSymbol)) ||         (CGrenade_FunctionAddress = okapi_mod_find_sig(ShootSmokeGrenadeSignature, sizeof ShootSmokeGrenadeSignature))     )     {         CGrenade_ShootSmokeGrenade = okapi_build_function(CGrenade_FunctionAddress, arg_cbase, arg_entvars, arg_vec, arg_vec, arg_float, arg_int)     } } public OnSG_Detonate(GrenadeEntity) {     if(pev_valid(GrenadeEntity))     {         if(pev(GrenadeEntity, pev_iuser3) != CustomGrenade)         {             new Float:GrenadeOrigin[3]; pev(GrenadeEntity, pev_origin, GrenadeOrigin)                     new m_usCreateSmoke = get_pdata_int(GrenadeEntity, m_usEvent)             new Entity = okapi_call(CGrenade_ShootSmokeGrenade, pev(GrenadeEntity, pev_owner), GrenadeOrigin, Float:{0.0, 0.0, 0.0}, 0, m_usCreateSmoke)                         if(pev_valid(Entity))             {                 set_pev(Entity, pev_iuser3, CustomGrenade)                 set_pev(Entity, pev_effects, pev(Entity, pev_effects) | EF_NODRAW)             }         }     } }
This create a new smokegrenade where the first one lands, so the effect will be exactly the same. You will need okapi module: https://forums.alliedmods.net/showthread.php?t=234986

As a note, there may be other ways, like altering the first grenade, without creating another one. I just did it like this because it was the easiest way.
__________________

Last edited by HamletEagle; 04-04-2016 at 08:13.
HamletEagle is offline
suhdude
Senior Member
Join Date: Mar 2016
Location: Sweden
Old 04-04-2016 , 08:29   Re: [REQ] Plz Fix The Smoke Grenade! (1.6)
Reply With Quote #12

Quote:
Originally Posted by HamletEagle View Post
Well, I did it yesterday and forgot to post. Here it is:
CODE
This create a new smokegrenade where the first one lands, so the effect will be exactly the same. You will need okapi module: https://forums.alliedmods.net/showthread.php?t=234986

As a note, there may be other ways, like altering the first grenade, without creating another one. I just did it like this because it was the easiest way.
Wow, thanks dude and again sorry I did not get to you earlier. I will try this one out as well!

edit: Great plugin, does exactly what I wanted it to do. HamletEagly you're a great guy, thanks for all the help with this, and the physics plugin.

Last edited by suhdude; 04-04-2016 at 13:13.
suhdude is offline
Arlekyng1998
New Member
Join Date: May 2019
Old 06-02-2021 , 21:31   Re: [REQ] por favor arreglar la granada de humo! (1.6)
Reply With Quote #13

Quote:
Originally Posted by HamletEagle View Post
Well, I did it yesterday and forgot to post. Here it is:
Code:
#include <amxmodx> #include <fakemeta> #include <okapi> const m_usEvent     = 114 const CustomGrenade = 6789 new okapi_func:CGrenade_SG_Detonate new okapi_func:CGrenade_ShootSmokeGrenade public plugin_init() {     new CGrenade_FunctionAddress         new const SG_DetonateWindowsSymbol[] = "?SG_Detonate@CGrenade@@QAEXXZ"     new const SG_DetonateLinuxSymbol  [] = "SG_Detonate__8CGrenade"         if     (         (CGrenade_FunctionAddress = okapi_mod_get_symbol_ptr(SG_DetonateWindowsSymbol)) ||         (CGrenade_FunctionAddress = okapi_mod_get_symbol_ptr(SG_DetonateLinuxSymbol))     )     {         CGrenade_SG_Detonate = okapi_build_method(CGrenade_FunctionAddress, arg_void, arg_cbase)         okapi_add_hook(CGrenade_SG_Detonate, "OnSG_Detonate", true)     }         new const ShootSmokeGrenadeSignature[] =     {         0x56,0x57,0xFF,0xDEF,0xDEF,0xDEF,0xDEF,0xDEF,0x85,0xDEF,0x75,0xDEF,0x33,0xDEF,0xEB,         0xDEF,0x8D,0xDEF,0xDEF,0xDEF,0xDEF,0xDEF,0x8B,0xDEF,0xDEF,0xDEF,0xDEF,0xDEF,0x85,         0xDEF,0x74,0xDEF,0x8B,0xDEF,0xDEF,0x85,0xDEF,0x75,0xDEF,0x68,0xDEF,0xDEF,0xDEF,         0xDEF,0x50,0xFF,0xDEF,0xDEF,0xDEF,0xDEF,0xDEF,0x8B,0xDEF,0x83,0xDEF,0xDEF,0x85,         0xDEF,0x74,0xDEF,0x8B,0xDEF,0xE8,0xDEF,0xDEF,0xDEF,0xDEF,0xC7,0xDEF,0xDEF,0xDEF,         0xDEF,0xDEF,0xEB,0xDEF,0x33,0xDEF,0x89,0xDEF,0xDEF,0x8B,0xDEF,0x8B,0xDEF,0xFF,0xDEF,         0x8B,0xDEF,0xDEF,0x8D,0xDEF,0xDEF,0xDEF,0x51,0x52,0xE8,0xDEF,0xDEF,0xDEF,0xDEF,0x8B,         0xDEF,0xDEF,0x8B,0xDEF,0xDEF,0xDEF,0x8B,0xDEF,0xDEF,0xDEF,0x83,0xDEF,0xDEF,0xD9,0xDEF,0xDEF,0xDEF,0x89,         0xDEF,0x8B,0xDEF,0xDEF,0xDEF,0x83,0xDEF,0xDEF,0x89,0xDEF,0xDEF,0x89,0xDEF,0xDEF,0x8B,0xDEF,0xDEF,0xDEF,         0x8B,0xDEF,0xDEF,0x8D,0xDEF,0xDEF,0x83,0xDEF,0xDEF,0x8B,0xDEF,0x89,0xDEF,0x8B,0xDEF,0xDEF,0x89,0xDEF,         0xDEF,0x8B,0xDEF,0xDEF,0x89,0xDEF,0xDEF,0x8B,0xDEF,0xDEF,0x8B,0xDEF,0xDEF,0xDEF,0xDEF,0xDEF,0x66     }         new const ShootSmokeGrenadeSymbol[] = "_ZN8CGrenade17ShootSmokeGrenadeEP9entvars_s6VectorS2_ft"         if     (         (CGrenade_FunctionAddress = okapi_mod_get_symbol_ptr(ShootSmokeGrenadeSymbol)) ||         (CGrenade_FunctionAddress = okapi_mod_find_sig(ShootSmokeGrenadeSignature, sizeof ShootSmokeGrenadeSignature))     )     {         CGrenade_ShootSmokeGrenade = okapi_build_function(CGrenade_FunctionAddress, arg_cbase, arg_entvars, arg_vec, arg_vec, arg_float, arg_int)     } } public OnSG_Detonate(GrenadeEntity) {     if(pev_valid(GrenadeEntity))     {         if(pev(GrenadeEntity, pev_iuser3) != CustomGrenade)         {             new Float:GrenadeOrigin[3]; pev(GrenadeEntity, pev_origin, GrenadeOrigin)                     new m_usCreateSmoke = get_pdata_int(GrenadeEntity, m_usEvent)             new Entity = okapi_call(CGrenade_ShootSmokeGrenade, pev(GrenadeEntity, pev_owner), GrenadeOrigin, Float:{0.0, 0.0, 0.0}, 0, m_usCreateSmoke)                         if(pev_valid(Entity))             {                 set_pev(Entity, pev_iuser3, CustomGrenade)                 set_pev(Entity, pev_effects, pev(Entity, pev_effects) | EF_NODRAW)             }         }     } }
This create a new smokegrenade where the first one lands, so the effect will be exactly the same. You will need okapi module: https://forums.alliedmods.net/showthread.php?t=234986

As a note, there may be other ways, like altering the first grenade, without creating another one. I just did it like this because it was the easiest way.
men when I install this plugin I get server errors

I don't know if you can help me?

HTML Code:
/tmp/dumps/crash_20210603012445_1.dmp
Segmentation fault (core dumped)
email debug.log to [email protected]
Thu Jun  3 01:24:45 UTC 2021: Server restart in 3 seconds
crash_20210603012445_1.dmp[1333]: Finished uploading minidump (out-of-process): success = yes
crash_20210603012445_1.dmp[1333]: response: CrashID=bp-6b714db9-8463-4319-b2e7-f7b9e2210602
crash_20210603012445_1.dmp[1333]: file ''/tmp/dumps/crash_20210603012445_1.dmp'', upload yes: ''CrashID=bp-6b714db9-8463-4319-b2e7-f7b9e2210602''
Using breakpad crash handler
Setting breakpad minidump AppID = 10
Forcing breakpad minidump interfaces to load
Looking up breakpad interfaces from steamclient
Calling BreakpadMiniDumpSystemInit
Arlekyng1998 is offline
Reply



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 22:32.


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