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

Run a server command for 5 rounds


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
cold-serenity
Member
Join Date: Sep 2009
Old 03-18-2012 , 18:15   Run a server command for 5 rounds
Reply With Quote #1

How would I go about having a server command be ran for 5 rounds straight at the start of each round. Then afterwords the event stops. I want to tie this script in with a custom vote where a cfg is executed for 5 rounds straight.

This is all I have currently.

Code:
public OnPluginStart() 
{ 
    HookEvent("round_start", Event_RoundStart); 
} 

public Action:Event_RoundStart(Handle:event, const String name[], bool:dontBroadcast) 
{ 
    ServerCommand("exec my_config.cfg"); 
    return Plugin_Continue; 
}
cold-serenity is offline
RedSword
SourceMod Plugin Approver
Join Date: Mar 2006
Location: Quebec, Canada
Old 03-18-2012 , 20:21   Re: Run a server command for 5 rounds
Reply With Quote #2

Have a global variable count round and compare/increment it on RoundStart.

Hook RoundEnd and reset to 0 that global variable if the winner is in team "1".
__________________
My plugins :
Red Maze
Afk Bomb
RAWR (per player/rounds Awp Restrict.)
Kill Assist
Be Medic

You can also Donate if you appreciate my work
RedSword is offline
cold-serenity
Member
Join Date: Sep 2009
Old 03-18-2012 , 20:41   Re: Run a server command for 5 rounds
Reply With Quote #3

Unfortunately I have no idea on how to even do that :/

The code I currently have is what I salvaged from certain threads.
cold-serenity is offline
MasterOfTheXP
Veteran Member
Join Date: Aug 2011
Location: Cloudbank
Old 03-18-2012 , 21:50   Re: Run a server command for 5 rounds
Reply With Quote #4

PHP Code:
public OnPluginStart()
{
    
HookEvent("round_start"Event_RoundStart);
}

new 
Rounds 0;

public 
Action:Event_RoundStart(Handle:event, const String name[], bool:dontBroadcast)
{
    if (
Rounds 5) return Plugin_Continue;
    
Rounds Rounds 1;
    
ServerCommand("exec my_config.cfg");
    return 
Plugin_Continue;

__________________
Plugins / My Steam / TF2 Sandbox (plugin beta testing!)
MasterOfTheXP is offline
cold-serenity
Member
Join Date: Sep 2009
Old 03-18-2012 , 22:31   Re: Run a server command for 5 rounds
Reply With Quote #5

Thanks for the reply. When I try to compile this I get these errors

Code:
/groups/sourcemod/upload_tmp/textSTF4sd.sp(3) : error 100: function prototypes do not match
/groups/sourcemod/upload_tmp/textSTF4sd.sp(8) : error 001: expected token: ")", but found "-identifier-"
/groups/sourcemod/upload_tmp/textSTF4sd.sp(8) : error 017: undefined symbol "name"
/groups/sourcemod/upload_tmp/textSTF4sd.sp(10) : error 010: invalid function or declaration
/groups/sourcemod/upload_tmp/textSTF4sd.sp(13) : error 010: invalid function or declaration
/groups/sourcemod/upload_tmp/textSTF4sd.sp(6) : warning 203: symbol is never used: "Rounds"

Last edited by cold-serenity; 03-18-2012 at 22:32.
cold-serenity is offline
MasterOfTheXP
Veteran Member
Join Date: Aug 2011
Location: Cloudbank
Old 03-18-2012 , 22:35   Re: Run a server command for 5 rounds
Reply With Quote #6

Whoops, forgot the includes. That should do it.

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

public OnPluginStart()
{
    
HookEvent("round_start"Event_RoundStart);
}

new 
Rounds 0;

public 
Action:Event_RoundStart(Handle:event, const String name[], bool:dontBroadcast)
{
    if (
Rounds 5) return Plugin_Continue;
    
Rounds Rounds 1;
    
ServerCommand("exec my_config.cfg");
    return 
Plugin_Continue;

__________________
Plugins / My Steam / TF2 Sandbox (plugin beta testing!)
MasterOfTheXP is offline
thetwistedpanda
Good Little Panda
Join Date: Sep 2008
Old 03-18-2012 , 23:44   Re: Run a server command for 5 rounds
Reply With Quote #7

You'd still want public OnMapStart() { Rounds = 0; } to reset the round count on map changes.
__________________
thetwistedpanda is offline
Lord Canistra
Senior Member
Join Date: Mar 2009
Location: Tallinn, Estonia
Old 03-19-2012 , 02:02   Re: Run a server command for 5 rounds
Reply With Quote #8

const String:name[]
__________________
Lord Canistra is offline
cold-serenity
Member
Join Date: Sep 2009
Old 03-19-2012 , 16:38   Re: Run a server command for 5 rounds
Reply With Quote #9

I still have all the same errors even after compiling with the includes. Is it because Rounds itself is only the name of the variable and as such is not actually assigned to real ingame rounds? Or is rounds a special variable that actually represents rounds?

Last edited by cold-serenity; 03-19-2012 at 16:41.
cold-serenity is offline
MasterOfTheXP
Veteran Member
Join Date: Aug 2011
Location: Cloudbank
Old 03-19-2012 , 16:44   Re: Run a server command for 5 rounds
Reply With Quote #10

Quote:
Originally Posted by cold-serenity View Post
I still have all the same errors even after compiling with the includes. Is it because Rounds itself is only the name of the variable and as such is not actually assigned to real ingame rounds? Or is rounds a special variable that actually represents rounds?
What game is this for? Knowing that might help solve these issues.

Rounds is just an integer called Rounds. You may call it Bananas if you wish.
__________________
Plugins / My Steam / TF2 Sandbox (plugin beta testing!)
MasterOfTheXP 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 03:20.


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