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

C4 Explosion on command?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CowGod
Senior Member
Join Date: Feb 2015
Old 05-04-2016 , 16:54   C4 Explosion on command?
Reply With Quote #1

so right now I made it so when a player types test in chat it does a mini explosion and kills them, but what if I wanted it to be the c4 explosion xD any help would be appreciated thanks
CowGod is offline
Send a message via Skype™ to CowGod
Farbror Godis
AlliedModders Donor
Join Date: Feb 2016
Old 05-04-2016 , 17:01   Re: C4 Explosion on command?
Reply With Quote #2

Are you using "env_explosion"? If so, you could set it's magnitude to a very large number:
PHP Code:
float position[3];
GetClientAbsOrigin(clientposition);

int explosion;
if((
explosion CreateEntityByName("env_explosion")) != -1) {
    
DispatchKeyValue(explosion"classname""env_explosion");
    
DispatchKeyValue(explosion"iMagnitude""16000");

    
DispatchKeyValueVector(explosion"Origin"position);

    if(
DispatchSpawn(explosion)) {
        
ActivateEntity(explosion);

        
AcceptEntityInput(explosion"Explode");
        
AcceptEntityInput(explosion"Kill");
    }

This would have the (un)fortunate effect of killing everyone around the player as well, perhaps you should go with what xines proposed.

Last edited by Farbror Godis; 05-04-2016 at 17:19.
Farbror Godis is offline
xines
Veteran Member
Join Date: Aug 2013
Location: Denmark
Old 05-04-2016 , 17:05   Re: C4 Explosion on command?
Reply With Quote #3

Don't think Cod supports this

Joke aside, as this is the scripting section, and no script was posted i consider this to be wrong section.

For your problem, you properly want to use the c4 explosion particle effect and make it spawn at client position when typing your command and slay them.
__________________
xines is offline
CowGod
Senior Member
Join Date: Feb 2015
Old 05-04-2016 , 17:48   Re: C4 Explosion on command?
Reply With Quote #4

Quote:
Originally Posted by xines View Post
Don't think Cod supports this

Joke aside, as this is the scripting section, and no script was posted i consider this to be wrong section.

For your problem, you properly want to use the c4 explosion particle effect and make it spawn at client position when typing your command and slay them.
Sorry if this is wrong section, how would I go about using the c4 explosion particle effect? I would be grateful to learn
CowGod is offline
Send a message via Skype™ to CowGod
xines
Veteran Member
Join Date: Aug 2013
Location: Denmark
Old 05-04-2016 , 18:13   Re: C4 Explosion on command?
Reply With Quote #5

Quote:
Originally Posted by CowGod View Post
Sorry if this is wrong section, how would I go about using the c4 explosion particle effect? I would be grateful to learn
First i would like to know what game is this for ?
__________________
xines is offline
CowGod
Senior Member
Join Date: Feb 2015
Old 05-04-2016 , 18:21   Re: C4 Explosion on command?
Reply With Quote #6

Quote:
Originally Posted by xines View Post
First i would like to know what game is this for ?
CSGO
CowGod is offline
Send a message via Skype™ to CowGod
xines
Veteran Member
Join Date: Aug 2013
Location: Denmark
Old 05-04-2016 , 18:34   Re: C4 Explosion on command?
Reply With Quote #7

Quote:
Originally Posted by CowGod View Post
CSGO
Contact me on steam, and i'll give it a go.

Script will be posted for others to use, because sharing is caring.
__________________
xines is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 05-04-2016 , 19:28   Re: C4 Explosion on command?
Reply With Quote #8

My lame COD joke is infecting the community...
__________________
Neuro Toxin is offline
xines
Veteran Member
Join Date: Aug 2013
Location: Denmark
Old 05-04-2016 , 21:39   Re: C4 Explosion on command?
Reply With Quote #9

Here is the finish product:

Working CS:GO:

Just change the text "cringe" in the source code to whatever needed.

PHP Code:
#include <sourcemod>
#include <sdktools>

int g_MyBomb[MAXPLAYERS+1];

public 
Plugin myinfo 
{
    
name "Xines",
    
author "Bomb Explosion Death Particle",
    
description "Performs a bomb explosion by typing a ingame specific word",
    
version "1.0",
    
url ""
};

public 
void OnClientSayCommand_Post(int client, const char[] command, const char[] sArgs)
{
    if (
strcmp(sArgs"cringe"false) == 0)
    {
        if (
client && IsClientInGame(client) && IsPlayerAlive(client))
        {
            
float clientPos[3];
            
GetClientAbsOrigin(clientclientPos);
            
DropExplosion(clientclientPos);
            
EmitAmbientSound("weapons/c4/c4_explode1.wav"NULL_VECTORclient);
            
ForcePlayerSuicide(client);
        }
    }
}

public 
void DropExplosion(int clientfloat pos[3])
{
    
g_MyBomb[client] = CreateEntityByName("info_particle_system");
    
DispatchKeyValue(g_MyBomb[client], "start_active""0");
    
DispatchKeyValue(g_MyBomb[client], "effect_name""explosion_c4_500");
    
DispatchSpawn(g_MyBomb[client]);
    
TeleportEntity(g_MyBomb[client], posNULL_VECTORNULL_VECTOR);
    
ActivateEntity(g_MyBomb[client]);
    
SetVariantString("!activator");
    
AcceptEntityInput(g_MyBomb[client], "SetParent"g_MyBomb[client], g_MyBomb[client], 0);
    
CreateTimer(0.25Timer_Rung_MyBomb[client]);
}

public 
Action Timer_Run(Handle timerany ent)
{
    if(
ent && IsValidEntity(ent))
    {
        
AcceptEntityInput(ent"Start"); //Start Particle
        
CreateTimer(7.0Timer_Dieent); //Timer to end particle
    
}
}

public 
Action Timer_Die(Handle timerany ent)
{
    if(
ent && IsValidEntity(ent))
    {
        if(
IsValidEdict(ent))
        {
            
AcceptEntityInput(ent"Kill");
        }
    }

__________________
xines 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 02:00.


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