Raised This Month: $ Target: $400
 0% 

Proper explosion dammage


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Aykay
Senior Member
Join Date: Jul 2009
Location: Australia
Old 07-22-2011 , 04:03   Re: Proper explosion dammage
#2

This is a fake bomb code, maybe you can see how it's done?

PHP Code:
#include <hamsandwich>
#include <engine>
#include <cstrike>


public PlantFakeC4(id)
{
    if (!
has_fakec4_player[id])
    {
        
client_print(idprint_center"You only get 1 Fake Bomb!");
        return 
PLUGIN_CONTINUE;
    }
    
has_fakec4_player[id]--;
    
    new 
Float:origin[3];
    
entity_get_vector(idEV_VEC_originorigin);
        
    new 
ent create_entity("info_target");
    
entity_set_string(ent ,EV_SZ_classname"FakeC4");
    
entity_set_edict(ent ,EV_ENT_ownerid);
    
entity_set_int(entEV_INT_movetypeMOVETYPE_TOSS);
    
entity_set_origin(entorigin);
    
entity_set_int(entEV_INT_solidSOLID_BBOX);
    
entity_set_model(ent"models/w_backpack.mdl");
    
entity_set_size(ent,Float:{-16.0,-16.0,0.0},Float:{16.0,16.0,2.0});
    
    
drop_to_floor(ent);

    
entity_set_float(ent,EV_FL_nextthink,halflife_time() + 0.01) ;
    
    
set_rendering(ent,kRenderFxNone0,0,0kRenderTransTexture,255);
    
    return 
PLUGIN_CONTINUE;
}

public 
ExplodeFakeC4(entid)
{
    new 
attacker entity_get_edict(entEV_ENT_owner);
    if (
get_user_team(attacker) != get_user_team(id)) // this is the line you're looking for - it wont hurt himself or teammates.
    
{
        new 
Float:fOrigin[3], iOrigin[3];
        
entity_get_vectorentEV_VEC_originfOrigin);
        
iOrigin[0] = floatround(fOrigin[0]);
        
iOrigin[1] = floatround(fOrigin[1]);
        
iOrigin[2] = floatround(fOrigin[2]);
        
        
message_begin(MSG_BROADCAST,SVC_TEMPENTITYiOrigin);
        
write_byte(TE_EXPLOSION);
        
write_coord(iOrigin[0]);
        
write_coord(iOrigin[1]);
        
write_coord(iOrigin[2]);
        
write_short(sprite_blast);
        
write_byte(32); // scale
        
write_byte(20); // framerate
        
write_byte(0);// flags
        
message_end();
        new 
entlist[33];
        new 
numfound find_sphere_class(ent,"player"400.0 ,entlist32);
        
        for (new 
i=0numfoundi++)
        {        
            new 
pid entlist[i];
            
            if (!
is_user_alive(pid) || get_user_team(attacker) == get_user_team(pid))
                continue;
            
            
ExecuteHam(Ham_TakeDamagepidentattacker350.01);
        }
        
remove_entity(ent);
    }

__________________

Aykay is offline
Send a message via MSN to Aykay
 



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 01:11.


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