Raised This Month: $ Target: $400
 0% 

fix plugin need help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SAMURAI16
BANNED
Join Date: Sep 2006
Old 02-07-2007 , 01:40   fix plugin need help
Reply With Quote #1

hey guys i need some help on this code:
Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <fakemeta_util>

new const PLUGIN[] = "Explosive Flashbangs"
new const VERSION[] = "0.1.0"
new const AUTHOR[] = "SAMURAI"

#define TE_EXPLOSION 3
new explode;
new g_MaxPlayers
new pCvar;

public plugin_init() 
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    pCvar = register_cvar("explosive_flashbangs","1");
    register_forward(FM_EmitSound,"fw_emitsound");
    g_MaxPlayers = get_maxplayers()
}

public plugin_precache()
{
    explode = precache_model("sprites/explode1.spr");
}

public fw_emitsound(entity,channel,const sample[],Float:volume,Float:attenuation,fFlags,pitch)
{
    if( !get_pcvar_num(pCvar) && !equali(sample,"weapons/flashbang-1.wav") && !equali(sample,"weapons/flashbang-2.wav") )
        return FMRES_IGNORED;
    flashbang_explode(entity);
    return FMRES_IGNORED;
}

public flashbang_explode(greindex)
{
    if(!is_user_connected(greindex))
    return PLUGIN_HANDLED;
    
    new Float:origin[3];
    pev(greindex,pev_origin,origin);
    
    message_begin( MSG_BROADCAST,SVC_TEMPENTITY); 
    write_byte(TE_EXPLOSION);
    write_coord(floatround(origin[0])); 
    write_coord(floatround(origin[1]));   
    write_coord(floatround(origin[2]));
    
    write_short(explode); 
    
    write_byte(80);
    write_byte(10);
    write_byte(0);
    
    message_end();
    
    flashbang_damage(origin, "flashbang", 25.0, 5.0)
    
    return PLUGIN_CONTINUE;

}  


public flashbang_damage(Float:origin[3], const classname[], Float:damage, Float:range) 
{
    
    
    new Float:pOrigin[3]
    new Float:dist
    new Float:tmpdmg
    
    for(new i = 1; i < g_MaxPlayers; i++) {
        if(is_user_alive(i) && is_user_connected(i)) {
            pev(i,pev_origin,pOrigin)
            dist = get_distance_f(origin,pOrigin)
            
            if(dist <= range) {
                tmpdmg = damage-(damage/range)*dist
                fm_fakedamage(i, classname, tmpdmg, DMG_BLAST)
            }
        }
    }
}
Plugin BUG : When i connect to server and i join on T/CT team i explode, and also when i buy an flashbang
I hope you can fix this . thanks
SAMURAI16 is offline
Send a message via MSN to SAMURAI16
jim_yang
Veteran Member
Join Date: Aug 2006
Old 02-07-2007 , 01:53   Re: fix plugin need help
Reply With Quote #2

why you check !is_user_connected() to a flashbang
i=1; i<=g_maxplayers;i++
if is_user_alive(id) then the use must connected

if( !get_pcvar_num(pCvar) || !(equali(sample,"weapons/flashbang-1.wav") || equali(sample,"weapons/flashbang-2.wav")) )
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>

Last edited by jim_yang; 02-07-2007 at 09:48.
jim_yang is offline
SAMURAI16
BANNED
Join Date: Sep 2006
Old 02-07-2007 , 04:00   Re: fix plugin need help
Reply With Quote #3

with this updates plugin doesen't works . Flashbangs are normals
SAMURAI16 is offline
Send a message via MSN to SAMURAI16
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 02-07-2007 , 06:01   Re: fix plugin need help
Reply With Quote #4

post your new code.
[ --<-@ ] Black Rose is offline
SAMURAI16
BANNED
Join Date: Sep 2006
Old 02-07-2007 , 06:02   Re: fix plugin need help
Reply With Quote #5

->
Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <fakemeta_util>

new const PLUGIN[] = "Explosive Flashbangs"
new const VERSION[] = "0.1.0"
new const AUTHOR[] = "SAMURAI"

#define TE_EXPLOSION 3
new explode;
new g_MaxPlayers
new pCvar;

public plugin_init() 
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    pCvar = register_cvar("explosive_flashbangs","1");
    register_forward(FM_EmitSound,"fw_emitsound");
    g_MaxPlayers = get_maxplayers()
}

public plugin_precache()
{
    explode = precache_model("sprites/explode1.spr");
}

public fw_emitsound(entity,channel,const sample[],Float:volume,Float:attenuation,fFlags,pitch)
{
    if( !get_pcvar_num(pCvar) || !equali(sample,"weapons/flashbang-1.wav") || !equali(sample,"weapons/flashbang-2.wav") )
        return FMRES_IGNORED;
    flashbang_explode(entity);
    return FMRES_IGNORED;
}

public flashbang_explode(greindex)
{   
    new Float:origin[3];
    pev(greindex,pev_origin,origin);
    
    message_begin( MSG_BROADCAST,SVC_TEMPENTITY); 
    write_byte(TE_EXPLOSION);
    write_coord(floatround(origin[0])); 
    write_coord(floatround(origin[1]));   
    write_coord(floatround(origin[2]));
    
    write_short(explode); 
    
    write_byte(80);
    write_byte(10);
    write_byte(0);
    
    message_end();
    
    flashbang_damage(origin, "flashbang", 25.0, 5.0)
    
    return PLUGIN_CONTINUE;

}  


