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

[L4D2] Round Duration


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
noxman
Member
Join Date: Jun 2012
Old 10-12-2013 , 05:27   [L4D2] Round Duration
Reply With Quote #1

Hello everybody,

i need a plugin which is showing the round duration at the end of the round. For example

Quote:
Round Duration: 6 min 43 sec


How can i do this?

(Sry for my bad english)

noxman is offline
eric0279
AlliedModders Donor
Join Date: May 2007
Old 10-12-2013 , 14:04   Re: [L4D2] Round Duration
Reply With Quote #2

use event door_close or player_death if all survivor is dead ?
eric0279 is offline
GsiX
gee, six eggs
Join Date: Aug 2012
Location: Land Below The Wind
Old 10-12-2013 , 14:45   Re: [L4D2] Round Duration
Reply With Quote #3

round_end
Note:
Name: round_end
Structure:
byte winner winner team/user i
byte reason reson why team won
string message end round message
float time
http://wiki.alliedmods.net/Left_4_De...ents#round_end
GsiX is offline
noxman
Member
Join Date: Jun 2012
Old 10-12-2013 , 15:19   Re: [L4D2] Round Duration
Reply With Quote #4

Quote:
Originally Posted by GsiX View Post
round_end
Note:
Name: round_end
Structure:
byte winner winner team/user i
byte reason reson why team won
string message end round message
float time
http://wiki.alliedmods.net/Left_4_De...ents#round_end
Thanks. But how i do this?
noxman is offline
RU_6uK
SourceMod Donor
Join Date: May 2010
Old 10-12-2013 , 17:27   Re: [L4D2] Round Duration
Reply With Quote #5

PHP Code:
public OnPluginStart()
{
 
HookEvent("round_end"Event_RoundEnd);
}

public 
Action:Event_RoundEnd(Handle:event, const String:name[], bool:dontBroadcast
{
 new 
Float:time GetEventFloat(event"time");
 
PrintToChatAll("Round Duration: %.0f sec."time);

RU_6uK is offline
noxman
Member
Join Date: Jun 2012
Old 10-12-2013 , 18:33   Re: [L4D2] Round Duration
Reply With Quote #6

Thank you. But it doesnt work

It show me always "Round Duration: 0sec"
noxman is offline
GsiX
gee, six eggs
Join Date: Aug 2012
Location: Land Below The Wind
Old 10-12-2013 , 23:48   Re: [L4D2] Round Duration
Reply With Quote #7

PHP Code:
#include <sourcemod>
#include <sdktools>

new bool:g_Round;
new 
g_Count;

public 
Plugin:myinfo 
{
    
name "l4d2_duration",
    
author "RU_6uK",
    
description "Duration of map played",
    
version "0.0",
    
url "http://forums.alliedmods.net"
}

public 
OnPluginStart()
{
    
HookEvent(    "round_start",    Event_Round    );
    
HookEvent(    "round_end",    Event_Round    );
}

public 
OnMapStart()
{
    
g_Round true;
}

public 
Action:Event_Round(Handle:event, const String:name[], bool:dontBroadcast)  
{
    if ( 
g_Round == true )
    {
        
g_Count 0;
        
CreateTimer1.0Timer_RoundCount_TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE );
        
g_Round false;
    }
    else
    {
        
g_Round true;
    }
}

public 
Action:Timer_RoundCountHandle:timerany:client )
{
    
g_Count ++;
    if ( 
g_Round == false )
    {
        return 
Plugin_Continue;
    }
    else
    {
        
// Do the math here.. i lazy
        // Note that the timer ticking every 1.0 sec once. With +1 sec gape.
        
new min g_Count/60;
        new 
sec g_Count min;
        
        
        
PrintToChatAll"[ROUNDDURATION]: %d mim | %d sec"minsec );
    }
    return 
Plugin_Stop;

EDIT: untested
__________________
If i happen to insulted you unintentionally,
it was me and Google Translate who did it.

Last edited by GsiX; 10-13-2013 at 05:27.
GsiX is offline
noxman
Member
Join Date: Jun 2012
Old 10-13-2013 , 03:54   Re: [L4D2] Round Duration
Reply With Quote #8

Thanks, it works but it showing me:

== Round Duration: 2 min 168 sec ==

Better 4 min 48 sec How to fix?
noxman is offline
GsiX
gee, six eggs
Join Date: Aug 2012
Location: Land Below The Wind
Old 10-13-2013 , 05:12   Re: [L4D2] Round Duration
Reply With Quote #9

U know the correct minutes and seconds i belive u know how to do the math..

PHP Code:
new min g_Count/60;
new 
sec g_Count - ( min*60 ); 
Just try until it show you the correct one. Otherwise go to plugin request..
__________________
If i happen to insulted you unintentionally,
it was me and Google Translate who did it.

Last edited by GsiX; 10-13-2013 at 05:27.
GsiX is offline
Skyy
AlliedModders Donor
Join Date: Jan 2010
Location: Toronto, Canada
Old 10-14-2013 , 10:59   Re: [L4D2] Round Duration
Reply With Quote #10

lol gsix... most people mistaken scripting for plugin requests. Having to figure any of it out can be too much.
Skyy 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 19:02.


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