Raised This Month: $ Target: $400
 0% 

[TF2] Surrender


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Phaiz
AlliedModders Donor
Join Date: Feb 2014
Location: USA
Old 06-16-2015 , 22:23   [TF2] Surrender
Reply With Quote #1

If you ever play on a server that is running Class Warfare, you will inevitably play a round that is an ultimate spawn camp or no-win scenario (Red Engie vs Blu Sniper for example).

This plugin should have a /surrender command that once 50% of the Blu team types will reset the map (in this case Dustbowl), and preferably keep everyone on the same teams.
__________________
Phaiz is offline
DJ Data
SourceMod Donor
Join Date: Dec 2012
Location: Switzerland
Old 06-18-2015 , 21:50   Re: [TF2] Surrender
Reply With Quote #2

Quote:
Originally Posted by Phaiz View Post
If you ever play on a server that is running Class Warfare, you will inevitably play a round that is an ultimate spawn camp or no-win scenario (Red Engie vs Blu Sniper for example).

This plugin should have a /surrender command that once 50% of the Blu team types will reset the map (in this case Dustbowl), and preferably keep everyone on the same teams.
Are you willing to pay for this plugin?
__________________
SourcePawn Coding Level: Novice
DJ Data is offline
Potato Uno
Veteran Member
Join Date: Jan 2014
Location: Atlanta, Georgia
Old 06-19-2015 , 04:16   Re: [TF2] Surrender
Reply With Quote #3

I allocated 15 minutes of my time and threw something together that MIGHT work, if the missing blanks are filled in. Someone more experienced can finish this up for you.

PHP Code:
#include <sourcemod>

new Handle:SurrenderedClients INVALID_HANDLE;

public 
Plugin:myinfo
{
    
name            "Stalemate Round Restarter",
    
author            "AlliedModders Plugin Requests Forum",
    
description        "Forces the round to be restarted if 50% of BLU players type in 'sm_surrender' or '/surrender'.",
    
version            "1.0.0.0",
    
url                "http://www.sourcemod.net"
}

public 
OnPluginStart()
{
    
SurrenderedClients CreateTrie();
    
RegConsoleCmd("sm_surrender"SurrenderTrigger"Trigger this command to indicate that you want to surrender");
}


public 
Action:SurrenderTrigger(iClientnArgs)
{
    
// Insert this user into the trie:
    
new ID GetSteamAccountID(iClient);
    new 
String:IDString[50]; // Big enough?
    
IntToString(IDIDStringsizeof(IDString));
    
SetTrieString(SurrenderedClientsIDString"1");
    
    
// Grab the length of the trie:
    
new SurrenderedPlayers GetTrieSize(SurrenderedClients);
    
    
// Grab the number of BLU players
    
new BLU 0:
    for (new 
1MaxClientsi++)
    {
        if (
IsClientInGame(i) && GetClientTeam(i) == 3)
            
BLU BLU 1;
    }
    new 
Float:Ratio SurrenderedPlayers BLU 
    
if (Ratio >= 0.5)
    {
        
// Clear the trie since we're going to restart the round:
        
ClearTrie(SurrenderedClients);
        
        
// I don't know the console command to restart a round in pvp
        
ServerCommand("");
    }


Last edited by Potato Uno; 06-19-2015 at 04:22. Reason: Removed variable name, forgot import statement
Potato Uno is offline
DJ Data
SourceMod Donor
Join Date: Dec 2012
Location: Switzerland
Old 06-19-2015 , 11:18   Re: [TF2] Surrender
Reply With Quote #4

Quote:
Originally Posted by Potato Uno View Post
I allocated 15 minutes of my time and threw something together that MIGHT work, if the missing blanks are filled in. Someone more experienced can finish this up for you.

PHP Code:
#include <sourcemod>

new Handle:SurrenderedClients INVALID_HANDLE;

public 
Plugin:myinfo
{
    
name            "Stalemate Round Restarter",
    
author            "AlliedModders Plugin Requests Forum",
    
description        "Forces the round to be restarted if 50% of BLU players type in 'sm_surrender' or '/surrender'.",
    
version            "1.0.0.0",
    
url                "http://www.sourcemod.net"
}

public 
OnPluginStart()
{
    
SurrenderedClients CreateTrie();
    
RegConsoleCmd("sm_surrender"SurrenderTrigger"Trigger this command to indicate that you want to surrender");
}


public 
Action:SurrenderTrigger(iClientnArgs)
{
    
// Insert this user into the trie:
    
new ID GetSteamAccountID(iClient);
    new 
String:IDString[50]; // Big enough?
    
IntToString(IDIDStringsizeof(IDString));
    
SetTrieString(SurrenderedClientsIDString"1");
    
    
// Grab the length of the trie:
    
new SurrenderedPlayers GetTrieSize(SurrenderedClients);
    
    
// Grab the number of BLU players
    
new BLU 0:
    for (new 
1MaxClientsi++)
    {
        if (
IsClientInGame(i) && GetClientTeam(i) == 3)
            
BLU BLU 1;
    }
    new 
Float:Ratio SurrenderedPlayers BLU 
    
if (Ratio >= 0.5)
    {
        
// Clear the trie since we're going to restart the round:
        
ClearTrie(SurrenderedClients);
        
        
// I don't know the console command to restart a round in pvp
        
ServerCommand("");
    }

I dont know if this method will work, but I'm sure he also wants the actual surrendered team to lose as well?
__________________
SourcePawn Coding Level: Novice
DJ Data is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 06-19-2015 , 16:21   Re: [TF2] Surrender
Reply With Quote #5

Quote:
Originally Posted by DJ Data View Post
I dont know if this method will work, but I'm sure he also wants the actual surrendered team to lose as well?
Hey if you want to write the logic that works in all the non-MvM game modes, go right ahead.

Just... don't forget to move the payload carts.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
DJ Data
SourceMod Donor
Join Date: Dec 2012
Location: Switzerland
Old 06-19-2015 , 20:06   Re: [TF2] Surrender
Reply With Quote #6

Oh no I just meant forcing round end with the surrendered team as losers.
I finished the plugin, just waiting for OP to pm me.
__________________
SourcePawn Coding Level: Novice
DJ Data is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 06-22-2015 , 01:08   Re: [TF2] Surrender
Reply With Quote #7

Quote:
Originally Posted by DJ Data View Post
Oh no I just meant forcing round end with the surrendered team as losers.
I finished the plugin, just waiting for OP to pm me.
Yes, but consider what happens when RED surrenders during round one or two of a multi-stage payload map.

Pro-Tip: pl_goldrush uses logic in the last path_track in a stage to move the cart to the next stage.
__________________
Not currently working on SourceMod plugin development.
Powerlord 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:09.


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