Raised This Month: $ Target: $400
 0% 

[DOTA2] Block hero pick


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
IloveMusic
Junior Member
Join Date: Nov 2014
Old 02-05-2015 , 03:20   [DOTA2] Block hero pick
Reply With Quote #1

Hello every1 I want to block some heroes in my dota2 server mod, are there any suggestions how to implement it?

I'm creating Zombie Swarm mode, the Dire is Zombie team and the Radiant have to survive or even find the cure from zombie virus.
And I need to block all "undead" heroes such as Pudge, Wraith King and etc FOR RADIANT TEAM and block survivors ( all non-undead heroes ) for DIRE team.
Help me please.

Last edited by IloveMusic; 02-05-2015 at 03:21.
IloveMusic is offline
psychonic

BAFFLED
Join Date: May 2008
Old 02-05-2015 , 07:49   Re: [DOTA2] Block hero pick
Reply With Quote #2

PHP Code:
#include <sourcemod>

StringMap g_AllowedHeroesRadiant;
StringMap g_AllowedHeroesDire;

enum DotaTeam
{
    
DotaTeam_Unassigned,
    
DotaTeam_Spectator,
    
DotaTeam_Radiant,
    
DotaTeam_Dire,
}

public 
void OnPluginStart()
{
    
AddCommandListener(dota_select_hero"dota_select_hero");
    
    
g_AllowedHeroesDire StringMap();
    
g_AllowedHeroesDire.SetValue("npc_dota_hero_pudge"1);
    
g_AllowedHeroesDire.SetValue("npc_dota_hero_skeleton_king"1);
    
    
g_AllowedHeroesRadiant StringMap();
    
g_AllowedHeroesRadiant.SetValue("npc_dota_hero_puck"1);
    
    
// etc.
}

public 
Action dota_select_hero(int client, const char[] szCommandint argc)
{
    if (
argc && client != && IsClientInGame(client))
    {
        
DotaTeam team view_as<DotaTeam>(GetClientTeam(client));
        
char szHero[64];
        
int dummy;
        
        
GetCmdArg(1szHerosizeof(szHero));

        if (
team == DotaTeam_Radiant)
        {
            if (!
g_AllowedHeroesRadiant.GetValue(szHerodummy))
                return 
Plugin_Handled;
        }
        else if (
team == DotaTeam_Dire)
        {
            if (!
g_AllowedHeroesDire.GetValue(szHerodummy))
                return 
Plugin_Handled;
        }
    }
    
    return 
Plugin_Continue;

Something like this should work, although you're better off putting them in a config file and reading from there, rather than hardcoding in the plugin.
psychonic is offline
Mathias.
Veteran Member
Join Date: Aug 2010
Location: Canada is my city
Old 02-05-2015 , 13:43   Re: [DOTA2] Block hero pick
Reply With Quote #3

nicely done psychonic
Mathias. is offline
wanted2411
Senior Member
Join Date: Jun 2012
Old 02-06-2015 , 07:33   Re: [DOTA2] Block hero pick
Reply With Quote #4

Same question, but with Items. How can i Disable part of items? (Shop items, like a 'Gem' or other...)
wanted2411 is offline
psychonic

BAFFLED
Join Date: May 2008
Old 02-06-2015 , 08:40   Re: [DOTA2] Block hero pick
Reply With Quote #5

I'm not sure how to do that without replacing some of the game's script files or some crazy hacks in a custom SM extension.
psychonic is offline
Mathias.
Veteran Member
Join Date: Aug 2010
Location: Canada is my city
Old 02-06-2015 , 10:43   Re: [DOTA2] Block hero pick
Reply With Quote #6

Is there a place that we can download the lastest updated binaries for linux?
Mathias. is offline
Cuban_Dota
Member
Join Date: Jan 2015
Old 02-06-2015 , 12:14   Re: [DOTA2] Block hero pick
Reply With Quote #7

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

StringMap g_AllowedHeroesRadiant;
StringMap g_AllowedHeroesDire;

enum DotaTeam
{
    
DotaTeam_Unassigned,
    
DotaTeam_Spectator,
    
DotaTeam_Radiant,
    
DotaTeam_Dire,
}

public 
void OnPluginStart()
{
    
AddCommandListener(dota_select_hero"dota_select_hero");
    
    
g_AllowedHeroesDire StringMap();
    
g_AllowedHeroesDire.SetValue("npc_dota_hero_pudge"1);
    
g_AllowedHeroesDire.SetValue("npc_dota_hero_skeleton_king"1);
    
    
g_AllowedHeroesRadiant StringMap();
    
g_AllowedHeroesRadiant.SetValue("npc_dota_hero_puck"1);
    
    
// etc.
}

public 
Action dota_select_hero(int client, const char[] szCommandint argc)
{
    if (
argc && client != && IsClientInGame(client))
    {
        
DotaTeam team view_as<DotaTeam>(GetClientTeam(client));
        
char szHero[64];
        
int dummy;
        
        
GetCmdArg(1szHerosizeof(szHero));

        if (
team == DotaTeam_Radiant)
        {
            if (!
g_AllowedHeroesRadiant.GetValue(szHerodummy))
                return 
Plugin_Handled;
        }
        else if (
team == DotaTeam_Dire)
        {
            if (!
g_AllowedHeroesDire.GetValue(szHerodummy))
                return 
Plugin_Handled;
        }
    }
    
    return 
Plugin_Continue;

Something like this should work, although you're better off putting them in a config file and reading from there, rather than hardcoding in the plugin.
Dude you really help a lot of people, you should get a medal or something, LOL
Cuban_Dota is offline
psychonic

BAFFLED
Join Date: May 2008
Old 02-06-2015 , 13:31   Re: [DOTA2] Block hero pick
Reply With Quote #8

Quote:
Originally Posted by Black-Rabbit View Post
Is there a place that we can download the lastest updated binaries for linux?
Binaries of what?
psychonic is offline
Mathias.
Veteran Member
Join Date: Aug 2010
Location: Canada is my city
Old 02-06-2015 , 16:13   Re: [DOTA2] Block hero pick
Reply With Quote #9

server binary, I don't have dota 2 host on linux. I was just wondering if there were a place that offer up to date binaries on the web for supported game in case that people like me don't have a linux setup or vise versa.

Last edited by Mathias.; 02-06-2015 at 16:14.
Mathias. is offline
psychonic

BAFFLED
Join Date: May 2008
Old 02-06-2015 , 22:53   Re: [DOTA2] Block hero pick
Reply With Quote #10

Quote:
Originally Posted by Black-Rabbit View Post
server binary, I don't have dota 2 host on linux. I was just wondering if there were a place that offer up to date binaries on the web for supported game in case that people like me don't have a linux setup or vise versa.
SteamCMD.
psychonic 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 06:46.


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