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

KZ Necro Cup v2.0


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Gameplay        Approver:   Hawk552 (427)
trooper [kz-na]
Junior Member
Join Date: Jan 2009
Location: Arizona
Old 01-31-2009 , 22:39   KZ Necro Cup v2.0
Reply With Quote #1

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
KZ Necro Cup v2.0
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

A KZ Cup is a timed race between two or more players. Participants must simultaneously race through a map; the player who is farthest when the cup time expires is declared the winner.

This plugin facilitates running automated cups on public servers. A cup will only affect players who choose to participate; other players can use the server normally while a cup is in progress.

-=-=-=-=-=-=-=-=-=-=
Public Cups:
-=-=-=-=-=-=-=-=-=-=
If a cup is not running then any player can start one with the /votecup command. Other players are then given a short period of time to join the cup using the /joincup command. When the join period expires the cup participants are placed at the starting position. After a start countdown, players are released and the race begins.

During the race, afk participants are automatically moved back to the start. Participants will be prevented from attempting to cheat using 'hook' or 'gocheck' type commands. There must be at least two players for a cup; if the number of participants drops below this number the cup will be automatically canceled.

The end countdown starts after the cup time expires. A winner is determined and recorded to the public scoreboard. A short tie-breaker round will be held in the event of a tie.

-=-=-=-=-=-=-=-=-=-=
Official Cups:
-=-=-=-=-=-=-=-=-=-=
Admin can officialize the results from a previous cup and record the score to the official scoreboard. An official cup is run like a public cup except an admin is present to observe the race and verify the result.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Public Commands
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Command: say /cup
Saying /cup will display useful information about the cup (cup time remaining, timeleft until cup start, etc).

Command: say /cuphelp
Saying /cuphelp will display a page explaining what a kz cup is and how to use the public commands.

Command: say /cupwho
Saying /cupwho will display a roster of players who are either currently competing in a cup or have joined the upcoming cup.

Command: say /votecup
Saying /cupvote will start a new cup if one is not already in progress and will add you to the cup if currently in the join phase. This command has no effect during a race; players will be told to wait for the next cup.

Command: say /joincup
Saying /joincup has the same effect as /votecup.

Command: say /cupwins
Saying /cupwins will display the number of cup wins you have. These wins are only registered if a cup official (admin) records the results.

Command: say /pubcupwins
Saying /pubcupwins will display the number of cup wins you have. These are wins automatically recorded at the end of every cup.

Command: say /cup15
Saying /cup15 will display the 15 players with the most cup wins participating in official cups.

Command: say /pubcup15
Saying /pubcup15 will display the 15 players with the most cup wins participating in public cups.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Admin Commands
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Access Levels: Set the value of ADMIN_CUP_RACE, ADMIN_CUP_MARKERS, and
ADMIN_CUP_SCORES at the top of constants declarations.

Default Values:
ADMIN_CUP_RACE ~ ADMIN_CVARS
ADMIN_CUP_MARKERS ~ ADMIN_RCON
ADMIN_CUP_SCORES ~ ADMIN_IMMUNITY

Command: say /cupmenu
Access Level: ADMIN_CUP_RACE
Saying /cupmenu will display a menu of admin cup commands.

Command: say /startcup
Access Level: ADMIN_CUP_RACE
Saying /startcup will start a new cup if one is not already started and allow players to join. The admin who runs this command will not be added to the cup. Issue this command during the join phase to skip immediately to the race.

Command: say /endcup
Access Level: ADMIN_CUP_RACE
Saying /endcup will immediately bring a running cup to a close. You can also issue this command during the join phase to cancel a cup before the race begins.

Command: say /restartcup
Access Level: ADMIN_CUP_RACE
Saying /restartcup will restart a race that is currently in progress. Players will be teleported back to the start position and the race will begin again.

Command: say /resetcup
Access Level: ADMIN_CUP_RACE
Saying /resetcup will reset the cup plugin to its default state. Use this command if something unexpected or bad happens for some reason.

