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

Smoke grenade questions


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Black Haze
BANNED
Join Date: Sep 2008
Location: Hamsterdam
Old 03-20-2011 , 14:33   Smoke grenade questions
Reply With Quote #1

Been searching for this all over the place, and think I even remember seeing it somewhere a few months ago, yet I can't find it.

For some sort of kill streak system I'm trying to have the players earn kill streaks, and toss a smoke grenade at a spot, where the kill streak reward (eg a mortar strike or the likes, or Peace Maker's Ion Cannon ) shall be executed.

Basically what I'm after is:
- Is there an event for when the smoke grenade ignites?
Edit: Thank you databomb!
PHP Code:
HookEvent("smokegrenade_detonate",smokegrenade_detonate); 
PHP Code:
public smokegrenade_detonate(Handle:event,const String:name[],bool:dontBroadcast)
{

- Can I get which client has thrown the smoke from that, and the location of the smoke?
Edit: Thanks again databomb!
PHP Code:
new Float:Origin[3];
Origin[0] = GetEventFloat(event,"x");
Origin[1] = GetEventFloat(event,"y");
Origin[2] = GetEventFloat(event,"z"); 
PHP Code:
new client GetClientOfUserId(GetEventInt(event"userid")); 


And as a bonus question :
- Is there any way to change the smoke so that it aint a big ball of smoke like it usually is, but rather a small green (or whatever color) marker like smoke column?

Hope anyone can help me, am happy with the smallest hints! ;)

Last edited by Black Haze; 03-20-2011 at 15:40.
Black Haze is offline
databomb
Veteran Member
Join Date: Jun 2009
Location: california
Old 03-20-2011 , 15:31   Re: Smoke grenade questions
Reply With Quote #2

There's an event called smokegrenade_detonate which has position and the client userid information in it.

bonus question.. yes, you could prevent the normal smoke from detonating and make a substitute effect. There are many plugins already doing this, search for smoke or poison cloud in the plugins database. Try OnEntityCreated and look for env_particlesmokegrenade and kill em off before they do anything.
__________________
databomb is offline
Black Haze
BANNED
Join Date: Sep 2008
Location: Hamsterdam
Old 03-20-2011 , 15:37   Re: Smoke grenade questions
Reply With Quote #3

Thanks gonna give that a go!
Black Haze is offline
Black Haze
BANNED
Join Date: Sep 2008
Location: Hamsterdam
Old 03-21-2011 , 13:01   Re: Smoke grenade questions
Reply With Quote #4

Got another question:

Looked around a bit on smokegrenade_detonate and landed here:
http://wiki.alliedmods.net/Counter-S...enade_detonate

Problem is, it gives me a client who fired it (usefull), a position (also very usefull), but it doesn't seem to send much else.
Is there a way to see what entity the smoke grenade is and kill it, so it can't start smoking?

I really don't want to kill all smoke entities, I'd rather kill the nade before anything happens. Removing all smoke indiscriminately may have unwanted side effects.

Last edited by Black Haze; 03-21-2011 at 13:08.
Black Haze is offline
blodia
Veteran Member
Join Date: Sep 2009
Location: UK
Old 03-23-2011 , 07:34   Re: Smoke grenade questions
Reply With Quote #5

use sdkhooks to create a spawn hook and start touch hook on "smokegrenade_projectile" of the client you want. when it spawns set "m_nNextThinkTick" to -1 to disable the timer then when it starts touching something grab is origin then delete the entity.
blodia is offline
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 03-24-2011 , 06:06   Re: Smoke grenade questions
Reply With Quote #6

Or check the velocity to be 0.0 instead of a StartTouch hook to be sure, that the smokenade isn't just bouncing off a wall, but is laying on the floor. You've got the client in m_hThrower iirc.
__________________
Peace-Maker is offline
Black Haze
BANNED
Join Date: Sep 2008
Location: Hamsterdam
Old 03-24-2011 , 08:37   Re: Smoke grenade questions
Reply With Quote #7

Quote:
Originally Posted by Peace-Maker View Post
Or check the velocity to be 0.0 instead of a StartTouch hook to be sure, that the smokenade isn't just bouncing off a wall, but is laying on the floor. You've got the client in m_hThrower iirc.
That's a bit over my head. Could you show me a piece of code showing how to achieve this? Sounds like exactly what I need!
Black Haze is offline
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 03-24-2011 , 09:50   Re: Smoke grenade questions
Reply With Quote #8

Haven't tested this though. Could be, that the client is in m_hOwnerEntity instead of m_hThrower. I'm sure blodia knows, if there is something wrong;)

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

public OnEntityCreated(entity, const String:classname[])
{
    if(
StrEqual(classname"smokegrenade_projectile"false))
    {
        
SetEntProp(entityProp_Send"m_nNextThinkTick", -1);
        
SDKHook(entitySDKHook_ThinkPostHook_OnThinkPost);
    }
}

public 
Hook_OnThinkPost(entity)
{
    new 
Float:fVelocity[3];
    
GetEntPropVector(entityProp_Send"m_vecVelocity"fVelocity);
    if(
fVelocity[0] == 0.0 && fVelocity[1] == 0.0 && fVelocity[2] == 0.0)
    {
        new 
client GetEntPropEnt(entityProp_Send"m_hThrower");
        
        new 
Float:fOrigin[3];
        
GetEntPropVector(entityProp_Send"m_vecOrigin"fOrigin);
        
        
AcceptEntityInput(entity"Kill");
        
        
// Blast ioncannon at fOrigin!
    
}

__________________
Peace-Maker is offline
Black Haze
BANNED
Join Date: Sep 2008
Location: Hamsterdam
Old 03-24-2011 , 18:49   Re: Smoke grenade questions
Reply With Quote #9

Thanks that'll help a bunch!
I'm nearly done with the script now, found a way with which I hopefully can make exactly the smokestack I want (kinda like this), gonna merge it with my kill messages plugin, after which I should be done with a fairly good killstreak system for CSS!
I'll post it in the new plugins when it's done.

Thanks for everyone's help!
Black Haze 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 01:06.


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