Archived copy of war3source.com, the War3Source forum (2009–2020), rebuilt from the Internet Archive by wc3mods.net. This page was captured on 2012-09-22 (original capture). Forum · All archived topics · Wiki · Bug tracker · Blog
Chat

War3:Source
September 21, 2012, 10:38:19 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Download: http://war3source.com/index.php?board=9.0
What is War3Source?: http://war3source.com/index.php?topic=200.0
Sample Stats: http://war3source.com/war3stats
Steam Community Group: http://steamcommunity.com/groups/war3source
War3Source SVN Checkout: http://ownageclan.com/svn/war3source/
War3Source servers: http://www.game-monitor.com/search.php?vars=war3_version=
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Faster changerace  (Read 94 times)
M.A.C.A.B.R.A
Newbie
*
Posts: 20



View Profile WWW
« on: June 26, 2012, 02:50:08 AM »

I think race changing takes too long. And it can probably easily be shortened. Correct me if I'm wrong.
Now you need to type "changerace" and select correct race from the list. It's not good solution if you have many races on server.

How about adding simple functionality: changerace <race_name> ?

I don't know where the hell is called command changing race in code (cant find it), but maybe it can be done just like that?

You just need to find the race using the argument:
Code:
new String:racenamearg[64]; // does race name have max length? I put there 64 prophylactically
GetCmdArg(1, racenamearg, sizeof(racenamearg)); // copying argument to our string
new RacesCounter = 0; // counter of races, which have substring (our argument) in name
new RaceIndex = -1; // race index

for(new i = 1; i <= War3_GetRacesLoaded(); i++) // finding valid race
{
new String:racenametmp[64]; // races names
War3_GetRaceName(i,racenametmp,sizeof(racenametmp));
if(StrContains(racenametmp, racenamearg, false) != -1) // if substring from argument found in race name
{
RacesCounter++;
RaceIndex = i;
}

if(RacesCounter > 1) // if substring from argument found in more than one race name
{
RaceIndex = -2; // error, break the loop
break;
}
}

// messages
if(RaceIndex == -1)
{
// Race not found.
return Plugin_Handled;
}
else if(RaceIndex == -2)
{
        // More than one race found. Player need to type specific part of racename
return Plugin_Handled;
}

War3_SetRace(client,RaceIndex); // race change

If it is so simple, it probably would have been done long time ago, but it doesn't hurt to check.
I don't know that can it be done like that,  but this functionality would be helpful Smiley

//Edit: Why is this topic sticked? Tongue
« Last Edit: July 03, 2012, 09:52:32 AM by M.A.C.A.B.R.A » Logged

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!