Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds

Members Online

»
0 Active | 7 Guests
Online:

LATEST FORUM THREADS

»
warfare
CoD4 Map + Mod Releases
Voting menu on maps
CoD+UO General
Hauling 911
CoDBO3 General

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty 4
Category: CoD4 Scripting
Scripting and coding with Call of Duty 4.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername, novemberdobby
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked subscribe
Author Topic: Map vote menu help.
xkiillah
General Member
Since: Feb 27, 2012
Posts: 4
Last: Jan 25, 2013
[view latest posts]
Level 0
Category: CoD4 Scripting
Posted: Friday, Jan. 25, 2013 08:04 am
Ok, I made a menu and was wondering how I would get it to show all the maps in the map rotation using one dvarstring.

.Menu file
Code:
#include "ui/menudef.h"
#include "ui_mp/common_macro.inc"

#include "ui_mp/menustyle.inc"
#include "ui_mp/choices_setup_teams.menu"

{
        menuDef
        {
            name         "mapvote"
            rect         0 0 640 480
            focuscolor   COLOR_FOCUSED
            style        WINDOW_STYLE_EMPTY
            blurWorld    5.0
            onEsc        { play "mouse_click"; close self; }

            // Background Overlay
            itemDef
            {
            	style          WINDOW_STYLE_FILLED
            	rect           0 0 240 480 HORIZONTAL_ALIGN_FULLSCREEN VERTICAL_ALIGN_FULLSCREEN
            	backcolor      0 0 0 0.75
            	//border         1
            	//bordersize     1
            	//bordercolor    1 1 1 0.15
            	visible        1
            	decoration
            }

            // Gradient Top
            itemDef
            {
            	style          WINDOW_STYLE_SHADER
            	rect           0 0 240 75 HORIZONTAL_ALIGN_FULLSCREEN 0
            	background     "gradient_top"
            	visible        1
            	decoration
            }

            // Gradient Bottom
            itemDef
            {
            	style          WINDOW_STYLE_SHADER
            	rect           0 405 240 75 HORIZONTAL_ALIGN_FULLSCREEN 0
            	background     "gradient_bottom"
            	visible        1
            	decoration
            }

            #undef   CHOICE_HORIZONTAL_ALIGN

            #define  CHOICE_HORIZONTAL_ALIGN HORIZONTAL_ALIGN_CENTER


            #define  TITLES_ORIGIN 32

            #define  POSITION_Y( yoffset )     (TITLES_ORIGIN + yoffset)


            // Title
            itemDef
            {
            	type           ITEM_TYPE_TEXT
            	rect           -280 TITLES_ORIGIN 0 0 HORIZONTAL_ALIGN_CENTER VERTICAL_ALIGN_TOP
            	text           "Map List"
            	textfont       UI_FONT_NORMAL
            	textscale      TEXTSIZE_SMALL
            	textstyle      ITEM_TEXTSTYLE_SHADOWED
            	textAlign      ITEM_ALIGN_MIDDLE_CENTER
            	visible        1
            	decoration
            }

            // Map List Box
            itemDef
            {
            	name           maplist
            	type           1
            	rect           -300 48 200 240 HORIZONTAL_ALIGN_CENTER VERTICAL_ALIGN_TOP
            	border         1
            	bordersize     1
            	bordercolor    1 1 1 0.15
            	visible        1
            	mouseEnter     { play "mouse_over"; setitemcolor maplist bordercolor 1 1 1 0.55 }
            	mouseExit      { setitemcolor maplist bordercolor 1 1 1 0.15 }
            	decoration
            }

            // Map Names
            itemDef
            {
            	name            map1
            	type            1
            	style           WINDOW_STYLE_FILLED
            	rect            -260 60 32 22 HORIZONTAL_ALIGN_CENTER VERTICAL_ALIGN_TOP
            	exp text        (dvarstring(ui_map_name));
            	textscale       TEXTSIZE_SMALL
            	textstyle       ITEM_TEXTSTYLE_SHADOWED
            	textAlign       ITEM_ALIGN_MIDDLE_CENTER
            	visible         1
            	mouseEnter      { play "mouse_over"; }
            	//action          { play "mouse_click"; }
            }
        }
}



.Gsc file
Code:
#include maps\mp\gametypes\_hud_util;

#include common_scripts\utilityl

init()
{
	precacheMenu("mapvote");
    // Map Vote
	maps = getDvar("sv_maprotation");
	maps = strTok(maps, " ");
	level.mapslist = [];
	for(i=0; i<maps.size; i++)
		if(maps[i] == "map")
			level.mapslist[level.mapslist.size] = maps[i+1];

	thread onPlayerConnect();
}

onPlayerConnect()
{
	for(;;)
	{
		level waittill("connected", player);

		player thread mapnames();
	}
}

mapname()
{
	self endon("disconnect");
	i=0;
	self setClientDvar("ui_map_name", level.maplist[i]);
}
Share |
Restricted Access Topic is Locked subscribe
MODSonline.com Forums : Call of Duty 4 : CoD4 Scripting

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»