AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Timer (https://forums.alliedmods.net/showthread.php?t=233197)

Monster Truck 01-11-2014 07:35

Timer
 
Can anyone tell me how to check if timer = 0:00 ?

Thanks very much.

ConnorMcLeod 01-11-2014 07:43

Re: Timer
 
What do you want to do when timer is 0:00 ?

You may find some usefull information in this thread (read it all) https://forums.alliedmods.net/showthread.php?t=232796

Monster Truck 01-11-2014 07:50

Re: Timer
 
I want to play a sound and print a HUD message. Checked the thread, and i don't think that's what i'm looking for.

ConnorMcLeod 01-11-2014 08:46

Re: Timer
 
On maps with objectives or without objectives ? or both ?

Monster Truck 01-11-2014 08:46

Re: Timer
 
Without objectives.

Monster Truck 01-12-2014 05:31

Re: Timer
 
I tried to make this :

PHP Code:

#include <amxmodx>

#define RED    0
#define GREEN    100
#define BLUE    200

new const sound_round_ended[ ] = "AdventSyn/round_ended.mp3";

new 
bool:g_bPlayerRoundEnded;

public 
plugin_init() 
{
    
register_plugin"Round End Sound + HUD""1.1""Imag!ne" );
    
register_event"RoundTime""eventRoundTime""a""1=0" );
    
register_event"DeathMsg""eDeathMsg""a" );
    
register_event"HLTV""eNewRound""a""1=0""2=0" ) ;
}

public 
eventRoundTime() 
{
    
set_hudmessageREDGREENBLUE, -1.00.3523.010.00.10.2, -);
    
show_hudmessage0"Il est 0:00 Les CT's Peuvent FREEKILL !!!" ); 
    
    if( !
g_bPlayerRoundEnded )
    {
        
g_bPlayerRoundEnded true;
        
client_cmd0"mp3 play %s"sound_round_ended );
    }
}

public 
plugin_precache( )
{
    
precache_soundsound_round_ended );
}

public 
eNewRound( )
{
    
g_bPlayerRoundEnded false;


but it doesn't work :(

(Imag!ne is my in game name)

ConnorMcLeod 01-12-2014 05:35

Re: Timer
 
So other should have helped you...

You can use this :

PHP Code:

#include < amxmodx >

#if AMXX_VERSION_NUM < 183
    #include < engine >
    #define has_map_ent_class(%0)    find_ent_by_class(-1, %0)
#endif

#pragma semicolon 1

#define PLUGIN "No Objectives Time Out Message"
#define VERSION "0.0.1"

#define cm(%0)    ( sizeof(%0) - 1 )

const TASK_ROUNDEND 1931543;

new 
mp_roundtimeFloat:g_flRoundTime;

public 
plugin_init()
{
    
register_pluginPLUGINVERSION"ConnorMcLeod" );

    if(    !
has_map_objectives() )
    {
        
mp_roundtime get_cvar_pointer("mp_roundtime");
        
register_event("HLTV""Event_HLTV_New_Round""a""1=0""2=0");
        
register_logevent("LogEvent_Round_Start"2"1=Round_Start");
        
register_logevent("Event_Round_End"2"1=Round_End");
        
Event_HLTV_New_Round();
    }
}

public 
Event_HLTV_New_Round()
{
    
remove_task(TASK_ROUNDEND);
    
g_flRoundTime floatclamp(get_pcvar_float(mp_roundtime)*60.060.0540.0);
}

public 
LogEvent_Round_Start()
{
    
set_task(g_flRoundTime"Task_RoundEnd"TASK_ROUNDEND);
}

public 
Event_Round_End()
{
    
remove_task(TASK_ROUNDEND);
}

public 
Task_RoundEnd()
{
    
// print your messages here
}

has_map_objectives()
{
    return ( 
has_map_ent_class("func_bomb_target") || has_map_ent_class("info_bomb_target") || has_map_ent_class("func_hostage_rescue")
            ||    
has_map_ent_class("func_escapezone") || has_map_ent_class("func_vip_safetyzone") || has_map_ent_class("hostage_entity")    );



Monster Truck 01-12-2014 06:25

Re: Timer
 
Works great, thank you, and i can normally add the sound ?

ConnorMcLeod 01-13-2014 00:54

Re: Timer
 
You can do normally what you can normally do ;)

Monster Truck 01-13-2014 02:15

Re: Timer
 
It works really fine, thank you again ;)


All times are GMT -4. The time now is 10:11.

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