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

[REQ] Acid Jarate


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Wrath
Junior Member
Join Date: Jun 2009
Old 06-11-2009 , 19:16   [REQ] Acid Jarate
Reply With Quote #1

I need a TF2 plugin

Jarate that damage's and has a afterburn equivilant to the Pyro's flaregun

Thanks
Wrath is offline
retsam
Veteran Member
Join Date: Aug 2008
Location: so-cal
Old 06-11-2009 , 19:31   Re: [REQ] Acid Jarate
Reply With Quote #2

I dont have the code for it, but I dont think it would be that difficult to do.

Youd just need to check if the client threw a jarate, hook player_hurt and for the victim have it do TF_IgnitePlayer or whatever it is for a specified duration.

Youre going to have yellow piss turning into red fire on people and since they are also pissed on, they will be taking extra dmg from the fire but hey.
retsam is offline
pheadxdll
AlliedModders Donor
Join Date: Jun 2008
Old 06-11-2009 , 19:34   Re: [REQ] Acid Jarate
Reply With Quote #3

Really easy to do. Just have a timer running that checks the player condition of all the players. Someone with more time should be able to code this for you.
__________________
pheadxdll is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 06-11-2009 , 20:22   Re: [REQ] Acid Jarate
Reply With Quote #4

PHP Code:
#pragma semicolon 1

#include <sourcemod>

new Handle:g_hTimerHandle[MAXPLAYERS+1];
new 
Handle:g_hCvarTime;
new 
Handle:g_hCvarDamage;

public 
Plugin:myinfo =
{
    
name "Acid Jarate",
    
author "bl4nk",
    
description "Players take damage while Jarated",
    
version "1.0.0",
    
url "http://forums.alliedmods.net"
};

public 
OnPluginStart()
{
    
g_hCvarTime CreateConVar("sm_acidjarate_time""3.0""Time inbetween each damage tick"FCVAR_PLUGINtrue0.1false_);
    
g_hCvarDamage CreateConVar("sm_acidjarate_damage""5""Damage to do per tick"FCVAR_PLUGINtrue1.0false_);

    
HookEvent("player_jarated"Event_PlayerJarated);
    
HookEvent("player_jarated_fade"Event_PlayerJaratedFade);
    
HookEvent("player_death"Event_PlayerDeath);
    
HookEvent("teamplay_round_start"Event_RoundStart);
}

public 
OnClientDisconnect(client)
{
    if (
g_hTimerHandle[client] != INVALID_HANDLE)
    {
        
KillTimer(g_hTimerHandle[client]);
        
g_hTimerHandle[client] = INVALID_HANDLE;
    }
}

public 
OnMapStart()
{
    for (new 
0<= MaxClientsi++)
    {
        
g_hTimerHandle[i] = INVALID_HANDLE;
    }
}

public 
Event_PlayerJarated(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetEventInt(event"victim_index");
    
g_hTimerHandle[client] = CreateTimer(GetConVarFloat(g_hCvarTime), Timer_DamagePlayerclientTIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
}

public 
Event_PlayerJaratedFade(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetEventInt(event"victim_index");

    
KillTimer(g_hTimerHandle[client]);
    
g_hTimerHandle[client] = INVALID_HANDLE;
}

public 
Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));

    if (
g_hTimerHandle[client] != INVALID_HANDLE)
    {
        
KillTimer(g_hTimerHandle[client]);
        
g_hTimerHandle[client] = INVALID_HANDLE;
    }
}

public 
Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
    for (new 
0<= MaxClientsi++)
    {
        if (
g_hTimerHandle[i] != INVALID_HANDLE)
        {
            
KillTimer(g_hTimerHandle[i]);
            
g_hTimerHandle[i] = INVALID_HANDLE;
        }
    }
}

