Raised This Month: $32 Target: $400
 8% 

How to prevent IgniteEntity duplicate?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nekoz
Member
Join Date: Oct 2016
Old 07-10-2018 , 14:22   How to prevent IgniteEntity duplicate?
Reply With Quote #1

So I put IgniteEntity in SDKHook_OnTakeDamage and it keep burning player endlessly. It stack it up. I even put if statement in there to check but it still stacking it up. I'm only try to make it burn player only once. Is there a way to fix this?

Last edited by Nekoz; 07-10-2018 at 14:23.
Nekoz is offline
Lux
Veteran Member
Join Date: Jan 2015
Location: Cat
Old 07-10-2018 , 15:27   Re: How to prevent IgniteEntity duplicate?
Reply With Quote #2

Post the code, we can help you 90% more with it
__________________
Connect
My Plugins: KlickME
[My GitHub]

Commission me for L4D
Lux is offline
Nekoz
Member
Join Date: Oct 2016
Old 07-10-2018 , 16:08   Re: How to prevent IgniteEntity duplicate?
Reply With Quote #3

Quote:
Originally Posted by Lux View Post
Post the code, we can help you 90% more with it
PHP Code:
new bool:g_bPlayerBurning[MAXPLAYERS+1] = {false, ...};

public 
OnPluginStart()
{
    
HookEvent("player_death"Event_PlayerDeathEventHookMode_Pre);
}

public 
OnClientPutInServer(client)
{
    
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage);
}

public 
OnClientPostAdminCheck(client)
{
    
g_bPlayerBurning[client] = false;
}

public 
OnClientDisconnect(client)
{
    
g_bPlayerBurning[client] = false;
}

public 
Action:OnTakeDamage(client, &attacker, &inflictor, &Float:damage, &damagetype)
{
    if((
damagetype == DMG_BURN) && (!g_bPlayerBurning[client]))
    {
        
//Right here burn more than 1
        
IgniteEntity(client10.0);
        
g_bPlayerBurning[client] = true;
    }
}

public 
Action:Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    
g_bPlayerBurning[client] = false;


Last edited by Nekoz; 07-10-2018 at 16:08.
Nekoz is offline
Lux
Veteran Member
Join Date: Jan 2015
Location: Cat
Old 07-10-2018 , 17:05   Re: How to prevent IgniteEntity duplicate?
Reply With Quote #4

Quote:
Originally Posted by Nekoz View Post
PHP Code:
public Action:OnTakeDamage(client, &attacker, &inflictor, &Float:damage, &damagetype)
{
    if((
damagetype == DMG_BURN) && (!g_bPlayerBurning[client]))
    {
        
//Right here burn more than 1
        
IgniteEntity(client10.0);
        
g_bPlayerBurning[client] = true;
    }

PHP Code:
if((damagetype DMG_BURN) && (!g_bPlayerBurning[client])) 
Should fix your problem
__________________
Connect
My Plugins: KlickME
[My GitHub]

Commission me for L4D
Lux is offline
Nekoz
Member
Join Date: Oct 2016
Old 07-11-2018 , 14:09   Re: How to prevent IgniteEntity duplicate?
Reply With Quote #5

Quote:
Originally Posted by Lux View Post
PHP Code:
if((damagetype DMG_BURN) && (!g_bPlayerBurning[client])) 
Should fix your problem
It still stacking up :T
I use PrintToClient to see how many time it trigger
It show me that it triggered 1 time but it burn multiple times
And then I use ExtinguishEntity to remove it but doesn't work

Last edited by Nekoz; 07-11-2018 at 14:10.
Nekoz is offline
mug1wara
AlliedModders Donor
Join Date: Jun 2018
Old 07-11-2018 , 14:37   Re: How to prevent IgniteEntity duplicate?
Reply With Quote #6

Just return Plugin_Handled; and it'll stop it
mug1wara is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 07-11-2018 , 23:18   Re: How to prevent IgniteEntity duplicate?
Reply With Quote #7

Quote:
Originally Posted by mug1wara View Post
Just return Plugin_Handled; and it'll stop it
And then return Plugin_Continue; below the if statement.
cravenge is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 07-12-2018 , 06:12   Re: How to prevent IgniteEntity duplicate?
Reply With Quote #8

Set g_bPlayerBurning before you call Ignite.

Your getting stuck in a loop lol
__________________
Neuro Toxin is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 07-12-2018 , 06:31   Re: How to prevent IgniteEntity duplicate?
Reply With Quote #9

This is basically what everyone said above:

PHP Code:
if (damagetype DMG_BURN && !g_bPlayerBurning[client])
{
    
g_bPlayerBurning[client] = true;
    
IgniteEntity(client10.0);
    return 
Plugin_Handled;
}
return 
Plugin_Continue
__________________
Psyk0tik is offline
Nekoz
Member
Join Date: Oct 2016
Old 07-14-2018 , 11:46   Re: How to prevent IgniteEntity duplicate?
Reply With Quote #10

Quote:
Originally Posted by Crasher_3637 View Post
This is basically what everyone said above:

PHP Code:
if (damagetype DMG_BURN && !g_bPlayerBurning[client])
{
    
g_bPlayerBurning[client] = true;
    
IgniteEntity(client10.0);
    return 
Plugin_Handled;
}
return 
Plugin_Continue
It still stack. I'm not sure why.
Is there a way to make my own ignite entity?

Last edited by Nekoz; 07-14-2018 at 11:47.
Nekoz 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:25.


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