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

War3:Source
January 24, 2013, 09:55:40 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: [ADDON] Private Race Access  (Read 318 times)
Remy Lebeau
Full Member
***
Posts: 172


View Profile
« on: December 22, 2012, 03:39:22 AM »

On our server we create and give people private races.  I've created a little addon that manages this system, so that it can easily be updated through a .cfg file (Thanks to Necavi for a major overhaul) - This plugin also creates pretty blue rings around players who spawn on a private race.

INSTALLATION

* Compile the .sp, include in your usual plugins location.
* Modify the .cfg to suit your needs (instructions are in the file itself).  It needs to be located in sourcemod/configs

IN GAME USAGE

Commands
- war3_reload_private_races: reloads the .cfg file
- war3_add_player_to_race <race short name> <player steam ID> <player name>
- war3_remove_player_from_race <race short name> <player steam ID>

Cvars
- war3_private_race_min_players: Disallows players from selecting private races when the server has fewer than this many players (default 2)

Note: All commands require the RCON flag


CHANGELOG:

v1
- OLD system that just force changed onto undead

v2
- updated to use deny events to not allow the player to change at all

v3.0.0
- re-written by necavi to include admin commands to manage the plugin, as well as reducing the amount it loads from the config file

v3.0.1
- bugfix, removed a false file load warning.
- changed the plugin URL to war3source.com - multiple authors means we might as well bring the credit back to here.
« Last Edit: December 27, 2012, 09:56:34 PM by Remy Lebeau » Logged
Ownz
Developer
Administrator
Hero Member
*****
Posts: 2169



View Profile WWW
« Reply #1 on: December 22, 2012, 09:41:02 AM »

so every race needs an entry?

I think the easier way is to have 1 single steamid and it list all the races following it
Logged

DarkEnergy
Remy Lebeau
Full Member
***
Posts: 172


View Profile
« Reply #2 on: December 22, 2012, 03:07:46 PM »

Only the races that you want to be private need an entry.  It works quite well this way, since you can see at a glance who has access to which race.

The things is that most of the time people DON'T have access to multiple private races (since they are private), but you might have 4 or 5 people with access to one private race.  So I think it works best as it is.

Again, races that are not private don't need an entry in this .cfg

Logged
Revan
Sr. Member
****
Posts: 346



View Profile
« Reply #3 on: December 22, 2012, 05:58:11 PM »

That's cool, I always wanted such a thing. Now I can trash my ueber long w3cvar with tons of steamid's Cheesy
Logged

#war3source
Necavi
Sr. Member
****
Posts: 297


View Profile
« Reply #4 on: December 26, 2012, 04:46:17 AM »

I took the liberty of nearly completely rewriting this plugin, here is a (rough) list of changes:
- No longer reads the keyvalue from disk each time someone attempts to change race (slow even with FEW players in the kv, let alone a LOT)
- Added command war3_reload_private_races: reloads and parses the private race keyvalue
- Added command war3_add_player_to_race: Adds a player to a race's permission system - will add the race's key if it doesn't exist yet.
- Added command war3_remove_player_from_race: Removes a player from a race's permission system - will remove the race's key if it is the last permission node left (keep a dummy key such as STEAM_PRIVATE around if you don't want this)
- Added Convar war3_private_race_min_players: Disallows players from selecting private races when the server has fewer than this many players
- Modified restrict message to read the war3_clanurl cvar instead of being hard coded to your community's name
- Renamed a few variables
- Made the is private race variable reset on player connect (to avoid the possibility of extra messages)
- Renamed the config to war3source_privateraces.cfg
- Made comparisons use raceID's instead of race short names (greatly speeding everything up even more)
Note: All commands require the RCON flag
Note: the add/remove commands both reload the config first (to prevent issues).

Overall quite a bit more powerful and generally a more useful plugin, hope you enjoy!
(Partially rewrote because I was playing on your server a bit and this system didn't seem up to par)
« Last Edit: December 26, 2012, 06:25:43 AM by Necavi » Logged

Remy Lebeau
Full Member
***
Posts: 172


View Profile
« Reply #5 on: December 27, 2012, 02:29:50 PM »

Good work :-)

This was my very first attempt at parsing a cfg file, so I'm more than happy with how you've updated it.  I guess to allow proper customisation it should also include a cvar to enable/disable the blue rings when you spawn on a custom race.
Logged
Remy Lebeau
Full Member
***
Posts: 172


View Profile
« Reply #6 on: December 27, 2012, 09:40:41 PM »

Update OP with Necavi's version + bugfix.
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!