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

GameRules_GetRoundState Alternative for L4D2?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
saucex4
Junior Member
Join Date: May 2012
Old 06-14-2012 , 22:55   GameRules_GetRoundState Alternative for L4D2?
Reply With Quote #1

Howdy,

I've been writing a plugin for L4D2, and I'm trying to come up with a solution for a plugin that is loaded late (ie after a round has started let's say in survival). However, it seems that GameRules_GetRoundState() doesn't work for L4D2.

The server console gives me a "m_iRoundState" not found on the gamerules proxy error.

Am I doing something wrong here, or is there an alternative method for obtaining the state of a round?

Code:
public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max) {
    loadLate = late;
    return APLRes_Success;
}

public OnPluginStart() {

// check if plugin was loaded late
    if (loadLate) {
        // do some stuff
        ...

        if (GameRules_GetRoundState() == RoundState_RoundRunning) { 
               // do some other stuff 
              ..
        }
    }
    
}
saucex4 is offline
ProdigySim
SourceMod Plugin Approver
Join Date: Feb 2010
Old 06-15-2012 , 04:07   Re: GameRules_GetRoundState Alternative for L4D2?
Reply With Quote #2

You're correct that m_iRoundState is not a public field in L4D2's gamerules.

This list from the wiki has the correct list of available properties.

I haven't seen anything similar to a "roundstate" in gamerules in my diassembly... So your best bet would probably have to be checking something like m_iRoundTime or similar. I can't really give you any pointers other than to poke around and see if you can find some props that are -1 between rounds or something.

Other than that, I've found some moderately-round-state-ish variables in CDirector and its fellow classes... though I haven't looked into survival specifically. In order to actually use those, you'd need l4d2_direct. If you get to that point you may want to consider first how important detecting late loads really is to you.
ProdigySim is offline
saucex4
Junior Member
Join Date: May 2012
Old 06-16-2012 , 05:47   Re: GameRules_GetRoundState Alternative for L4D2?
Reply With Quote #3

Great links PSim!

Dude you're answering all my questions on the steam forums as well ^_^;

Thanks for all the help!
saucex4 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 09:27.


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