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

FF2 Kill Streak Tracker With FireEvent? (Halp)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Tetradox
Junior Member
Join Date: Aug 2016
Old 02-21-2017 , 20:54   Kill Streak Tracker With FireEvent? (Halp)
Reply With Quote #1

Hello, i saw SHADoW93's streaker plugin but i figured out it lacked the killtreak notification for every 5 kills at the top of the screen, so i tried to do something about it changing the code a bit, but there is a problem with it, here it is if you want to c it:

Code:
#pragma semicolon 1

#include <sourcemod>
#include <freak_fortress_2>

new LastKSCount[MAXPLAYERS+1];
new streak[MAXPLAYERS+1];
new Handle:DeathEvent;

new Handle:cvarKStreakDmg;

public void OnPluginStart()
{	
	cvarKStreakDmg=CreateConVar("streaker_kstreak_dmg", "200", "Damage required to increase the killstreak counter", FCVAR_PLUGIN);
}

stock bool IsValidClient(int client)
{
	if (client <= 0 || client > MaxClients) return false;
	if (!IsClientInGame(client) || !IsClientConnected(client)) return false;
	if (IsClientSourceTV(client) || IsClientReplay(client) || IsFakeClient(client)) return false;
	return true;
}

public OnGameFrame()
{
	for(new client = 1; client <= MaxClients; client++)
	{
		if (GetClientTeam(client)!=FF2_GetBossTeam() && IsValidClient(client) && IsClientInGame(client)) 
		{
			streak[client]=((FF2_GetClientDamage(client)/GetConVarInt(cvarKStreakDmg)) - ((FF2_GetClientDamage(client) % GetConVarInt(cvarKStreakDmg))/GetConVarInt(cvarKStreakDmg)));		
			if (streak[client]>0) 
			{
				DeathEvent = CreateEvent("player_death");
				SetEntProp(client, Prop_Send, "m_nStreaks", streak[client]);	
				SetEventInt(DeathEvent, "kill_streak_total", streak[client]);
				SetEventInt(DeathEvent, "kill_streak_wep", streak[client]);		
				SetEventInt(DeathEvent, "attacker", client);
			}
		
			if(streak[client] % 5 == 0 && LastKSCount[client]!=streak[client])
			{
				FireEvent(DeathEvent);
				LastKSCount[client]=streak[client];
			}		
		}
	}
	for(new boss; FF2_GetBossUserId(boss)!=-1; boss++)
	{
		new clboss=GetClientOfUserId(FF2_GetBossUserId(boss));
		SetEventInt(DeathEvent, "userid", clboss);
	}
}
The problem with this is that when the event is fired the boss instantly dies, is there a way to get the ks notification to work without this happening? It would be grateful if you could help me
Tetradox is offline
Akuba
Senior Member
Join Date: Oct 2013
Old 02-22-2017 , 01:21   Re: Kill Streak Tracker With FireEvent? (Halp)
Reply With Quote #2

I was trying the same, but FF2 sometimes acted strange with it, so I removed it again.

Anyways, try to add this:
PHP Code:
SetEventInt(DeathEvent"damagebits"6144); 
This does add the deathringer flag and should prevent the boss from dying.

Last edited by Akuba; 02-22-2017 at 01:22.
Akuba is offline
Reply


Thread Tools
Display Modes

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:07.


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