PDA

View Full Version : [TUTORIAL]Simple GUI


GLoGG
28th October 2005, 17:58
ok first off all: this is taken out of my public béta 1.3 i released.
Many people have been asking some things bout this and so on so here it is.

First we begin at making some variables

var config bool bMenu;
var int Team, Enemy, OrigID;
var bool Toggle, bToggleMenu

Than we begin drawing the text on screen as an menu

function DrawMyMenu (Canvas MyCanvas)
{
local float PosX,PosY;

if (bMenu)
{
MyCanvas.Font=Font'OrigFont'; //Import Tamimego's font and rename it OrigFont
MyCanvas.SetPos(330, 10.00);
MyCanvas.SetDrawColor(102,255,204);
MyCanvas.DrawText("..:: 9L099Bot v1.3 béta Created by VLR::GLoGG ::..");

MyCanvas.SetPos(8.00, 150);
MyCanvas.SetDrawColor(255,0,0);
MyCanvas.DrawPattern(Texture'WhiteTexture', .00,10.00,1.00); // Drawing an nicely drawen box (as u can see in my released one :P

MyCanvas.SetDrawColor(255,255,255);
PosX=20.00;
PosY=150;
MyCanvas.SetPos(PosX,PosY);
MyCanvas.DrawText("9L099Bot v1.3 béta"); // Can change it to ur own title ^^
PosY += 20;

MyCanvas.SetPos(8.00, 170);
MyCanvas.SetDrawColor(255,0,0);
MyCanvas.DrawPattern(Texture'WhiteTexture',130.00, 90.00,1.00);
// Drawing an nicely drawen box (as u can see in my released one :P

MyCanvas.SetDrawColor(255,255,255);
if ( bToggleMenu )
{
MyCanvas.SetPos(10.00,PosY + OrigID * 10);
MyCanvas.DrawText(">");
}
MyCanvas.SetPos(PosX,PosY);
MyCanvas.DrawText("ESP "@int(bESP)); // Can replace this with ur own functions
PosY += 10;
MyCanvas.SetPos(PosX,PosY);
MyCanvas.DrawText("RetLock " @int(bRetLock)); // Can replace this with ur own functions
PosY += 10;
MyCanvas.SetPos(PosX,PosY);
MyCanvas.DrawText("C4 Hack "@int(bC4Hack)); // Can replace this with ur own functions
PosY += 10;
MyCanvas.SetPos(PosX,PosY);
MyCanvas.DrawText("WallHack "@int(bWallHack)); // Can replace this with ur own functions
PosY += 10;
MyCanvas.SetPos(PosX,PosY);
MyCanvas.DrawText("AutoReload "@int(bAutoReload)); // Can replace this with ur own functions
PosY += 10;
MyCanvas.SetPos(PosX,PosY);
MyCanvas.DrawText("NoRecoil "@int(bNoRecoil)); // Can replace this with ur own functions
PosY += 10;
MyCanvas.SetPos(PosX,PosY);
MyCanvas.DrawText("Removals "@int(bRemovals)); // Can replace this with ur own functions
PosY += 10;
MyCanvas.SetPos(PosX,PosY);
MyCanvas.DrawText("Aimbot "@int(bAimbot));
PosY += 10;// Can replace this with ur own functions
MyCanvas.SetPos(PosX,PosY);
MyCanvas.DrawText("AutoFire "@int(bAutoFire));
PosY += 20;// Drawing an nicely drawen box (as u can see in my released one :P

MyCanvas.SetPos(8.00, 270);
MyCanvas.SetDrawColor(255,0,0);
MyCanvas.DrawPattern(Texture'WhiteTexture',130.00, 40.00,1.00);
// Drawing an nicely drawen box (as u can see in my released one :P
MyCanvas.SetDrawColor(255,255,255);
MyCanvas.SetPos(PosX, PosY);
MyCanvas.DrawText("Players Alive: " @ Team + Enemy);
PosY += 10;
MyCanvas.SetPos(PosX, PosY);
MyCanvas.DrawText("TeamMates Alive: " @ Team);
PosY += 10;
MyCanvas.SetPos(PosX, PosY);
MyCanvas.DrawText("Enemies Alive: " @ Enemy);
PosY += 10;
//MyCanvas.SetPos(PosX, PosY);
//MyCanvas.DrawText(" LAG DELAY: " @ LagDelay()); // folow kizzamps TUT on how to do this (needs an function float)
//PosY += 10;
}
}

