AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Explosion Help (https://forums.alliedmods.net/showthread.php?t=83532)

Doc-Holiday 01-11-2009 07:48

Explosion Help
 
How would i go about writing a function that will cause an explosion around x radious killing the index and those around.

This is all i have found so far

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <hamsandwich>

public plugin_init() {
 
register_plugin("Suicide Bomber""1.0""Shadow Warrior")
 
 
//register_logevent("random_player", 2, "1=Round_Start")
 
 
RegisterHam(Ham_Spawn"player""random_player"1)
}
public 
random_player(id)
{
 new 
players[32], totalplayersrandplayerpass;
 
get_players(playerstotalplayers)
 if (!
randplayer)
 
randplayer random_num(1totalplayers)
 if(!
is_user_connected(randplayer) || !is_user_alive(randplayer))
 {
  
set_task(0.1"random_player")
  return 
PLUGIN_HANDLED
 
}
 if(
pass == 1)
 return 
PLUGIN_HANDLED
 pass 
1
 suicide_bomb
(id);
 
 return 
PLUGIN_HANDLED
}  
public 
suicide_bomb(id){
 
 
//BOOM CODE lol
 



X0Left4dead0X 01-11-2009 09:02

Re: Explosion Help
 
Quote:

How would i go about writing a function that will cause an explosion around x radious killing the index and those around.

This is all i have found so far
What?

SnoW 01-11-2009 11:50

Re: Explosion Help
 
Quote:

Originally Posted by X0Left4dead0X (Post 742119)
What?

Well that was a smart post? He wants a function that will cause an explosion where the player is and kill the player and people around him. Ofc the function should get player id when it's called.

X0Left4dead0X 01-11-2009 14:26

Re: Explosion Help
 
PHP Code:

public BlowUp(id)
{
    new 
Float:dRatiodamagedistanceBetween
    
new damradius get_cvar_num("kam_radius")
    new 
maxdamage get_cvar_num("kam_maxdamage")
    
IsKam[id] = 0

    
new name[32]
    
get_user_name(id,name,31)
    
shUnglow(id)
    
set_hudmessage(01002000.050.6520.021.00.010.185)
    
show_hudmessage(0,"%s Has Blew you up",name)
    new 
FFOn get_cvar_num("mp_friendlyfire")
    new 
origin[3], origin1[3]
    
get_user_origin(id,origin)

    
explode(origin// blowup even if dead

    
for(new 1<= SH_MAXSLOTSa++) {
        if( 
is_user_alive(a) && ( get_user_team(id) != get_user_team(a) || FFOn || == id ) ) {

            
get_user_origin(a,origin1)

            
distanceBetween get_distance(originorigin1 )
            if( 
distanceBetween damradius ) {
                if ( 
== id ) {
                    
damage maxdamage 4
                
}
                else {
                    
dRatio float(distanceBetween) / float(damradius)
                    
damage maxdamage floatroundmaxdamage dRatio)
                }
                
shExtraDamage(aiddamage"Kamamakarzi")
            } 
// distance
        
// alive
    
// loop


PHP Code:

public explodevec1[3] )
{
    
// blast circles
    
message_beginMSG_BROADCAST,SVC_TEMPENTITY,vec1)
    
write_byte21 )
    
write_coord(vec1[0])
    
write_coord(vec1[1])
    
write_coord(vec1[2] + 16)
    
write_coord(vec1[0])
    
write_coord(vec1[1])
    
write_coord(vec1[2] + 1936)
    
write_shortwhite )
    
write_byte// startframe
    
write_byte// framerate
    
write_byte// life 2
    
write_byte20 // width 16
    
write_byte// noise
    
write_byte188 // r
    
write_byte220 // g
    
write_byte255 // b
    
write_byte255 //brightness
    
write_byte// speed
    
message_end()

    
//Explosion2
    
message_beginMSG_BROADCAST,SVC_TEMPENTITY)
    
write_byte12 )
    
write_coord(vec1[0])
    
write_coord(vec1[1])
    
write_coord(vec1[2])
    
write_byte188 // byte (scale in 0.1's) 188
    
write_byte10 // byte (framerate)
    
message_end()

    
//TE_Explosion
    
message_beginMSG_BROADCAST,SVC_TEMPENTITY,vec1)
    
write_byte)
    
write_coord(vec1[0])
    
write_coord(vec1[1])
    
write_coord(vec1[2])
    
write_shortfire )
    
write_byte60 // byte (scale in 0.1's) 188
    
write_byte10 // byte (framerate)
    
write_byte// byte flags
    
message_end()

    
//Smoke
    
message_beginMSG_BROADCAST,SVC_TEMPENTITY,vec1)
    
write_byte// 5
    
write_coord(vec1[0])
    
write_coord(vec1[1])
    
write_coord(vec1[2])
    
write_shortsmoke )
    
write_byte10 )  // 2
    
write_byte10 )  // 10
    
message_end()



PHP Code:

new smokewhitefire
new Iskam[33

PHP Code:

 smoke precache_model("sprites/smoke.spr")
    
white precache_model("sprites/zerogxplode.spr")
    
fire precache_model("sprites/cexplo.spr"


Doc-Holiday 01-11-2009 17:20

Re: Explosion Help
 
ok so if i wanted him to have 250 life 250 armor could i use the random player to do the following

PHP Code:

 health register_cvar("amx_bomber_health""250")
 
armor register_cvar("amx_bomber_armor""250"

PHP Code:

 
public suicide_bomber(id)
{
 if(
is_user_alive(id)
 {
  
cs_set_user_model(id"vip")
  
set_user_health(idget_pcvar_num(health))
  
set_user_armor(idget_pcvar_num(armor))
  
BlowUp(id);
  return 
PLUGIN_CONTINUE
 
}



X0Left4dead0X 01-11-2009 18:09

Re: Explosion Help
 
PHP Code:

public suicide_bomber(id)
{
 if(
is_user_alive(id)
 {
  
cs_set_user_model(id"vip")
  
set_user_health(idhealth)
  
set_user_armor(idarmor)
  
BlowUp(id);
  return 
PLUGIN_CONTINUE
 
}



Doc-Holiday 01-11-2009 18:29

Re: Explosion Help
 
Im not a good coder but what is this?

shExtraDamage(a, id, damage, "Kamamakarzi")

IneedHelp 01-11-2009 18:55

Re: Explosion Help
 
Quote:

Originally Posted by NcB_Sav (Post 742458)
Im not a good coder but what is this?

shExtraDamage(a, id, damage, "Kamamakarzi")

Lol that's from SuperHero Mod :\

Bad_Bud 01-12-2009 05:30

Re: Explosion Help
 
The cs_jetpack plugin has a fairly in-depth explosion to it that I can help explain to you if you need help. It deals damage based on a radius (the equation is probably not completely correct, but it works for me :P), checks for friendly fire, kills the person in the middle every time, adds points to the person that caused the explosion, etc.

http://forums.alliedmods.net/attachm...8&d=1231736014

X0Left4dead0X 01-12-2009 11:41

Re: Explosion Help
 
Quote:

Originally Posted by Bad_Bud (Post 742659)
The cs_jetpack plugin has a fairly in-depth explosion to it that I can help explain to you if you need help. It deals damage based on a radius (the equation is probably not completely correct, but it works for me :P), checks for friendly fire, kills the person in the middle every time, adds points to the person that caused the explosion, etc.

http://forums.alliedmods.net/attachm...8&d=1231736014

I guess he could use that for the explosion. My code is for Counter-strike Leeroy Jenkins Completly Different Amxx and superhero


All times are GMT -4. The time now is 01:43.

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