public flashbang_damage(Float:origin[3], const classname[], Float:damage, Float:range) 
{
    
    
    new Float:pOrigin[3]
    new Float:dist
    new Float:tmpdmg
    
    for(new i = 1; i <= g_MaxPlayers; i++) {
        if(is_user_alive(i) ) {
            pev(i,pev_origin,pOrigin)
            dist = get_distance_f(origin,pOrigin)
            
            if(dist <= range) {
                tmpdmg = damage-(damage/range)*dist
                fm_fakedamage(i, classname, tmpdmg, DMG_BLAST)
            }
        }
    }
}
SAMURAI16 is offline
Send a message via MSN to SAMURAI16
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 02-07-2007 , 06:50   Re: fix plugin need help
Reply With Quote #6

It works, though, 5 feet(?) aint a far range. ^^
Anyway, this is tested and works.
Code:
#include <amxmodx> #include <amxmisc> #include <fakemeta> #include <fakemeta_util> new const PLUGIN[] = "Explosive Flashbangs" new const VERSION[] = "0.1.0" new const AUTHOR[] = "SAMURAI" #define TE_EXPLOSION 3 new explode; new g_MaxPlayers new pCvar; new g_msgScreenFade public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     pCvar = register_cvar("explosive_flashbangs","1");     register_forward(FM_EmitSound,"fw_emitsound");     g_MaxPlayers = get_maxplayers()     register_event("ScreenFade", "event_ScreenFade", "b", "4=255", "5=255", "6=255")     g_msgScreenFade = get_user_msgid("ScreenFade") } public event_ScreenFade(id) {     if ( ! get_pcvar_num(pCvar) )         return PLUGIN_CONTINUE     message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, {0,0,0}, id)     write_short(read_data(1))     write_short(read_data(2))     write_short(read_data(3))     write_byte(0)     write_byte(0)     write_byte(0)     write_byte(0)     message_end() } public plugin_precache()     explode = precache_model("sprites/explode1.spr"); public fw_emitsound(entity,channel,const sample[],Float:volume,Float:attenuation,fFlags,pitch) {     if( get_pcvar_num(pCvar) && ( equali(sample,"weapons/flashbang-1.wav") || equali(sample,"weapons/flashbang-2.wav") ) )         flashbang_explode(entity);     return FMRES_IGNORED; } public flashbang_explode(greindex) {     new Float:origin[3];     pev(greindex,pev_origin,origin);         message_begin( MSG_BROADCAST,SVC_TEMPENTITY);     write_byte(TE_EXPLOSION);     write_coord(floatround(origin[0]));     write_coord(floatround(origin[1]));       write_coord(floatround(origin[2]));         write_short(explode);         write_byte(80);     write_byte(10);     write_byte(0);         message_end();         flashbang_damage(origin, "flashbang", 50.0, 300.0) }   public flashbang_damage(Float:origin[3], const classname[], Float:damage, Float:range) {     new Float:pOrigin[3]     new Float:dist     new Float:tmpdmg         for ( new i = 1 ; i < g_MaxPlayers ; i++) {         if ( is_user_alive(i) ) {             pev(i,pev_origin,pOrigin)             dist = get_distance_f(origin,pOrigin)                         if ( dist <= range ) {                 tmpdmg = damage - ( damage / range ) * dist                 fm_fakedamage(i, classname, tmpdmg, DMG_BLAST)             }         }     } }

Last edited by [ --<-@ ] Black Rose; 02-07-2007 at 16:46.
[ --<-@ ] Black Rose is offline
SAMURAI16
BANNED
Join Date: Sep 2006
Old 02-07-2007 , 10:15   Re: fix plugin need help
Reply With Quote #7

here i got some errors on compiling . Also, this :
Code:
public event_ScreenFade(id) {

    if ( ! get_pcvar_num(pCvar) )
        return PLUGIN_CONTINUE

    message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, {0,0,0}, id)
    write_short(read_data(1))
    write_short(read_data(2))
    write_short(read_data(3))
    write_byte(0)
    write_byte(0)
    write_byte(0)
    write_byte(0)
    message_end()
}

With this :
Code:
public event_ScreenFade(id) {

    if ( ! get_pcvar_num(pCvar) )
        return PLUGIN_CONTINUE

    message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, {0,0,0}, id)
    write_short(read_data(1))
    write_short(read_data(2))
    write_short(read_data(3))
    write_byte(255)
    write_byte(255)
    write_byte(255)
    write_byte(read_data(7))
    message_end()
}

Anyway, works perfect now
THANKS

SAMURAI16 is offline
Send a message via MSN to SAMURAI16
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 02-07-2007 , 16:45   Re: fix plugin need help
Reply With Quote #8

Quote:
Originally Posted by SAMURAI16 View Post
here i got some errors on compiling . Also, this :
Code:
public event_ScreenFade(id) {

    if ( ! get_pcvar_num(pCvar) )
        return PLUGIN_CONTINUE

    message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, {0,0,0}, id)
    write_short(read_data(1))
    write_short(read_data(2))
    write_short(read_data(3))
    write_byte(0)
    write_byte(0)
    write_byte(0)
    write_byte(0)
    message_end()
}

With this :
Code:
public event_ScreenFade(id) {

    if ( ! get_pcvar_num(pCvar) )
        return PLUGIN_CONTINUE

    message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, {0,0,0}, id)
    write_short(read_data(1))
    write_short(read_data(2))
    write_short(read_data(3))
    write_byte(255)
    write_byte(255)
    write_byte(255)
    write_byte(read_data(7))
    message_end()
}

Anyway, works perfect now
THANKS

Um do you mean you replaced that screenfade stuff?
[ --<-@ ] Black Rose 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 00:42.


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