Raised This Month: $ Target: $400
 0% 

roundstart event


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GhostMan
Senior Member
Join Date: Jun 2012
Old 08-09-2012 , 03:56   roundstart event
Reply With Quote #1

how do i call round start event when all players are just spawned but before freeze time?

And when round start event is called like that?

PHP Code:
register_logevent("Event_Roundstart"2"1=Round_Start"); 
And where i can find all parameters meanings?

Last edited by GhostMan; 08-09-2012 at 03:56.
GhostMan is offline
dark_style
Senior Member
Join Date: Jul 2009
Location: Bulgaria
Old 08-09-2012 , 05:57   Re: roundstart event
Reply With Quote #2

Take a look at this tutorial - http://forums.alliedmods.net/showthread.php?t=42159 .
dark_style is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 08-09-2012 , 11:40   Re: roundstart event
Reply With Quote #3

This is also a good wiki to have laying around.
http://wiki.amxmodx.org/Half-Life_1_...s#Introduction

Most of these events run through register_logevent
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-09-2012 , 11:42   Re: roundstart event
Reply With Quote #4

Quote:
Originally Posted by Liverwiz View Post
This is also a good wiki to have laying around.
http://wiki.amxmodx.org/Half-Life_1_...s#Introduction

Most of these events run through register_logevent
None of the events on that page are used with register_logevent().
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 08-09-2012 , 11:56   Re: roundstart event
Reply With Quote #5

Quote:
Originally Posted by Exolent[jNr] View Post
None of the events on that page are used with register_logevent().
look at me confusing my shit again.....
I stand corrected.
But its still good to have around, however irrelevant to this thread.
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz is offline
akcaliberg
Senior Member
Join Date: Nov 2011
Location: Istanbul
Old 08-09-2012 , 23:16   Re: roundstart event
Reply With Quote #6

PHP Code:
#include <amxmodx>
#include <hamsandwich>

new bool:new_round[33];
new 
round;
new 
iMaxPlayers;
public 
plugin_init() {
    
RegisterHam(Ham_Spawn"player""HamPlayerSpawnPost",1)
    
register_logevent("LogeventRoundEnd",2,"1=Round_End"//Check: will the new round start ?
    
register_logevent("LogeventRoundStart",2,"1=Round_Start"//Check: is it first round ?
    
round=0;
    
iMaxPlayers get_maxplayers();
}
public 
LogeventRoundEnd() {
        for(new 
i=1;i<=iMaxPlayers;i++) {
                
new_round[i] = true;
        }
}
public 
LogeventRoundStart() { 
    
round++
}
public 
HamPlayerSpawnPost(id) {
    if(
new_round[id] || !round) {
        
//Codes
        
new_round[id] = false;
    }
    

I'm new in scripting, but I guess this work (?)

Last edited by akcaliberg; 08-10-2012 at 08:14.
akcaliberg is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 08-09-2012 , 23:19   Re: roundstart event
Reply With Quote #7

in order for the HamSpawn to be post you need a 4th argument to be 1.
Code:
    RegisterHam(Ham_Spawn, "player", "HamPlayerSpawnPost")

PHP Code:
    RegisterHam(Ham_Spawn"player""HamPlayerSpawnPost"1
otherwise its pre

and only the first person in the spawn iteration will have the HamSpawn code run on them. After that new_round will be false, and thus all if-checks will be be false.
__________________
What an elegant solution to a problem that doesn't need solving....

Last edited by Liverwiz; 08-09-2012 at 23:23.
Liverwiz is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-10-2012 , 02:09   Re: roundstart event
Reply With Quote #8

You can use this, offering 2 forwards :

PHP Code:
forward NewRoundHLTVround_num )
forward MapCleanedUp() 
The 1st one is the usual HLTV event with round num as argument
The 2nd one is the last thing called in CHalfLifeMultiPlay::RoundRestart, so it happen after all players have been spawned.

Don't rip the code to use in multiple plugin, because you gonna have unexpected results unregistering FM_PlaybackEvent on the same frame other FM_PlaybackEvent forwards are sent.
If you want to use in only 1 plugin you can rip the code, else use this plugin and its forwards.

PHP Code:
/*    Formatright © 2011, ConnorMcLeod

    This plugin is free software;
    you can redistribute it and/or modify it under the terms of the
    GNU General Public License as published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this plugin; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

#include <amxmodx>
#include <fakemeta>

#define VERSION "0.0.1"
#define PLUGIN "New Round Forwards"

const INVALID_FORWARD = -1

new const g_szNewRoundHLTVCallBack[] = "NewRoundHLTV"
new const g_szMapCleanedUpCallBack[] = "MapCleanedUp"

new g_iNewRoundHLTV INVALID_FORWARD
new g_iMapCleanedUp INVALID_FORWARD

new g_iFhPlaybackEventPost

new g_iReturn

new bool:g_bCompleteReset

public plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")
}

public 
plugin_cfg()
{
    new 
pluginsNum get_pluginsnum()
    new 
bool:bHLTVRegistered false
    
for(new pluginIndexpluginIndex<pluginsNumpluginIndex++)
    {
        if( 
g_iNewRoundHLTV == INVALID_FORWARD && get_func_id(g_szNewRoundHLTVCallBackpluginIndex) != -)
        {
            if( !
bHLTVRegistered )
            {
                
register_event("HLTV""Event_HLTV_New_Round""a""1=0""2=0")
                
bHLTVRegistered true
            
}
            
register_event("TextMsg""Event_TextMsg_Restart""a""2&#Game_C""2&#Game_w")
            
g_iNewRoundHLTV CreateMultiForward(g_szNewRoundHLTVCallBackET_IGNOREFP_CELL)
        }

        if( 
g_iMapCleanedUp == INVALID_FORWARD && get_func_id(g_szMapCleanedUpCallBackpluginIndex) != -)
        {
            if( !
bHLTVRegistered )
            {
                
register_event("HLTV""Event_HLTV_New_Round""a""1=0""2=0")
                
bHLTVRegistered true
            
}

            
// m_usResetDecals = engfunc(EngFunc_PrecacheEvent, 1, "events/decal_reset.sc")
            
g_iMapCleanedUp CreateMultiForward(g_szMapCleanedUpCallBackET_IGNORE)
        }

        if( 
g_iMapCleanedUp != INVALID_FORWARD && g_iNewRoundHLTV != INVALID_FORWARD )
        {
            break
        }
    }
}

public 
Event_TextMsg_Restart()
{
    
g_bCompleteReset true
}

public 
Event_HLTV_New_Round()
{
    static 
iRoundNum 0

    
if( g_bCompleteReset )
    {
        
g_bCompleteReset false
        iRoundNum 
0
    
}

    
iRoundNum++

    if( 
g_iNewRoundHLTV != INVALID_FORWARD )
    {
        
ExecuteForwardg_iNewRoundHLTVg_iReturniRoundNum 
    }

    if( 
g_iMapCleanedUp != INVALID_FORWARD )
    {
        
g_iFhPlaybackEventPost register_forward(FM_PlaybackEvent"OnPlaybackEvent_Post"true)
    }
}

public 
OnPlaybackEvent_Post()
{
    
unregister_forward(FM_PlaybackEventg_iFhPlaybackEventPosttrue)
    
ExecuteForwardg_iMapCleanedUpg_iReturn )

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 08-10-2012 at 02:09.
ConnorMcLeod 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 05:47.


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