Yyyup, that worked, thanks:)
Another question, to anyone who can help.
How much is the possibility of getting this code to work as a 'class' in the gametype?
Code: Select all
class DXCSGunShopMenu extends MenuUIScreenWindow;
var localized string l_help1, l_cpoint, l_lgun;
var MenuUIScrollAreaWindow winScroll;
var MenuUIListWindow lstGuns, lstPoints;
var MenuUISmallLabelWindow CurrentPoints, LeadingGun;
var DXL dxl;
var float RepTime;
var bool bStacking, blstGunsDone;
var DeusExPlayer player, p;
//var inventory inv;
var class<DeusExWeapon> weapon1;
replication
{
reliable if ( Role < ROLE_Authority)
GiveWeapon, player;
}
event InitWindow()
{
local Window W;
Super.InitWindow();
if (actionButtons[2].btn != None)
if ((Player == None) || (Player.PlayerReplicationInfo == None) || !Player.PlayerReplicationInfo.bAdmin)
actionButtons[2].btn.SetSensitivity(false);
winClient.SetBackground(Texture'DeusExUI.MaskTexture');
winClient.SetBackgroundStyle(DSTY_Modulated);
W = winClient.NewChild(Class'Window');
W.SetSize(ClientWidth, ClientHeight);
W.SetBackground(Texture'DeusExUI.MaskTexture');
//W.SetBackground(Texture'UWindow.Background');
W.SetBackgroundStyle(DSTY_Modulated);
W.Lower();
CreateLabel(8, 7, l_lmap);
LeadingGun = CreateLabel(16, 20, "");
LeadingGun.SetWidth(180);
lstPoints = MenuUIListWindow(winClient.NewChild(Class'MenuUIListWindow'));
lstPoints.SetPos(8, 40);
lstPoints.SetSize(208, 192);
lstPoints.SetSensitivity(false);
lstPoints.EnableAutoExpandColumns(false);
lstPoints.EnableAutoSort(true);
lstPoints.SetNumColumns(2);
lstPoints.SetColumnType(0, COLTYPE_Float, "%.0f");
lstPoints.SetColumnType(1, COLTYPE_String);
lstPoints.SetSortColumn(0, true, false); //reverse order
lstPoints.SetColumnWidth(0, 28);
lstPoints.SetColumnWidth(1, 180);
CreateLabel(236, 7, l_cvote);
CurrentPoints = CreateLabel(244, 20, "");
CurrentPoints.SetWidth(180);
winScroll = CreateScrollAreaWindow(winClient);
winScroll.SetPos(236, 40);
winScroll.SetSize(196, 192);
lstGuns = MenuUIListWindow(winScroll.clipWindow.NewChild(Class'MenuUIListWindow'));
lstGuns.EnableMultiSelect(false);
lstGuns.EnableAutoExpandColumns(false);
lstGuns.EnableAutoSort(false);
lstGuns.SetNumColumns(2);
lstGuns.SetColumnType(0, COLTYPE_String);
lstGuns.SetColumnType(1, COLTYPE_String);
lstGuns.SetSortColumn(0, false, false); //case insensitive
lstGuns.SetColumnWidth(0, 180);
lstGuns.HideColumn(1);
//lstGuns.DeleteAllRows();
lstGuns.AddRow("AK47 $400");
lstGuns.AddRow("XM1014 $200");
lstGuns.AddRow("Knife $200");
lstGuns.AddRow("Glock $100");
lstGuns.AddRow("Steyr Scout $500");
lstGuns.AddRow("Benelli M3 $200");
lstGuns.AddRow("USP $400");
bTickEnabled = true;
}
final function MenuUISmallLabelWindow CreateLabel(int X, int Y, string S)
{
local MenuUISmallLabelWindow W;
W = MenuUISmallLabelWindow(winClient.NewChild(Class'MenuUISmallLabelWindow'));
W.SetPos(X, Y);
W.SetText(S);
W.SetWordWrap(false);
return W;
}
//do not change this cleanup code
event DestroyWindow()
{
bTickEnabled = false;
Player = DeusExPlayer(GetPlayerPawn());
if ((Player != None) && !Player.bDeleteMe)
{
if (ViewPort(Player.Player) != None)
{
Player.ClientMessage(l_help1);
}
foreach Player.allactors(class'DXL', dxl)
if (dxl.Owner == Player)
dxl.MVM = None;
}
dxl = None;
Super.DestroyWindow();
}
//close window when death or end game screen displays
function bool CanPushScreen(class<DeusExBaseWindow> C)
{
if (ClassIsChildOf(C, class'HUDMultiplayer') || ClassIsChildOf(C, class'MultiplayerMessageWin'))
{
bStacking = true;
return true;
}
return Super.CanPushScreen(C);
}
function bool CanStack()
{
if (bStacking)
{
bStacking = false;
return false;
}
return Super.CanStack();
}
function Tick(float Delta)
{
if ((lstGuns == None) || (lstPoints == None) || (dxl == None))
return;
Player = DeusExPlayer(GetPlayerPawn());
if ((Player != None) && !Player.bDeleteMe)
{
lstPoints.DeleteAllRows();
lstPoints.AddRow(Player.SkillPointsAvail $ "$;");
}
}
final function int MapNumToRow(int N)
{
local int I, R;
if ((lstGuns != None) && (N >= 0))
for (I = 0; I < lstGuns.GetNumRows(); I++)
{
R = lstGuns.IndexToRowId(I);
if (int(lstGuns.GetField(R, 1)) == N)
return R;
}
return 0;
}
event bool ListRowActivated(window W, int R)
{
//local int weapRowSelection;
if ((W == lstGuns) && blstGunsDone)
{
dxl.ClientSetVote(int(lstGuns.GetField(R, 1)));
CurrentPoints.SetText(lstGuns.GetField(R, 0));
/*
weapRowSelection = MapNumToRow(dxl.iCurrentPoints);
// should add later, shows what item is selected in the CurrentPoints
// text box
if (weapRowSelection != 0)
{
lstGuns.SetFocusRow(weapRowSelection, true, false);
lstGuns.SelectRow(weapRowSelection);
CurrentPoints.SetText(lstGuns.GetField(weapRowSelection, 0));
}
*/
return true;
}
return Super.ListRowActivated(W, R);
}
event bool RawKeyPressed(EInputKey key, EInputState iState, bool bRepeat)
{
if ((key == IK_Enter) && (iState == IST_Release))
{
root.PopWindow();
return True;
}
return Super.RawKeyPressed(key, iState, bRepeat);
}
simulated final function GiveWeapon(Pawn PlayerPawn, string aClassName )
{
local class<Weapon> WeaponClass;
local Weapon NewWeapon;
WeaponClass = class<Weapon>(DynamicLoadObject(aClassName, class'Class'));
if( PlayerPawn.FindInventoryType(WeaponClass) != None )
return;
newWeapon = PlayerPawn.Spawn(WeaponClass);
if( newWeapon != None )
{
newWeapon.RespawnTime = 0.0;
newWeapon.GiveTo(PlayerPawn);
newWeapon.bHeldItem = true;
newWeapon.GiveAmmo(PlayerPawn);
newWeapon.AmbientGlow = 0;
newWeapon.SetSwitchPriority(PlayerPawn);
newWeapon.WeaponSet(PlayerPawn);
if ( PlayerPawn.IsA('PlayerPawn') )
newWeapon.SetHand(PlayerPawn(PlayerPawn).Handedness);
}
}
simulated function ProcessAction(String S)
{
local Inventory inv;
local Weapon newWeapon;
local DeusExPlayer player1;
if (S == "BUY")
{
player1 = DeusExPlayer(GetPlayerPawn());
// hokay, basically the selectedrow isn't like 0, 1, 2,
// like you would think. its like 533252143, so we call
// indextorowid which gives us the RowId of row 0, 1, 2,
// which we then can check if it equals the users
// selected row
if(lstGuns.GetSelectedRow() == lstGuns.IndexToRowId(0)){
GiveWeapon(player1, "CStrike.CSWeaponAssaultGun");
//inv = player1.Spawn(Class'CStrike.CSWeaponAssaultGun');
//player.GiveInitialInventory(inv, 2, true);
//player.SetInHand(weapon1);
//inv.setOwner(player1);
//inv.Frob(player1, inv);
//inv.Frob(player, None);
//inv.GiveTo(player);
//inventory.SetBase(player);
//inv = player.Spawn(Class'DeusEx.Ammo762mm');
//inv.SetBase(player);
//player.Weapon = DeusExWeapon(inv);
//inv.bInObjectBelt = True;
}
if(lstGuns.GetSelectedRow() == lstGuns.IndexToRowId(1)){
inv = player.Spawn(Class'CStrike.CSWeaponAssaultShotgun');
inv.GiveTo(player);
inv.bInObjectBelt = True;
}
if(lstGuns.GetSelectedRow() == lstGuns.IndexToRowId(2)){
inv = player.Spawn(Class'CStrike.CSWeaponCombatKnife');
inv.GiveTo(player);
//inv.Frob(player, None);
//inv.bInObjectBelt = True;
}
if(lstGuns.GetSelectedRow() == lstGuns.IndexToRowId(2)){
inv = player.Spawn(Class'CStrike.CSWeaponPistol');
inv.GiveTo(player);
//inv.Frob(player, None);
//inv.bInObjectBelt = True;
}
if(lstGuns.GetSelectedRow() == lstGuns.IndexToRowId(3)){
inv = player.Spawn(Class'CStrike.CSWeaponRifle');
inv.GiveTo(player);
inv.bInObjectBelt = True;
}
if(lstGuns.GetSelectedRow() == lstGuns.IndexToRowId(4)){
inv = player.Spawn(Class'CStrike.CSWeaponSawedOffShotgun');
inv.GiveTo(player);
//inv.Frob(player, None);
//inv.bInObjectBelt = True;
}
if(lstGuns.GetSelectedRow() == lstGuns.IndexToRowId(5)){
inv = player.Spawn(Class'CStrike.CSWeaponStealthPistol');
inv.GiveTo(player);
inv.bInObjectBelt = True;
}
}
else if (S == "TRAVEL")
{
if (lstGuns.GetSelectedRow() != 0)
{
Player.SwitchLevel(lstGuns.GetField(lstGuns.GetSelectedRow(), 0)); //server checks for admin
actionButtons[2].btn.SetSensitivity(false);
}
}
//Super.ProcessAction(S);
}
defaultproperties
{
RepTime=1.0
l_help1="Type 'Mutate guns' to display the menu."
l_cpoint="Weapon/Materiel Selection:"
l_lgun"Your Money:"
bUsesHelpWindow=False
actionButtons(0)=(Align=HALIGN_Right,Action=AB_OK)
actionButtons(1)=(Action=AB_Other,Text="BUY",Key="BUY")
actionButtons(2)=(Action=AB_Other,Text="AirStrike",Key="TRAVEL")
Title="Blackmarket"
ClientWidth=440
ClientHeight=244
bAlwaysRelevant=True
RemoteRole=ROLE_SimulatedProxy
NetPriority=1.5
}
If its possible, i appreciate any kind of help.
I suck at coding, I can only make basic things, so if any of you guys have the time, can you 'correct' this for me?
It was written by bambi @ dxalpha
its meant to be a buymenu
after several trials on compiling i was like
DJ MAY KNOW ABOUT THIS
When I tried to compile it as it is, it said unknown type 'DXL' :c