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

Not ending round when the only team player dies


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Pcsl
SourceMod Donor
Join Date: Jun 2013
Old 10-17-2013 , 21:36   Not ending round when the only team player dies
Reply With Quote #1

I was wondering how could I be able of preventing the round finishing when the only player of the terrorist team dies. This is because in zombie mode when there are few players, there is usually one zombie and if they kill the zombie the round ends without being able to ending the map.
The first option is to prevent the round ends when that player dies or just give unlimited HP when there is only one terrorist.

Last edited by Pcsl; 10-17-2013 at 21:37.
Pcsl is offline
Bimbo1
Senior Member
Join Date: Jan 2010
Location: brazil
Old 10-17-2013 , 22:15   Re: Not ending round when the only team player dies
Reply With Quote #2

there's a forward for it: cs_onterminateround or something like that. return plugin_handled when you want the round not to end.
__________________
sie sind das essen und wir sind die jäger!
Bimbo1 is offline
Pcsl
SourceMod Donor
Join Date: Jun 2013
Old 10-17-2013 , 23:50   Re: Not ending round when the only team player dies
Reply With Quote #3

Ok, thank you, that should work. I was thinking now how would it be possible to trigger the death when there is only one T when the following conditions meet:
- Damage not from a client (explosions, fall could kill him)
- There is only one Terrorist

I was thinking about checking every time the client receives damage:

if Tplayers=1 {
if that damage is from a client
{
if that damage kills the T
{
prevent death
}
}
}

(Sorry for using pseudocode) I think there should be a better way that have to check every time the client receives damage the number of clients but I don't know how...
Pcsl is offline
Franc1sco
Veteran Member
Join Date: Oct 2010
Location: Spain (Madrid)
Old 10-18-2013 , 06:51   Re: Not ending round when the only team player dies
Reply With Quote #4

Quote:
Originally Posted by Pcsl View Post
Ok, thank you, that should work. I was thinking now how would it be possible to trigger the death when there is only one T when the following conditions meet:
- Damage not from a client (explosions, fall could kill him)
- There is only one Terrorist

I was thinking about checking every time the client receives damage:

if Tplayers=1 {
if that damage is from a client
{
if that damage kills the T
{
prevent death
}
}
}

(Sorry for using pseudocode) I think there should be a better way that have to check every time the client receives damage the number of clients but I don't know how...
Maybe this will work
PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <cstrike>

new bool:noterminar;


public 
OnPluginStart()
{
    
HookEvent("player_death"PlayerDeathEventHookMode_Pre);    
    
HookEvent("round_start"Event_RoundStart);
}

public 
Action:PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    
noterminar false;
    new 
attacker GetClientOfUserId(GetEventInt(event"attacker"));
    if(!
attacker) return; // attacker not is a player, dont continue
    
new client GetClientOfUserId(GetEventInt(event"userid"));
    if(
GetClientTeam(client) != 2) return; // victim is not a T, dont continue

    
new terros_vivos 0;
    for(new 
1<= MaxClientsi++)
        if(
IsClientInGame(i) && GetClientTeam(i) == 2terros_vivos++; //count T alive

    
if(terros_vivos == 1noterminar true;

}

public 
Action:CS_OnTerminateRound(&Float:delay, &CSRoundEndReason:reason)
{
    if(
noterminar) return Plugin_Handled;

    return 
Plugin_Continue;

}

public 
Action:Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
    
noterminar false;

I dont test it, this afternoon I will test it
__________________
Veteran Coder -> Activity channel
Coding on CS2 and taking paid and free jobs.

Contact: Steam, Telegram or discord ( franug ).

You like my work? +Rep in my steam profile comments or donate.


Last edited by Franc1sco; 10-18-2013 at 06:53.
Franc1sco is offline
Send a message via MSN to Franc1sco
Impact123
Veteran Member
Join Date: Oct 2011
Location: Germany
Old 10-18-2013 , 07:40   Re: Not ending round when the only team player dies
Reply With Quote #5

Try this.
Code:
mp_ignore_round_win_conditions "1"
__________________

Last edited by Impact123; 10-18-2013 at 07:43.
Impact123 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 06:54.


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