Raised This Month: $51 Target: $400
 12% 

Terroist Bomb


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ironskillz1
AlliedModders Donor
Join Date: Jul 2012
Location: Sweden
Old 11-05-2013 , 12:56   Terroist Bomb
Reply With Quote #1

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;

__________________
I have many private and unique plugins for Jailbreak and Hide'N'Seek. PM me for more info.

Pm me.

Check out my roulette site.

Last edited by ironskillz1; 11-05-2013 at 12:56.
ironskillz1 is offline
Send a message via Skype™ to ironskillz1
Backstabnoob
Veteran Member
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 11-05-2013 , 13:31   Re: Terroist Bomb
Reply With Quote #2

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.
__________________
Currently busy working on a very large scale anime database project.
Backstabnoob is offline
ironskillz1
AlliedModders Donor
Join Date: Jul 2012
Location: Sweden
Old 11-05-2013 , 13:56   Re: Terroist Bomb
Reply With Quote #3

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;

__________________
I have many private and unique plugins for Jailbreak and Hide'N'Seek. PM me for more info.

Pm me.

Check out my roulette site.
ironskillz1 is offline
Send a message via Skype™ to ironskillz1
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 01:42.


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