Moderator: Forum Guards
class GunMenu extends MenuUIScreenWindow;
var localized string l_help1, l_cpoint, l_lgun;
var MenuUIScrollAreaWindow winScroll;
var MenuUIListWindow lstGuns, lstPoints;
var MenuUISmallLabelWindow CurrentPoints, LeadingGun;
var MenuLinkedList gunMenuLinkedList;
var float RepTime;
var bool bStacking, blstGunsDone;
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_lgun);
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_cpoint);
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'MenuLinkedList', gunMenuLinkedList)
if (gunMenuLinkedList.Owner == Player)
gunMenuLinkedList.gunMenu = None;
}
gunMenuLinkedList = 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();
}
// was going to implement skill based buying, so
// everytime someone kills someone, they get more points
// to buy more weapons
function Tick(float Delta)
{
if ((lstGuns == None) || (lstPoints == None) || (gunMenuLinkedList == 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)
{
gunMenuLinkedList.ClientSetVote(int(lstGuns.GetField(R, 1)));
CurrentPoints.SetText(lstGuns.GetField(R, 0));
/*
weapRowSelection = MapNumToRow(gunMenuLinkedList.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.Instigator=PlayerPawn;
newWeapon.SetOwner(PlayerPawn);
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);
}
//PlayerPawn.Level.Game.BaseMutator.ModifyPlayer(PlayerPawn);
}
function ProcessAction(String S)
{
local Inventory inv;
local Weapon newWeapon;
local DeusExPlayer player1;
if (S == "BUY")
{
player1 = DeusExPlayer(gunMenuLinkedList.Owner);
//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
log("player1 is " @player1);
if(lstGuns.GetSelectedRow() == lstGuns.IndexToRowId(0)){
GiveWeapon(player1, "CStrike.CSWeaponPistol");
//log("summon WeaponPistol");
//player1.Spawn(class'DeusEx.WeaponPistol');
//player1.Spawn(class'CStrike.CSWeaponPistol');
//inv = player1.Spawn(class'CStrike.CSWeaponAssaultGun');
//inv = player1.Spawn(Class'CStrike.CSWeaponAssaultGun');
//GiveWeapon(player1, "CStrike.CSWeaponPistol");
//inv = player1.Spawn(Class'CStrike.CSWeaponPistol');
//inv.Frob(player1, None);
//player1.inventory.bInObjectBelt = True;
//inv.Destroy();
//player.GiveInitialInventory(inv, 2, true);
//player1.SetInHand(inv);
//inv.setOwner(player1);
//inv.Frob(player1, inv);
//player1.Frob(Self, inv);
//inv.GiveTo(player1);
//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") // implement airstrike here
{
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
}
class MenuLinkedList extends Actor;
var localized string l_message, l_message2;
var MenuLinkedList Prev, Next;
var GunMenu gunMenu;
var int iCurrentVote, iMoney;
var bool bVoteDone;
//don't save data and function calls to the demorec
replication
{
reliable if (!bDemoRecording && (Role == ROLE_Authority))
OpenGunMenu, CloseGunMenu;
reliable if (!bDemoRecording && (Role < ROLE_Authority))
ServerSetVote;
}
simulated function PostBeginPlay()
{
SetTimer(1, true);
}
simulated final function bool ValidOwner()
{
return ( (DeusExPlayer(Owner) != None) && DeusExPlayer(Owner).PlayerIsClient() && (DeusExPlayer(Owner).Player != None) && (DeusExPlayer(Owner).Player.CurrentNetSpeed != 1000000) ); //demo check
}
simulated function Timer()
{
if (ValidOwner())
{
ClientSetVote(-1);
OpenGunMenu();
}
else if ((Role < ROLE_Authority) && (Owner == None))
return;
SetTimer(0, false);
}
simulated function Destroyed()
{
if (gunMenu != None)
gunMenu.root.PopWindow();
gunMenu = None;
// and to think, I thought data structures
// was pointless...
if (Role == ROLE_Authority)
{
if (Prev != None) Prev.Next = Next;
if (Next != None) Next.Prev = Prev;
Prev = None;
Next = None;
}
}
// left over from code I stole
final function ServerSetVote(int I)
{
iCurrentVote = I;
}
simulated final function ClientSetVote(int I)
{
if (iCurrentVote != I)
{
iCurrentVote = I;
ServerSetVote(I);
}
}
simulated final function OpenGunMenu()
{
local DeusExRootWindow window;
if (!bVoteDone && (gunMenu == None) && ValidOwner())
{
window = DeusExRootWindow(DeusExPlayer(Owner).RootWindow);
if (window != None)
{
gunMenu = GunMenu(window.InvokeMenuScreen(Class'GunMenu', true));
if (gunMenu != None)
gunMenu.gunMenuLinkedList = Self;
}
}
}
//Sprintf is not simulated - must call it from player
simulated final function CloseGunMenu()
{
if (!bVoteDone)
{
bVoteDone = true;
if (gunMenu != None)
gunMenu.root.PopWindow();
if (ValidOwner())
DeusExPlayer(Owner).ClientMessage(Owner.Sprintf(l_message, 'bamz0rz'), 'Say', true);
}
}
defaultproperties
{
l_message="%s is awesome!."
l_message2="%s has won the map vote!"
iCurrentVote=-2
bHidden=True
bAlwaysRelevant=False
RemoteRole=ROLE_SimulatedProxy
NetPriority=1.5
}
class MenuMutator extends Mutator config(Mutators);
var MenuLinkedList gunMenuLinkedList;
var float CWTime;
var int LoadingTime, iDefMap, iNextMap, iListSize;
var bool bInit, bVoteDone;
function PostBeginPlay()
{
if (bInit)
return;
bInit = true;
//log(MapCount @ "Maps," @ iListSize @ "Bytes", 'MenuMutator');
gunMenuLinkedList = Spawn(class'MenuLinkedList', Self);
}
// 'mutate mapvote' shows the menu.
// 'mutate voteresult' shows current leading map.
function Mutate(string S, PlayerPawn P)
{
if (gunMenuLinkedList != None)
{
if (S ~= "guns")
{
if (!bVoteDone)
GetMenuLinkedList(P, true).OpenGunMenu();
}
}
Super.Mutate(S, P);
}
function ModifyPlayer(Pawn P)
{
if (!bVoteDone && (DeusExPlayer(P) != None) && (GetMenuLinkedList(P) == None))
AddMenuLinkedList(P);
Super.ModifyPlayer(P);
}
function Tick(float Delta)
{
CWTime += Delta / Level.TimeDilation;
if (CWTime < 1)
return;
CWTime = 0;
//UpdateVoteData();
}
/*
final function UpdateVoteData(optional bool bFinal)
{
local MenuLinkedList D;
local int I;
if (gunMenuLinkedList != None)
for (D = gunMenuLinkedList.Next; D != None; D = D.Next)
{
D.iNextMap = iNextMap;
for (I = 0; I < MapCount; I++)
D.VoteTotals[I] = VoteTotals[I];
if (bFinal)
D.CloseGunMenu();
}
}
*/
final function AddMenuLinkedList(Actor A)
{
local MenuLinkedList D;
local int I;
if ((A != None) && !A.bDeleteMe && (gunMenuLinkedList != None))
{
D = A.Spawn(class'MenuLinkedList', A);
D.Prev = gunMenuLinkedList;
D.Next = gunMenuLinkedList.Next;
if (gunMenuLinkedList.Next != None)
gunMenuLinkedList.Next.Prev = D;
gunMenuLinkedList.Next = D;
}
}
final function MenuLinkedList GetMenuLinkedList(Actor A, optional bool bSafe)
{
local MenuLinkedList D;
if ((A != None) && (gunMenuLinkedList != None))
for (D = gunMenuLinkedList.Next; D != None; D = D.Next)
if (D.Owner == A)
return D;
if (bSafe)
return gunMenuLinkedList;
return None;
}
defaultproperties
{
RemoteRole=ROLE_SimulatedProxy
bAlwaysRelevant=True
}
[Public]
Object=(Name=CSGunShop.MenuMutator,Class=Class,MetaClass=Engine.Mutator,Description="CS Gun Shop")
Preferences=(Caption="CS Gun Menu Mod",Parent="Mutators",Class=CSGunShop.MenuMutator,Immediate=True)
bambi wrote:Update: 06/22/13
HOKAY! I'm having some fun with this mod, it features:
1. Terrorist class that makes funny sounds
2. Custom skins
Ok clyzm?!?!?! I need help making skins, I'm trying to use pinkmasktex to hide certain parts, but when I add the pinkmasktex to the skin, it just shows up pink in the game, not invisible.
Also,
thejager? We need some maps, I will prolly have the first version of this mod done by tomorrow.
bambi wrote:PARTS ARE GOING TO BLOW OFF IN MULTIPLAYER! Thats right, you shoot someones arms, its going bye bye!
//p.SetPhysics(PHYS_Walking);
//p.menuteam.SetOwner(p);
//p.SetOwner(menuclass) = p;
//Super(menuchoice_team).LoadSetting();
//p.PlayerReplicationInfo.Score = class'DeusExMPGame'.Default.ScoreToWin; //lives
//p.PlayerRestartState = 'PlayerWalking';
//GetRootWindow().parentPawn.KilledBy(None);
p.ClientMessage("Current level is " $ p.Level.Game);
//player.ConsoleCommand("deadmeat");
//player.Health = -1000;
//dxplayer.KilledBy(None);
//dxplayer.EndState();
//p.ConsoleCommand("deadmeat");
//dxplayer.ConsoleCommand("Suicide");
//dxplayer.Level.Game.Killed(dxplayer, dxplayer, 'Gibbed');
//player.Died( None, 'Gibbed', player.Location );
//justDie();
//Soldier(p).justDie();
//p.StartWalk();
//p.Died(None, 'Gibbed', p.Location);
//tem.RestartPlayer(p);
//p.SetState('');
//p.GotoState('Dying');
//pp.KilledBy(None);
//p.ClientMessage("Next team is " $p.PlayerReplicationInfo.Team);
//menuteam.player.UpdateURL("Team", "0", true);
//menuclass.player.UpdateURL("Class", "DXMTL152b1.MTLUNATCO", true);
//menuteam.SaveConfig();
//menuclass.SaveConfig();
//menuclass.LoadSetting();
//MTLTeam(p.Level.Game).RestartPlayer(p);
foreach p.AllActors(class'PlayerPawn',pp){
if(pp == p){
pp.ChangeTeam(MTLTeam(p.Level.Game).GetAutoTeam());
p.ClientMessage("Changing teams!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
break;
}
}
//p.Level.Game.RestartPlayer(p);
//MTLTeam(p.Level.Game).Login("","",Error,class'MTLUNATCO');
//p.Health = -1000;
//Super(MTLTeam).ChangeTeam(p, 0);
//p = None;
//p = Spawn(clss'MPNSF',,,p.Location,p.Rotation);
//if( p!=None )
//p.ViewRotation = p.Rotation;
//p.GoToState('PlayerWalking');
//p.PlayerReplicationInfo.Deaths = 0;
//p.PlayerReplicationInfo.Streak = 0;
//p.ClientMessage("New team is " $p.PlayerReplicationInfo.Team);