Command: say /recordcup
Access Level: ADMIN_CUP_SCORES
Saying /recordcup will officialize the results of the last race. The cup winner's score will be incremented and recorded to the scores file. Run this command after a cup has ended; running it during a cup will officialize results from the previous race. This command can be used only once per cup.

Command: say /unrecordcup
Access Level: ADMIN_CUP_SCORES
Saying /unrecordcup will reverse a previously issued /recordcup command. The cup winner's score will be reverted to its previous value. This command can be issued only once per cup where results were made official.

Command: say /clearcup15
Access Level: ADMIN_CUP_SCORES
Saying /clearcup15 will clear the official cup15 scores. A backup of the scoreboard is created before scores are cleared.

Command: say /clearpub15
Access Level: ADMIN_CUP_SCORES
Saying /clearpub15 will clear the public cup15 scores. A backup of the scoreboard is created before scores are cleared.

Command: say /loadcupmarkers
Access Level: ADMIN_CUP_MARKERS
Saying /loadcupmarkers will load the current map's cup markers from file.

Command: say /savecupmarkers
Access Level: ADMIN_CUP_MARKERS
Saying /savecupmarkers will save the currently loaded cup markers to file. Issue this command after creating new cup markers.

Command: say /showcupmarkers
Access Level: ADMIN_CUP_MARKERS
Saying /showcupmarkers will make the cup markers visible. Cup markers will only be visible after issuing this command or when creating new markers.

Command: say /hidecupmarkers
Access Level: ADMIN_CUP_MARKERS
Saying /hidecupmarkers will remove the cup markers from view. Cup markers are hidden by default but become visible when creating new markers or after issuing /showcupmarkers.

Command: cup_setmarker
Access Level: ADMIN_CUP_MARKERS
Console command cup_setmarker will place a marker at your current position.

Command: cup_removemarker
Access Level: ADMIN_CUP_MARKERS
Console command cup_removemarker will remove the last cup marker created (cup marker with largest id).

Command: cup_nearestmarker
Access Level: ADMIN_CUP_RACE
Console command cup_nearestmarker will display the id of the nearest marker. Use this command to lookup marker ids.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
CVARs:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

cvar: cup_time (180)
The value of this cvar sets the time a cup match will last (in seconds). Set a unique value for each map.

cvar: cup_jointime (120)
This value of this cvar sets the period of time players can join a cup after one has been started (in seconds).

cvar: cup_advertise_interval (30)
The value of this cvar sets the period of time between each cup advertisement (in seconds). A cup will advertise itself during the join phase.

cvar: cup_timeleft_interval (60)
The value of this cvar determines how often the remaining time of a running cup is announced.

cvar: cup_startcount (10)
The value of this cvar determines the length of the start countdown. There will be a verbal countdown for all values less than equal 10.

cvar: cup_endcount (10)
The value of this cvar determines the length of the end countdown. There will be a verbal countdown for all values less than equal 10.

cvar: cup_public (1)
The value of this cvar determines if the public can start a cup using /votecup. A value of 1 opens cups to the public, a value of 0 restricts starting new cups for admin.

cvar: cup_singleplayer (0) (DEBUG: compile with INCLUDE_DEBUG 1)
The value of this cvar determines if single-player cups are permitted. A value of 1 allows single-player cups, a value of 0 requires at least 2 players or the cup will be canceled. This is useful for testing and debugging; in practice there is no reason to allow single player races.

cvar: cup_tiedistance (50)
The value of this cvar determines how many cup markers must lay ahead of tied players in order for them to start the tie-breaker at their current position. If there are less than this number of markers then tied players will be started at the first marker.

cvar: cup_tietime (60)
The value of this cvar determines how long a tie-breaker round will last (in seconds).

cvar: cup_minmarkers (15)
The value of this cvar determines the minimum number of markers that must be set before a cup can be started.

cvar: cup_checkafk (1)
The value of this cvar determines if afk participants are moved back to the start position. A value of 1 will check for afks, a value of 0 turns afk checking off.