public 
Action:Timer_DamagePlayer(Handle:timerany:client)
{
    new 
damage GetConVarInt(g_hCvarDamage);
    
SetEntProp(
        
client,
        
Prop_Send,
        
"m_iHealth",
        
GetEntProp(clientProp_Send"m_iHealth") - damage
    
);

sm_acidjarate_time 3.0 - Time inbetween each damage tick
sm_acidjarate_damage 5 - Damage to do per tick

Last edited by bl4nk; 06-11-2009 at 20:26.
bl4nk is offline
retsam
Veteran Member
Join Date: Aug 2008
Location: so-cal
Old 06-11-2009 , 21:19   Re: [REQ] Acid Jarate
Reply With Quote #5

Ahhh bl4nk is so nice. ;p I hope he says thank you.
retsam is offline
Wrath
Junior Member
Join Date: Jun 2009
Old 06-11-2009 , 21:27   Re: [REQ] Acid Jarate
Reply With Quote #6

Many thanks
Wrath is offline
Wrath
Junior Member
Join Date: Jun 2009
Old 06-12-2009 , 01:03   Re: [REQ] Acid Jarate
Reply With Quote #7

I tested it out, it doesnt seem to function, no errors in the log, but no dmg with jarate

Last edited by Wrath; 06-12-2009 at 01:09.
Wrath is offline
Wrath
Junior Member
Join Date: Jun 2009
Old 06-12-2009 , 18:24   Re: [REQ] Acid Jarate
Reply With Quote #8

Any clues as to went wrong. Please help
Wrath is offline
Theme97
Senior Member
Join Date: Mar 2009
Old 06-13-2009 , 23:17   Re: [REQ] Acid Jarate
Reply With Quote #9

The Jarate events never actually fire, but they exist.

Anyway, here's my solution. Enjoy it while I brace for attacks on bad coding style.

PHP Code:
#pragma semicolon 1

#include <sourcemod>
#include <sdktools>

#define PL_VERSION "1.0"

public Plugin:myinfo = {
    
name        "Acid Jarate",
    
author      "Theme97",
    
description "Players take damage while Jarated",
    
version     "1.0.0",
    
url         "http://forums.alliedmods.net/"
}

new 
Handle:cvar_time;
new 
Handle:cvar_damage;

public 
OnPluginStart() {
    
cvar_time CreateConVar("sm_acidjarate_time""3.0""Time inbetween each damage tick"FCVAR_PLUGINtrue0.1false_);
    
cvar_damage CreateConVar("sm_acidjarate_damage""5""Damage to do per tick"FCVAR_PLUGINtrue1.0false_);
}

public 
OnMapStart() {
    
CreateTimer(GetConVarFloat(cvar_time), timer_damageplayer);
}

public 
Action:timer_damageplayer(Handle:timer) {
    new 
damage GetConVarInt(cvar_damage), health;
    for (new 
1<= MaxClientsi++) {
        if (
IsClientInGame(i) && GetEntData(iFindSendPropInfo("CTFPlayer""m_nPlayerCond")) & (<< 19)) {
            
health GetEntProp(iProp_Send"m_iHealth") - damage;
            if (
health 1health 1;
            
SetEntProp(iProp_Send"m_iHealth"health);
        }
    }
    
CreateTimer(GetConVarFloat(cvar_time), timer_damageplayer);

There's no easy way to check who threw the Jarate, so we can't make the player die by it with the right death message, but if you still want them to die, just change timer_damageplayer:

PHP Code:
public Action:timer_damageplayer(Handle:timer) {
    new 
damage GetConVarInt(cvar_damage), health;
    for (new 
1<= MaxClientsi++) {
        if (
IsClientInGame(i) && GetEntData(iFindSendPropInfo("CTFPlayer""m_nPlayerCond")) & (<< 19)) {
            
health GetEntProp(iProp_Send"m_iHealth") - damage;
            if (
health 1) {
                
ForcePlayerSuicide(i);
            } else {
                
SetEntProp(iProp_Send"m_iHealth"health);
            }
        }
    }
    
CreateTimer(GetConVarFloat(cvar_time), timer_damageplayer_TIMER_FLAG_NO_MAPCHANGE);


Last edited by Theme97; 06-13-2009 at 23:21.
Theme97 is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 06-13-2009 , 23:53   Re: [REQ] Acid Jarate
Reply With Quote #10

Quote:
Originally Posted by Theme97 View Post
The Jarate events never actually fire, but they exist.
Are you sure about this? I was using 'net_showevents 2' in my console and saw them fire just fine. I wouldn't have wrote the plugin if I didn't see them go off.
bl4nk 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 16:45.


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