Raised This Month: $ Target: $400
 0% 

Simple effect (weapon remover)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
alonelive
Senior Member
Join Date: Jan 2011
Location: Big snow country.. :)
Old 01-20-2013 , 02:30   Simple effect (weapon remover)
Reply With Quote #1

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

#define PLUGIN "Destroy Weapons" 
#define AUTHOR "ConnorMcLeod" 
#define VERSION "0.0.1" 

public plugin_init() 

    
register_plugin(PLUGINVERSIONAUTHOR

    
register_forward(FM_SetModel"SetModel"


public 
SetModel(iEntszModel[]) 

    if( 
equal(szModel"models/w_"9) ) 
    {
        new 
szClassName[2]
        
pev(iEntpev_classnameszClassNamecharsmax(szClassName))
        if( 
szClassName[0] == 'w' // "weaponbox" against "grenade"
        
{
            
set_pev(iEntpev_nextthinkget_gametime() + 10.0)
        }
    } 

Hello all! This plugin removes dropped weapon after 10 second. Is possible to add an effect to this process?
For example,

PHP Code:
g_Explode precache_model("sprites/white.spr");

// how to get origin of dropped weapon? 
// new Float:Origin[3]
// get.. weapon.. origin..

create_explode(Origin[3])
{
    
message_begin(MSG_BROADCAST,SVC_TEMPENTITY); 
    
write_byte(TE_EXPLOSION2); 
    
write_coord(vec1[0]); 
    
write_coord(vec1[1]); 
    
write_coord(vec1[2]); 
    
write_byte(185); 
    
write_byte(10); 
    
message_end();

__________________
sorry my bad english...
alonelive is offline
simanovich
AlliedModders Donor
Join Date: Jun 2012
Location: Israel
Old 01-20-2013 , 02:50   Re: Simple effect (weapon remover)
Reply With Quote #2

you need to get the ent origin

Try:
PHP Code:
pev(iEnt,pev_origin,... //the var to store the origin); 
__________________
simanovich is offline
alonelive
Senior Member
Join Date: Jan 2011
Location: Big snow country.. :)
Old 01-20-2013 , 08:01   Re: Simple effect (weapon remover)
Reply With Quote #3

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

#define PLUGIN "Destroy Weapons" 
#define AUTHOR "ConnorMcLeod" 
#define VERSION "0.0.1" 

new Float:w_Origin[3]
new 
TEST_EXPL

public plugin_init() 

    
register_plugin(PLUGINVERSIONAUTHOR
    
register_forward(FM_SetModel"SetModel"
}

public 
plugin_precache()
{
    
TEST_EXPL precache_model"sprites/flame.spr" );


public 
SetModel(iEntszModel[]) 

    if( 
equal(szModel"models/w_"9) ) 
    {
        new 
szClassName[2]
        
pev(iEntpev_classnameszClassNamecharsmax(szClassName))
        if( 
szClassName[0] == 'w' // "weaponbox": remove all weapons, but not a "grenade"
        
{
              
//effects begin
              
pev(iEntpev_originw_Origin)
              
message_begin(MSG_BROADCAST,SVC_TEMPENTITY); 
              
write_byte(TEST_EXPL); 
              
write_coord(w_Origin[0]); 
              
write_coord(w_Origin[1]); 
              
write_coord(w_Origin[2]); 
              
write_byte(185); 
              
write_byte(10); 
              
message_end();
              
//effects end
              
              
set_pev(iEntpev_nextthinkget_gametime() + 10.0//remove dropped weapon code..
        
}
    } 

Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

Warning: Tag mismatch on line 34
Warning: Tag mismatch on line 35
Warning: Tag mismatch on line 36
Header size: 408 bytes
Code size: 936 bytes
Data size: 316 bytes
Stack/heap size: 16384 bytes; estimated max. usage=41 cells (164 bytes)
Total requirements: 18044 bytes

3 Warnings.
Done.

And does not work. I am not a programmer..
__________________
sorry my bad english...
alonelive is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-20-2013 , 14:27   Re: Simple effect (weapon remover)
Reply With Quote #4

PHP Code:
#include <amxmodx>
#include <fakemeta_stocks>
#include <hamsandwich>

#define PLUGIN "Weapon Stay Time With Effect"
#define VERSION "0.0.1"

const XO_CWEAPONBOX 4
new const m_rgpPlayerItems_CWeaponBox[6] = { 34 35 , ... }

new 
g_pWeaponBoxDisappearTimeg_pWeaponBoxDisappearFx
new g_iFhSetModel

public plugin_init()
{
    
register_pluginPLUGINVERSION"ConnorMcLeod" )

    
g_pWeaponBoxDisappearTime register_cvar("mp_weapon_stay_time""10.0")
    
g_pWeaponBoxDisappearFx register_cvar("mp_weapon_stay_effect""1")

    
RegisterHam(Ham_Spawn"weaponbox""OnCWeaponBox_Spawn_Post"true)
    
RegisterHam(Ham_Think"weaponbox""OnCWeaponBox_Think_Post"true)
}

public 
OnCWeaponBox_Spawn_Post()
{
    
g_iFhSetModel register_forward(FM_SetModel"OnSetModel_WeaponBox_Post"true)
}

public 
OnSetModel_WeaponBox_PostiWeaponBox /* , szModel[] */ )
{
    if( 
get_pdata_cbase(iWeaponBoxm_rgpPlayerItems_CWeaponBox[5], XO_CWEAPONBOX) <= // Filter with c4
    
{
        
set_pev(iWeaponBoxpev_nextthinkget_gametime() + get_pcvar_float(g_pWeaponBoxDisappearTime))
    }
    
unregister_forward(FM_SetModelg_iFhSetModeltrue)
}

public 
OnCWeaponBox_Think_PostiWeaponBox )
{
    if( 
get_pcvar_num(g_pWeaponBoxDisappearFx) && pev_valid(iWeaponBox) && pev(iWeaponBoxpev_flags) & FL_KILLME )
    {
        new 
Float:origin[3]
        
pev(iWeaponBoxpev_originorigin)
        
EF_MessageBegin(MSG_PASSVC_TEMPENTITYorigin0)
        
write_byte(TE_EXPLOSION2)
        
EF_WriteCoordorigin[0] )
        
EF_WriteCoordorigin[1] )
        
EF_WriteCoordorigin[2] )
        
write_byte(185)
        
write_byte(10)
        
message_end()
    }

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
alonelive
Senior Member
Join Date: Jan 2011
Location: Big snow country.. :)
Old 01-21-2013 , 02:51   Re: Simple effect (weapon remover)
Reply With Quote #5

Thank you, Connor, but weapons removes after 10 seconds without any effect
__________________
sorry my bad english...

Last edited by alonelive; 01-21-2013 at 02:52.
alonelive is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-21-2013 , 13:35   Re: Simple effect (weapon remover)
Reply With Quote #6

Does work for me.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
alonelive
Senior Member
Join Date: Jan 2011
Location: Big snow country.. :)
Old 01-21-2013 , 13:45   Re: Simple effect (weapon remover)
Reply With Quote #7

Can you give a screenshot please?
maybe this plugin can conflict with some my plugins..
__________________
sorry my bad english...
alonelive 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 13:38.


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