AlliedModders

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

ironskillz1 11-05-2013 12:56

Terroist Bomb
 
Trying to make an explosion but i cant get the origin part to work


PHP Code:

public Explode(id)
{
    if(!
is_user_connected(id) || !is_user_alive(id)) {
        return 
PLUGIN_CONTINUE;
    }
    
emit_sound(id,CHAN_STREAM,"weapons/c4_explode1.wav",1.0,ATTN_NORM,0,PITCH_NORM)
    
Player[id][plBomb] = 0
    
    
static Explosion_Origin[3]
    
get_user_origin(id,Explosion_Origin,0)
    
Explode1(Explosion_Origin)
    
Explode10(Explosion_Origin)
    
    static 
Player_AmmountExplosive_DistancePlayerOthr_Orig[3]
    static 
Explosion_Frags
    Player_Ammount 
get_playersnum()
    
get_user_origin(Player_Ammount,PlayerOthr_Orig,0)
    
Explosive_Distance get_distance(Explosion_OriginPlayerOthr_Orig)
    
    new 
strName[32]
    
get_user_name(idstrName31)
    
    
Explosion_Frags 0
    ColorChat
0GREY"%i Cts in the area"Player_Ammount);
    if ( 
cs_get_user_team Player_Ammount ) == CS_TEAM_CT && Explosive_Distance <= 550)
    {
        new 
strName[32]
        
get_user_name(idstrName31)
        
Explosion_Frags++
        
set_user_frags(id, (get_user_frags(id) + Explosion_Frags))
        
Player[id][plCash] += (Explosion_Frags 2000)
        
ColorChat(0GREY"Suicide Bombing Mission Was a Success.^4 %s^3 Killed^4 %i^3 Enemies and Have Been Awarded^4 $%i"strNameExplosion_Frags, (Explosion_Frags 50))
        
user_silentkill(Player_Ammount);
    }
    else if(
Explosion_Frags == 0)
    {
        
ColorChat0GREY"No Enemies Killed.^4 %s^3 Suicide Bombing Misson Was a Partial Failure.^4 %s^3 Are Awarded^4 $1000"strNamestrName)
        
Player[id][plCash] += 1000
    
}
    
strip_user_weapons(id)
    
user_silentkill(id);
    
Explosion_Frags 0
    
    
return PLUGIN_CONTINUE;



Backstabnoob 11-05-2013 13:31

Re: Terroist Bomb
 
First off, you'd have to loop instead of using get_playersnum( ) as the player index. That will not even work, surprised it's not giving you an invalid player error.

Use find_end_in_sphere instead, it's more efficient than looping through the players and checking their origin one by one.

ironskillz1 11-05-2013 13:56

Re: Terroist Bomb
 
Will this work?

PHP Code:

public Explode(id)
{
    if(!
is_user_connected(id) || !is_user_alive(id)) {
        return 
PLUGIN_CONTINUE;
    }
    
    
emit_sound(id,CHAN_STREAM,"weapons/c4_explode1.wav",1.0,ATTN_NORM,0,PITCH_NORM)
    
Player[id][plBomb] = 0
    
    
static Explosion_Frags 0
    
    
new Float:origin], strName[32]
    
pevidpev_originorigin );
    
get_user_nameidstrName31 )
    new 
ent = -1
    
while((ent find_ent_in_sphere(ent,origin,550.0)) != 0
    {
        
Explosion_Frags++
        
user_silentkill(ent)
    }  
    if(
Explosion_Frags == 1)
    {
        
ColorChat0GREY"No Enemies Killed.^4 %s^3 Suicide Bombing Misson Was a Partial Failure.^4 %s^3 Are Awarded^4 $1000"strNamestrName)
        
Player[id][plCash] += 1000
    
}
    else if(
Explosion_Frags >= 2)
    {
        
set_user_frags(id, (get_user_frags(id) + Explosion_Frags))
        
Player[id][plCash] += (Explosion_Frags 2000)
        
ColorChat(0GREY"Suicide Bombing Mission Was a Success.^4 %s^3 Killed^4 %i^3 Enemies and Have Been Awarded^4 $%i"strNameExplosion_Frags, (Explosion_Frags 50))
    }
    
    return 
PLUGIN_CONTINUE;




All times are GMT -4. The time now is 23:21.

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