AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   [L4D2] How to detect if tank/witch are already on fire? (https://forums.alliedmods.net/showthread.php?t=340330)

alasfourom 11-10-2022 18:18

[L4D2] How to detect if tank/witch are already on fire?
 
Hello guys,

I'm trying to do some stuff when someone has ignited a witch or tank. When trying to hook the "zombie_ignited", this event will keep spamming the stuff I'm trying to do as far as they are on fire.

So how to detect if tank/witch are already on fire?

Thanks


PHP Code:

#pragma semicolon 1
#pragma newdecls required

#include <sourcemod>
#include <sdktools>
#include <sdkhooks>

public void OnPluginStart()
{
    
HookEvent("zombie_ignited"Event_ZombieIgnited);
}

void Event_ZombieIgnited(Event event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(event.GetInt("userid"));
    if (!
client || !IsClientInGame(client) || IsFakeClient(client) || GetClientTeam(client) != 2) return;
    
    
char sVictimName[32];
    
GetEventString(event"victimname"sVictimNamesizeof(sVictimName));
    
    if(
StrEqual(sVictimName"Tank"false)) PrintToChatAll("Tank ignited by: %N"cleint);
    else if(
StrEqual(sVictimName"Witch"false)) PrintToChatAll("Witch ignited by: %N"cleint);
    return;



sorallll 11-10-2022 18:40

Re: [L4D2] How to detect if tank/witch are already on fire?
 
Quote:

Originally Posted by alasfourom (Post 2792562)
Hello guys,

I'm trying to do some stuff when someone has ignited a witch or tank. When trying to hook the "zombie_ignited", this event will keep spamming the stuff I'm trying to do as far as they are on fire.

So how to detect if tank/witch are already on fire?

Thanks


PHP Code:

#pragma semicolon 1
#pragma newdecls required

#include <sourcemod>
#include <sdktools>
#include <sdkhooks>

public void OnPluginStart()
{
    
HookEvent("zombie_ignited"Event_ZombieIgnited);
}

void Event_ZombieIgnited(Event event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(event.GetInt("userid"));
    if (!
client || !IsClientInGame(client) || IsFakeClient(client) || GetClientTeam(client) != 2) return;
    
    
char sVictimName[32];
    
GetEventString(event"victimname"sVictimNamesizeof(sVictimName));
    
    if(
StrEqual(sVictimName"Tank"false)) PrintToChatAll("Tank ignited by: %N"cleint);
    else if(
StrEqual(sVictimName"Witch"false)) PrintToChatAll("Witch ignited by: %N"cleint);
    return;



PHP Code:

GetEntityFlags(entity) & FL_ONFIRE 


alasfourom 11-11-2022 06:40

Re: [L4D2] How to detect if tank/witch are already on fire?
 
Ahh thank you sorallll


All times are GMT -4. The time now is 00:59.

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