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

Ring Backpack


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
MayroN
Senior Member
Join Date: Aug 2017
Location: Kyiv
Old 03-30-2022 , 18:24   Ring Backpack
Reply With Quote #1

One person added a code so that the ring would be displayed on a thrown bomb

Here is his screenshot



The fact is that if I throw a bomb, it will immediately disappear along with the ring without touching the ground ....

There is also a smoke option. - but oddly enough - it works fine for me

Tell me what could be wrong in the code

Tested with this plugin

thanks for the help

PHP Code:
#pragma semicolon 1

#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#include <engine>

new g_Backpack_SmokeSprite;

#define BOMB_PACK_ICON        "sprites/backpack_smoke/backpack_ring.spr"
#define BRINGHTNEES            255.0

new Float:fColor[][3] = {
    {
255.00.00.0},
    {
0.00.0255.0},
    {
0.0255.00.0},
    {
255.0255.06.0},
    {
255.00.0255.0}
};

public 
plugin_init()
{
    
register_plugin("C4 Smoke""1.0""fl0wer");

    
register_forward(FM_SetModel"@FM_SetModel_Post"true);

    
RegisterHam(Ham_Think"weaponbox""@CWeaponBox_Think_Pre"false);
    
    
register_think("C4_Ring""@C4_Ring_Think");
}

public 
plugin_precache()
{
    
g_Backpack_SmokeSprite precache_model("sprites/backpack_smoke/backpack_smoke.spr");
    
precache_model(BOMB_PACK_ICON);
}

@
FM_SetModel_Post(entmodel[])
{
    if (
containi(model"w_backpack") == -1)
        return;
    
    
set_pev(entpev_iuser11);
    
set_pev(entpev_iuser3random_num(01));
    
set_pev(entpev_nextthinkget_gametime() + 0.2);
}

@
CWeaponBox_Think_Pre(id)
{
    new 
Float:time get_gametime();
    
    if (!
pev(idpev_iuser1))
        return 
HAM_IGNORED;
        
    
set_pev(idpev_nextthinktime 0.2);

    new 
Float:vecOrigin[3];    pev(idpev_originvecOrigin);
    
    switch(
pev(idpev_iuser3))    {
        case 
0:    {
            
engfunc(EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYvecOrigin0);
            
write_byte(TE_FIREFIELD);
            
engfunc(EngFunc_WriteCoordvecOrigin[0]);
            
engfunc(EngFunc_WriteCoordvecOrigin[1]);
            
engfunc(EngFunc_WriteCoordvecOrigin[2] += 15.0);
            
write_short(2);
            
write_short(g_Backpack_SmokeSprite);
            
write_byte(1);
            
write_byte(TEFIRE_FLAG_ALLFLOAT TEFIRE_FLAG_ALPHA);
            
write_byte(10);
            
message_end();
        }
        case 
1:    {
            if (
pev(idpev_iuser2))
                return 
HAM_IGNORED;
            
            
vecOrigin[2] += 30.0;
            
engfunc(EngFunc_SetOriginidvecOrigin);
            
            new 
iEnt create_entity("env_sprite");
            
set_pev(iEntpev_classname"C4_Ring");
            
engfunc(EngFunc_SetOriginiEntvecOrigin);
            
engfunc(EngFunc_SetModeliEntBOMB_PACK_ICON);
            
set_pev(iEntpev_solidSOLID_NOT);
            
set_pev(iEntpev_movetypeMOVETYPE_FLY);
            
set_pev(iEntpev_iuser1id);
            
set_pev(iEntpev_nextthinktime 0.1);
            
            
set_pev(iEntpev_renderamtBRINGHTNEES);
        
//    set_pev(iEnt, pev_rendermode, kRenderTransAdd);            //    Раскоментируй если нужна прозрачность
            
set_pev(iEntpev_rendercolorfColor[random_num(0charsmax(fColor))]);
            
            
set_pev(idpev_iuser2iEnt);
        }
    }
    
    return 
HAM_SUPERCEDE;
}

@
C4_Ring_Think(ent)    {
    if (!
pev_valid(ent))
        return;
    
    if (!
pev_valid(pev(entpev_iuser1)))    {
        
remove_entity(ent);
        return;
    }
    
    
set_pev(entpev_nextthinkget_gametime() + 0.1);

__________________
МультиМод CS 83.222.97.124:27015

MayroN is offline
Send a message via ICQ to MayroN Send a message via Skype™ to MayroN
 



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 18:07.


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