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

Execute command on 1st round


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sw33T3R
AlliedModders Donor
Join Date: Mar 2014
Old 09-20-2016 , 17:11   Execute command on 1st round
Reply With Quote #1

Hi guys
I'd like 2 request a simple plugin
If game round = 1 plugin should exec config1.cfg
If game round = 15 plugin should exec config2.cfg
Sw33T3R is offline
OSWO
Senior Member
Join Date: Jul 2015
Location: United Kingdom, London
Old 09-20-2016 , 17:25   Re: Execute command on 1st round
Reply With Quote #2

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

public void OnPluginStart() {
    
HookEvent("round_poststart"event_poststartEventHookMode_Pre);
}

public 
Action event_poststart(Event eventchar[] namebool dontBroadcast) {
    
int I_TotalScore;

    for (
int i 24i++) {
        
I_TotalScore += CS_GetTeamScore(i);
    }

    if (
I_TotalScore == 1) {
        
ServerCommand("exec config1.cfg")
    } else if (
I_TotalScore == 15) {
        
ServerCommand("exec config2.cfg")
    }

__________________
SourceTimer | WeaponSkins++ | BasePlugins++ https://github.com/OSCAR-WOS
OSWO is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 09-20-2016 , 18:21   Re: Execute command on 1st round
Reply With Quote #3

GameRules_GetProp("m_totalRoundsPlayed")
Mitchell is offline
Sw33T3R
AlliedModders Donor
Join Date: Mar 2014
Old 09-20-2016 , 18:22   Re: Execute command on 1st round
Reply With Quote #4

Quote:
Originally Posted by OSWO View Post
PHP Code:
#include <sourcemod>
#include <cstrike>

public void OnPluginStart() {
    
HookEvent("round_poststart"event_poststartEventHookMode_Pre);
}

public 
Action event_poststart(Event eventchar[] namebool dontBroadcast) {
    
int I_TotalScore;

    for (
int i 24i++) {
        
I_TotalScore += CS_GetTeamScore(i);
    }

    if (
I_TotalScore == 1) {
        
ServerCommand("exec config1.cfg")
    } else if (
I_TotalScore == 15) {
        
ServerCommand("exec config2.cfg")
    }

Works without problems, big thanks <3
But i have question.
How can i exec config on warmup?
Just add OnMapStart() {ServerCommand("exec config3.cfg")}
?

Last edited by Sw33T3R; 09-20-2016 at 18:24.
Sw33T3R is offline
Sw33T3R
AlliedModders Donor
Join Date: Mar 2014
Old 09-20-2016 , 18:24   Re: Execute command on 1st round
Reply With Quote #5

Quote:
Originally Posted by Mitchell View Post
GameRules_GetProp("m_totalRoundsPlayed")
Thanks u too
Sw33T3R 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:10.


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