The team and enemy counter needs some things in pawnrelated (you can make an stand alone functions from it though (look in aao)

function PawnRelated (Canvas Canvas)
{
Enemy=0; // 0 by default so the counter doesn't flip
Team=0;
foreach MyController.Level.DynamicActors(Class'Pawn', Target)
{
if (Target != None)
{
if (IsEnemy(Target))
{
Enemy++; // Counting Enemy's
} else{
Team++; // Counting TeamMates
}
}
}
}

Now this is the function that is controlling the GUI/Menu (PUT THIS IN PAWNRELATED OR MAKE AN FUNCTION OF IT UR SELF!)

if ( bToggleMenu )
{
switch (OrigID)
{
case 0:
if ( Toggle )
bESP = !bESP; // Activating and Deactivating ESP
Toggle=False;
break;

case 1:
if ( Toggle )
bRetLock = !bRetLock; // Activating and Deactivating retlock
Toggle=False;
break;

case 2:
if ( Toggle )
bC4hack = !bC4Hack;
Toggle=False;// Activating and Deactivating c4hack
break;

case 3:
if ( Toggle )
bWallHack = !bWallHack; // Activating and Deactivating wallhack
Toggle=False;
break;

case 4:
if ( Toggle )
bAutoReload = !bAutoReload;
Toggle=False;
break;

case 5:
if ( Toggle )
bNoRecoil = !bNoRecoil;
Toggle=False;
break;

case 6:
if ( Toggle )
bRemovals = !bRemovals;
Toggle=False;
break;

case 7:
if ( Toggle )
bAimbot = !bAimbot;
Toggle=False;
break;

case 8:
if ( Toggle )
bAutoFire = !bAutoFire;
Toggle=False;
break;

default:
}
if ( (OrigID < 0 ) || (OrigID > 8) ) // if OrigID passed 8 return to 0
OrigID=0;
}

Now add KeyEvents to it!

function bool KeyEvent ( EInputKey Key, EInputAction Action, FLOAT Delta )
{
if ( Action == IST_Press )
return False;
if ( Key == IK_F1 ) // Toggles Menu On/Off
{
bMenu = !bMenu;
MyController.ClientMessage("Menu = "@String(bMenu));
}
if ( Key == IK_F2 ) // Toggles GUI On/Off
{
bToggleMenu = !bToggleMenu;
MyController.ClientMessage("Menu Toggle (Controlled by the 'arrow keys' by toggling right they are On/Off toggleable): "@String(bToggleMenu));
}
if ( Key == IK_Down)
OrigID++; // moves the GUI selector down
if ( Key == IK_Up ) // moves the GUI selector up
OrigID--;
if ( Key == IK_Right )// Toggle the functions On/Off by clicking arrow key right!
Toggle=True;
}

i hope this helps some peeps out making a nice menu..
I included the source of GLOGGBOT v1.3 BETA with it enjoy!

SORRY FOR STRETCHING FORUMS A LIL :rolleyes:
FOR CREDS LOOK AT MY RELEASE THREAD

-GLoGG

JohnDeere6996
28th October 2005, 18:08
sweet release GLoGG.

KizZamP-
28th October 2005, 19:10
nice and (i saw a ss of it) good looking gui ^^
o btw for the noobs, the he probably declared "MyCanvas" as "Canvas" in postrender,he probably did MyCanvas = Canvas;

GLoGG
28th October 2005, 19:30
function DrawMyMenu (Canvas MyCanvas) <----

:rolleyes:

btw edited the pawnrelated else the enemy/team counter would still count them if there dead lol ...forgot bout Target != None

RuffianSoldier
28th October 2005, 20:38
nice tut glogg :)

tif.XGotchaX
28th October 2005, 22:09
Nj GloGG !!! :)

KizZamP-
28th October 2005, 22:21
btw i forgot to say,i'll add this to the sticky ;)

Diddle
29th October 2005, 07:02
File: GLoGGBot1.3beta.rar
Status: OK
MD5: 2251e11e5fdf1c04665f674e9af7ac37
Packers Detected: -

Scan Results
AntiVir: Found Nothing
ArcaVir: Found Nothing
Avast: Found Nothing
AVG Antivirus: Found Nothing
BitDefender: Found Nothing
ClamAV: Found Nothing
Dr. Web: Found Nothing
F-Prot Antivirus: Found Nothing
Fortinet: Found Nothing
Kaspersky Anti-Virus: Found Nothing
NOD32: Found Nothing
Norman Virus Control: Found Nothing
UNA: Found Nothing
VBA32: Found Nothing

Source: Jotti's Virusscan (http://virusscan.jotti.org/)File is Clean --> Approved.

GLoGG
29th October 2005, 11:49
File: GLoGGBot1.3beta.rar
Status: OK
MD5: 2251e11e5fdf1c04665f674e9af7ac37
Packers Detected: -

Scan Results
AntiVir: Found Nothing
ArcaVir: Found Nothing
Avast: Found Nothing
AVG Antivirus: Found Nothing
BitDefender: Found Nothing
ClamAV: Found Nothing
Dr. Web: Found Nothing
F-Prot Antivirus: Found Nothing
Fortinet: Found Nothing
Kaspersky Anti-Virus: Found Nothing
NOD32: Found Nothing
Norman Virus Control: Found Nothing
UNA: Found Nothing
VBA32: Found Nothing

Source: Jotti's Virusscan (http://virusscan.jotti.org/)File is Clean --> Approved.

ty diddle.

Variable.tk
30th October 2005, 08:33
Thanks

C-X
30th October 2005, 23:34
Yeh NJ NJ GLoGG (ponkie ;) )
I used this as a base for the menu of my new
bot heres a screenshot::::
http://img496.imageshack.us/my.php?image=headshot2fu.png

Only thing i didnt like was the ">" as selector so i replaced this:
{
MyCanvas.SetPos(10.00,PosY + OrigID * 10);
MyCanvas.DrawText(">");
}

By this::
if ( bToggleMenu )
{
MyCanvas.SetPos(PosX,PosY + OrigID * 10);
MyCanvas.DrawIcon(Texture'MenuSelect', 0.90);
}
And i used mouswheel instead of arrows...

KizZamP-
31st October 2005, 08:01
nice job C-x,really ^^

GLoGG
31st October 2005, 21:09
Yeh NJ NJ GLoGG (ponkie ;) )
I used this as a base for the menu of my new
bot heres a screenshot::::
http://img496.imageshack.us/my.php?image=headshot2fu.png

Only thing i didnt like was the ">" as selector so i replaced this:
{
MyCanvas.SetPos(10.00,PosY + OrigID * 10);
MyCanvas.DrawText(">");
}

By this::
if ( bToggleMenu )
{
MyCanvas.SetPos(PosX,PosY + OrigID * 10);
MyCanvas.DrawIcon(Texture'MenuSelect', 0.90);
}
And i used mouswheel instead of arrows...

looks nice dude..glad this could help ya out ;)