cvar: cup_afktime (8)
The value of this cvar determines how long a cup participant can remain afk before being transported back to the start.

cvar: cup_triggerend (15)
The value of this cvar should be a valid cup marker id. Set a unique value for each map. The first player to reach this marker will trigger the end of the cup. Players must pass within 32 units of the marker; choose cup markers that are unavoidable and at least cup_endcount seconds from the last marker.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Special thanks to
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

* Necro for coding and donating the prototype (v1) version.
* dropsys for coming up with the idea, defining requirements, and creating the prepackaged cup data.
* DKrAyZie for providing his server for testing and debugging.
* gangien for the occasional advice and feedback.
* and the many others who participated in testing or offered suggestions...

This plugin was created for KZ communities everywhere.
This plugin is especially dedicated to the great community at KZ North America (http://www.kz-na.com).

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Bug Fixes, Feature Requests, and Support
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Send bug fixes and other requests to trooper at [email protected]. When submitting bug reports please be as detailed as possible. If I can't reproduce the bug it won't get fixed.

Are you interested in multilingual support? Contact trooper if you would like to translate messages into your native language.



Please refer to the included readme file for complete documentation.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
ChangeLog
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

v2.01 (major bugfix) - 2/11/09
* Fixed a serious bug that caused players to fail to unfreeze at the end of cups.
* Preliminary support for a 'manual mode' allowing more control over cup outcome.
* Added blocking for a more comprehensive list of 'cheat' commands during cups (aliases of gocheck).
* Some of the fixes suggested by the moderator (the rest will follow in the next bugfix).

v2.0 (initial release) - 1/31/09

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Attached Files
File Type: zip kz_necrocup_configs.zip (187.8 KB, 1781 views)
File Type: zip kz_necrocup_v2.01.zip (33.4 KB, 1748 views)
File Type: sma Get Plugin or Get Source (kz_necrocup.sma - 2999 views - 95.1 KB)

Last edited by trooper [kz-na]; 02-11-2009 at 12:43. Reason: added bugfix v2.01; added data package; changelog & description corrections
trooper [kz-na] is offline
Send a message via AIM to trooper [kz-na]
trooper [kz-na]
Junior Member
Join Date: Jan 2009
Location: Arizona
Old 01-31-2009 , 22:49   Re: KZ Necro Cup v2.0
Reply With Quote #2

A 'ready-to-go' collection of cup data files for KZ maps will be available soon. Also, see the readme (see .zip) for instructions for creating your own data files.
trooper [kz-na] is offline
Send a message via AIM to trooper [kz-na]
IneedHelp
Veteran Member
Join Date: Mar 2007
Location: Argentina
Old 01-31-2009 , 23:07   Re: KZ Necro Cup v2.0
Reply With Quote #3

I'll test it soon, finally the first public plugin for cups, Thanks.
__________________
IneedHelp is offline
minimiller
Veteran Member
Join Date: Aug 2007
Location: United Kingdom
Old 02-01-2009 , 11:28   Re: KZ Necro Cup v2.0
Reply With Quote #4

Good job!
I started work on a KZCup plugin ages ago, but i never finished it

Only 1 problem,
when i Dload the source code, its COMPLETELY unreadable
__________________
minimiller is offline
Send a message via MSN to minimiller
trooper [kz-na]
Junior Member
Join Date: Jan 2009
Location: Arizona
Old 02-01-2009 , 14:42   Re: KZ Necro Cup v2.0
Reply With Quote #5

Quote:
Originally Posted by minimiller View Post
Good job!
I started work on a KZCup plugin ages ago, but i never finished it

Only 1 problem,
when i Dload the source code, its COMPLETELY unreadable
Sounds like you are experiencing http://en.wikipedia.org/wiki/Newline#Common_problems. The source should display correctly in most modern text editors (notepad does not count). My favorite is gvim but wordpad should do.
trooper [kz-na] is offline
Send a message via AIM to trooper [kz-na]
minimiller
Veteran Member
Join Date: Aug 2007
Location: United Kingdom
Old 02-01-2009 , 15:13   Re: KZ Necro Cup v2.0
Reply With Quote #6

yea its fine :p
i copied and pasted into pawn studio and it sorted it out
(Y)
__________________
minimiller is offline
Send a message via MSN to minimiller
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 02-05-2009 , 22:36   Re: KZ Necro Cup v2.0
Reply With Quote #7

There are a few mistakes and optimizations that can be made, however it is acceptable.

If you would like any information regarding possible adjustments you could make or things you could do to make this better, please feel free to post here or PM me.

Approved.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 02-08-2009 , 15:11   Re: KZ Necro Cup v2.0
Reply With Quote #8

Changes have been requested via PM.

PHP Code:
#define MAIN_MENU_KEYS (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9) 
Use MENU_KEY_<x>.

PHP Code:
   if (access(idADMIN_CUP_MARKERS))
   {
      
show_markers();
   } 
Use cmd_access().

PHP Code:
      new Float:origin[3];
      
get_player_origin(idorigin); 
Inconsistent use of HN.

PHP Code:
      if (>= 15)
         break;   
// display at most 15 items 
Unnecessary extra code. Include this in the for loop as an added condition.

PHP Code:
is_user_connected(id) && is_user_alive(id
Unnecessary extra check. is_user_alive() checks for is_user_connected().

PHP Code:
   #if INCLUDE_GLOW
      
players_exec(CMD_GLOW_CUP);
   
#endif 
Bad form. Preprocessor conditions should be at the same level as the code they encapsulate or they should not be tabbed out at all.

PHP Code:
static tEntityInSphere = -1
Big problem. If this code is run more than once, it won't work the second time.

PHP Code:
            p0 position[0];
            
p1 position[1];
            
p2 position[2]; 
Unnecessary reassigning. Setting the memory like this is slower than the redirection of accessing the array twice.

PHP Code:
if ((p0 == oldPosition[0]) && (p1 == oldPosition[1]) && (p2 == oldPosition[2])) 
You should use epsilon format for these as they may be very slightly off.

PHP Code:
formatgszCupScoreFilesizeof(gszCupScoreFile), gszCupPathPScoresdirBasegszCupPath ); 
Possible buffer overflow. Use sizeof - 1 or charsize.

PHP Code:
      do {
         
fLine read_file(szFilenamefLinetmpSpacefSizetxtLen);
         if (
fLine != 0)
         {
            
pos += format(cssValues[pos], len-pos"%s"tmpSpace);
         }
      } while (
fLine != 0); 
Seriously flawed logic which creates great inefficiency. Use while(read_file()).

PHP Code:
   for (id 1id<MAX_PLAYERS; ++id)
   {
      if (
id != -1)
      { 
Bad form. Use get_players().

You said something about being worried about your loops, but they look fine. You'd need way, way more than what you're doing to even drop the server framerate by 1 or 2, so go ahead and add whatever it is you wanted to.

For the most part, this plugin is very well done, especially for your first project in Pawn. This is a real testament to making stuff dynamic in terms of how much you use constants and globals, although some of them unnecessarily use extra memory since they are only accessed once or twice but are retained anyway. If you're looking to cut down on memory usage, I'd tell you to get rid of some of the global variables.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
trooper [kz-na]
Junior Member
Join Date: Jan 2009
Location: Arizona
Old 02-09-2009 , 11:04   Re: KZ Necro Cup v2.0
Reply With Quote #9

Thanks Hawk. This is a good list to work with. I'll try to have these types of issues fixed with the next version.
trooper [kz-na] is offline
Send a message via AIM to trooper [kz-na]
Necro
Member
Join Date: Apr 2006
Old 02-09-2009 , 22:18   Re: KZ Necro Cup v2.0
Reply With Quote #10

GJ all, glad to see this got finished!
__________________
Necro 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 09:11.


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