Hello people,
Now i'm going to show you how to make a shop ingame so that you can buy stuff with money just by pressing V+4
It's not very easy but i'll try to make a easy tutorial
So lets get started
go take main/iw_06.iwd/ui_mp/wm_quickmessage.menu and drag it on your desktop
open it up there you'll see some buttons you see in game for quickmessages like commands,reponses etc.
here we're going to make a new button which will open our shop
Find this button
right under this code type another code so that it should look something like thisCode:itemDef { name "window" visible 1 rect 16 52 0 0 origin ORIGIN_QUICKMESSAGEWINDOW forecolor 1 1 1 1 textfont UI_FONT_NORMAL textscale .24 textaligny 8 text "@QUICKMESSAGE_3_RESPONSES" decoration } execKey "3" { close quickmessage; open quickresponses }
Now this will show the shop text when you press V but nothing will happen when you press 4 because we need to make another menu to open.Code:itemDef { name "window" visible 1 rect 16 52 0 0 origin ORIGIN_QUICKMESSAGEWINDOW forecolor 1 1 1 1 textfont UI_FONT_NORMAL textscale .24 textaligny 8 text "@QUICKMESSAGE_3_RESPONSES" decoration } execKey "3" { close quickmessage; open quickresponses } itemDef { name "window" visible 1 rect 16 68 0 0 origin ORIGIN_QUICKMESSAGEWINDOW forecolor 1 1 1 1 textfont UI_FONT_NORMAL textscale .24 textaligny 8 text "4. Shop" decoration } execKey "4" { close quickmessage; open shop } itemDef { name "window" visible 1 rect 16 148 0 0 origin ORIGIN_QUICKMESSAGEWINDOW forecolor 1 1 1 1 textfont UI_FONT_NORMAL textscale .24 textaligny 8 text "@QUICKMESSAGE_ESC_EXIT" decoration }
So you just save this wm_quickmessage.menu and make a copy of it..rename the copy to shop.menu you'll have to put this file in ui_mp/scriptmenus/,
in shop.menu all you need is this
For this tutorial i'll show you how to buy max ammo for weaponsCode:#include "ui_mp/menudef.h" #define ORIGIN_QUICKMESSAGETAB 32 224 #define ORIGIN_QUICKMESSAGEWINDOW 32 256 { menuDef { name "shop" visible 0 fullscreen 0 rect 0 0 640 480 focuscolor 1 1 1 1 disablecolor 0 0 0 0 style WINDOW_STYLE_EMPTY onOpen { setDvar cl_bypassMouseInput "1" } onClose { setDvar cl_bypassMouseInput "0" } // WINDOW BACKGROUND itemDef { name "window_background" visible 1 rect 0 0 224 192 origin ORIGIN_QUICKMESSAGEWINDOW style WINDOW_STYLE_FILLED forecolor 1 1 1 1 backcolor 0 0 0 0.7975 decoration } // WINDOW LINES itemDef { name "window_lines" visible 1 rect 3 0 2 187 origin ORIGIN_QUICKMESSAGEWINDOW style WINDOW_STYLE_FILLED backcolor 1 1 1 .125 decoration } itemDef { name "window_lines" visible 1 rect 219 0 2 187 origin ORIGIN_QUICKMESSAGEWINDOW style WINDOW_STYLE_FILLED backcolor 1 1 1 .125 decoration } itemDef { name "window_lines" visible 1 rect 5 0 214 2 origin ORIGIN_QUICKMESSAGEWINDOW style WINDOW_STYLE_FILLED backcolor 1 1 1 .125 decoration } itemDef { name "window_lines" visible 1 rect 3 187 218 2 origin ORIGIN_QUICKMESSAGEWINDOW style WINDOW_STYLE_FILLED backcolor 1 1 1 .125 decoration } // TITLE itemDef { name "title" visible 1 rect 0 0 224 32 origin ORIGIN_QUICKMESSAGETAB style WINDOW_STYLE_FILLED forecolor 1 1 1 1 backcolor 0 0 0 0.7975 type ITEM_TYPE_TEXT text "-=^1ShoP^7=-" textfont UI_FONT_NORMAL textscale .24 textalignx 112 textaligny 24 textalign ITEM_ALIGN_CENTER decoration } itemDef { name "title_quickmessage_gray" visible 1 rect 3 3 218 29 origin ORIGIN_QUICKMESSAGETAB style WINDOW_STYLE_FILLED backcolor 1 1 1 .125 decoration } itemDef { name "window" visible 1 rect 16 20 0 0 origin ORIGIN_QUICKMESSAGEWINDOW forecolor 1 1 1 1 textfont UI_FONT_NORMAL textscale .24 textaligny 8 text "1. Max Ammo -=^1 50 $^7=-" decoration } execKey "1" { scriptMenuResponse "1"; close shop; } itemDef { name "window" visible 1 rect 16 148 0 0 origin ORIGIN_QUICKMESSAGEWINDOW forecolor 1 1 1 1 textfont UI_FONT_NORMAL textscale .24 textaligny 8 text "@QUICKMESSAGE_ESC_EXIT" decoration } } }
now you have to take another file from main , iw_07.iwd/maps/mp/gametypes/_menus.gsc
At the end of this file you'll see
here you have to edit it so it'll be likeCode:{ if(menu == game["menu_quickcommands"]) maps\mp\gametypes\_quickmessages::quickcommands(response); else if(menu == game["menu_quickstatements"]) maps\mp\gametypes\_quickmessages::quickstatements(response); else if(menu == game["menu_quickresponses"]) maps\mp\gametypes\_quickmessages::quickresponses(response); }
This is where you call the shop menu so lets go and add some maxammo scriptingCode:{ if(menu == game["menu_quickcommands"]) maps\mp\gametypes\_quickmessages::quickcommands(response); else if(menu == game["menu_quickstatements"]) maps\mp\gametypes\_quickmessages::quickstatements(response); else if(menu == game["menu_quickresponses"]) maps\mp\gametypes\_quickmessages::quickresponses(response); else if(menu == game["menu_shop"]) maps\mp\gametypes\_quickmessages::shop(response); }
take maps/mp/gametypes/_quickmessages.gsc from main (iw_07.iwd)
Here we're gonna precache our shop so at the start you'll see other menus precached
here we have to make precache of shop so it should look like this
now all we need to do is make a maxammo scriptCode:init() { game["menu_quickcommands"] = "quickcommands"; game["menu_quickstatements"] = "quickstatements"; game["menu_quickresponses"] = "quickresponses"; game["menu_shop"] = "shop"; precacheMenu(game["menu_quickcommands"]); precacheMenu(game["menu_quickstatements"]); precacheMenu(game["menu_quickresponses"]); precacheMenu(game["menu_shop"]); precacheHeadIcon("talkingicon"); }
so find this function
above this we're going to put our shop scriptCode:doQuickMessage(soundalias, saytext)
So thats it for shop...try it ingameCode:shop(response) { switch(response) { case "1": wepcurrent = self getcurrentweapon(); if(self.money >= 50) { self.money-=50; self givemaxammo(wepcurrent); self iprintlnbold("^1-50"); self iprintlnbold("-=^1Max ammO^7=-"); } else if(self.money < 50) { self iprintlnbold("-=^1Not enough moneY^7=-"); } break; } }
Any questions just reply here under



Reply With Quote