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

Pen Pineapple Apple Pen C4 [PPAP C4]


Post New Thread Reply   
 
Thread Tools Display Modes
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-16-2016 , 10:57   Re: Pen Pineapple Apple Pen C4 [PPAP C4]
Reply With Quote #11

Quote:
Originally Posted by OciXCrom View Post

PS: I was wondering if there's a way to get the C4's integer after it has been planted? I'm currently using an invisible entity at the c4's position.
There are multiple ways, but a nice one would be:
PHP Code:
#if AMXX_VERSION_NUM < 183
const INT_BYTES 
const BYTE_BITS 

stock bool
:get_pdata_bool(entcharbased_offsetintbase_linuxdiff 5

    return !!(
get_pdata_int(entcharbased_offset INT_BYTESintbase_linuxdiff) & (0xFF<<((charbased_offset INT_BYTES) * BYTE_BITS))) 

#endif

const m_bIsC4     385    
new GrenadeEntity FM_NULLENT

while((GrenadeEntity engfunc(EngFunc_FindEntityByStringGrenadeEntity"classname""grenade")))
{
    if(
pev_valid(GrenadeEntity) && get_pdata_bool(GrenadeEntitym_bIsC4))
    {
        
//do your stuff
        
break
    }

After it's planted the classname is "grenade" and m_bIsC4 is set to true.
__________________

Last edited by HamletEagle; 12-16-2016 at 10:58.
HamletEagle is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 12-16-2016 , 12:28   Re: Pen Pineapple Apple Pen C4 [PPAP C4]
Reply With Quote #12

That worked, but the sound won't stop playing after the bomb explodes.

PHP Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>

#define PLUGIN_VERSION "2.0"
#define TASK_AURA 665789
#define RANDOM_COLOR random_num(50, 255)
#define BOMB_MODEL "models/iplay/apple.mdl"
#define BOMB_SOUND "iplay/ppap.wav"
#define AURA_FREQ 0.6
#define AURA_RADIUS 30
#define AURA_LIFE 8
#define AURA_DECAY 25

#if AMXX_VERSION_NUM < 183
    
const INT_BYTES 
    
const BYTE_BITS 

    bool
:get_pdata_bool(entcharbased_offsetintbase_linuxdiff 5
        return !!(
get_pdata_int(entcharbased_offset INT_BYTESintbase_linuxdiff) & (0xFF<<((charbased_offset INT_BYTES) * BYTE_BITS)))
#endif

const m_bIsC4 385

public plugin_init()
{
    
register_plugin("Crazy C4"PLUGIN_VERSION"OciXCrom")
    
register_cvar("@CrazyC4"PLUGIN_VERSIONFCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED)
    
register_logevent("OnBombPlanted"3"2=Planted_The_Bomb")
}

public 
plugin_precache()
{
    
precache_model(BOMB_MODEL)
    
precache_sound(BOMB_SOUND)
}

public 
OnBombPlanted()
{
    new 
iC4 FM_NULLENT

    
while((iC4 engfunc(EngFunc_FindEntityByStringiC4"classname""grenade")))
    {
        if(
pev_valid(iC4) && get_pdata_bool(iC4m_bIsC4))
        {
            
engfunc(EngFunc_SetModeliC4BOMB_MODEL)
            
emit_sound(iC4CHAN_STATICBOMB_SOUND1.0ATTN_NORM0PITCH_NORM)
            
set_task(AURA_FREQ"MakeAura"iC4 TASK_AURA, .flags "b")
            break
        }
    }
}

public 
MakeAura(iC4)
{
    
iC4 -= TASK_AURA
    
    
if(!pev_valid(iC4) || !get_pdata_bool(iC4m_bIsC4))
    {
        
emit_sound(iC4CHAN_STATICBOMB_SOUND1.0ATTN_NORMSND_STOPPITCH_NORM)
        
remove_task(iC4 TASK_AURA)
        return
    }
    
    new 
Float:fOrigin[3], iOrigin[3]
    
pev(iC4pev_originfOrigin)
    
iOrigin[0] = floatround(fOrigin[0])
    
iOrigin[1] = floatround(fOrigin[1])
    
iOrigin[2] = floatround(fOrigin[2])
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byte(TE_DLIGHT)
    
write_coord(iOrigin[0])
    
write_coord(iOrigin[1])
    
write_coord(iOrigin[2])
    
write_byte(AURA_RADIUS)
    
write_byte(RANDOM_COLOR)
    
write_byte(RANDOM_COLOR)
    
write_byte(RANDOM_COLOR)
    
write_byte(AURA_LIFE)
    
write_byte(AURA_DECAY)
    
message_end()
    
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byte(TE_SPARKS)
    
write_coord(iOrigin[0])
    
write_coord(iOrigin[1])
    
write_coord(iOrigin[2])
    
message_end()

How do I actually detect if the bomb is no longer planted?
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-16-2016 , 12:47   Re: Pen Pineapple Apple Pen C4 [PPAP C4]
Reply With Quote #13

You could look inside bombstatus and see where IsBombPlanted is set to false. Anyway:
-bomb_explode
-bomb_defused
-roundend

Basically, use a bool, set it to true when bomb is planted and to false in above cases. That's an easy way.
__________________

Last edited by HamletEagle; 12-16-2016 at 12:47.
HamletEagle is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 12-16-2016 , 13:24   Re: Pen Pineapple Apple Pen C4 [PPAP C4]
Reply With Quote #14

Hmm, when the bomb is defused/explodes the round does end, so I'll use that. Thanks.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 01-08-2017 , 09:45   Re: Pen Pineapple Apple Pen C4 [PPAP C4]
Reply With Quote #15

More than 15 days have passed and I don't see any changes from the author. Since section needs to be cleaned I'll unapprove this for now, but don't worry, your plugin can be reviewed at any time. PM a plugin approver after you made the changes.
__________________
HamletEagle 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 22:08.


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