RuffianSoldier
10th November 2005, 20:21
This is a similar GUI to Ubuntu 1.0 and 1.1
This code might be buggy because I wrote it from scratch and I just woke up
If it is: Sorry, post your error and I will update the tut.
I would have just posted Ubuntu's source but I apparently lost it :(
I take all credit for this
#exec Texture Import File=Textures\selectbox.bmp Name=select//GUI Texture
#exec Texture Import File=Textures\mouse.bmp Name=mouse//Mouse Pointer
var int iselect;//This controls the GUI
var float menux,menuy,mousex,mousey;//For the menu and the mouse
var bool bnorecoil,bretlock,bwallhack,bmouse,badjust,bdone;//Just some random bools for an example :)
function PostRender(Canvas Canvas)
{
local pawn p;//Local for the wallhack
SelectBool(Canvas);//This calls the GUI function
MouseFunc(canvas);//This calls the mouse function
//RANDOM BOOLS\\
if(bnorecoil)
{R6PlayerController(MyController).m_bShakeactive=f alse;}else{R6PlayerController(MyController).m_bSha keactive=true;}
if(bretlock)
{Me.EngineWeapon.PerfectAim();}
if(bwallhack)
{
foreach mycontroller.allactors(class'pawn',p)
{
if((p!=none)&&(p!=me)&&(p.isalive()))
{
Canvas.drawactor(p2,false,true);
p.bhidden=false;
}
}
}
}
Function MouseFunc(canvas c)//Mouse function
{
if(mycontroller.player!=none)//Make sure MyController.Player exists
{
MouseX=MyController.Player.WindowsMouseX;//This places MouseX where the mouse actually is
MouseY=MyController.Player.WindowsMouseY;//This places MouseY where the mouse actually is
if(badjust)//The below code is to adjust the menu on screen
{
MyController.ConsoleCommand("SetSensitivity 0");//This is so you cannot move your screen when adjusting
MenuX=MouseX;//Place MenuX where MouseX is so the GUI will be where your mouse is
MenuY=MouseY;//Place MenuY where MouseY is so the GUI will be where your mouse is
bdone=true;//This is so you can reset your mouse sensitivity
}
if(bmouse)//This is the mouse and toggle code
{
MyController.ConsoleCommand("SetSensitivity 0");
bdone=true;
C.Style=3;
C.SetDrawColor(5,204,5);
C.SetPos(MouseX, MouseY);//Sets the texture at the posisition of your mouse
C.DrawIcon(Texture'Mouse' ,1.0);
if((Mousex>=menux-10)&&(MouseX<=115+menux))//Adjust this to your liking - it checks to see if your mouse is on the menu (horizontal check)
{
if((MouseY>=menuy)&&(MouseY<=menuy+14))//This checks to see if you are selecting Norecoil (vertical check)
iselect=1;//If you are - it sets iselect to 1 so you can toggle norecoil
else if((MouseY>=menuy+15)&&(MouseY<=menuy+29))//This checks to see if you are selecting Retlock (vertical check)
iselect=2;//If you are - it sets iselect to 2 so you can toggle retlock
else if((MouseY>=menuy+30)&&(MouseY<=menuy+44))//This checks to see if you are selecting Wallhack (vertical check)
iselect=3;//If you are - it sets iselect to 3 so you can toggle Wallhack
else iselect=0;//If you arent selecting anything - then set iselect to 0
}else{iselect=0;
}
if(badjust==false&&bmouse==false){if(bdone){MyController.ConsoleComma nd("SetSensitivity 4");bdone=false;}}//This resets your mouse sensitivity
}
function SelectBool(Canvas Canvas)//GUI Function
{
Canvas.Style=1;
if(iselect==1)
{Canvas.SetDrawColor(117,117,177);} //If Selected, then use this color
else{Canvas.SetDrawColor(74,74,74);} //If not Selected, then use different color
Canvas.SetPos(MenuX, MenuY-2);
Canvas.DrawIcon(Texture'Select', 0.90);
if(iselect==2)
{Canvas.SetDrawColor(117,117,177);} //If Selected, then use this color
else{Canvas.SetDrawColor(74,74,74);} //If not Selected, then use different color
Canvas.SetPos(MenuX, MenuY+13);
Canvas.DrawIcon(Texture'Select', 0.90);
if(iselect==3)
{Canvas.SetDrawColor(117,117,177);} //If Selected, then use this color
else{Canvas.SetDrawColor(74,74,74);} //If not Selected, then use different color
Canvas.SetPos(MenuX, MenuY+28);
Canvas.DrawIcon(Texture'Select', 0.90);
//Text for the GUI
Canvas.Font=Canvas.SmallFont;
Canvas.SetDrawColor(255,239,219);
Canvas.SetPos(MenuX-10, MenuY);
Canvas.DrawText("NoRecoil " $ string(bnorecoil));
Canvas.SetPos(MenuX-10, MenuY+15);
Canvas.DrawText("Retlock " $ string(bretlock));
Canvas.SetPos(MenuX-10, MenuY+30);
Canvas.DrawText("Wallhack " $ string(bwallhack));
}
function bool KeyEvent( EInputKey Key, EInputAction Action, FLOAT Delta )
{
//To interact with the GUI
if( Action==IST_Press )
{
if(key==ik_f9)
{badjust=!badjust;}//Hit F9 to adjust the menu
if(key==ik_f10)
{bmouse=!bmouse;}//Hit F10 to toggle the mouse
if(iselect==1)//IF iselect is = to 1, then right key toggles Norecoil
{
if (Key==IK_MiddleMouse)
{bnorecoil=!bnorecoil;}
}
if(iselect==2)//IF iselect is = to 2, then right key toggles Retlock
{
if (Key==MiddleMouse)
{bretlock=!bretlock;}
}
if(iselect==3)//IF iselect is = to 3, then right key toggles Wallhack
{
if (Key==MiddleMouse)
{bwallhack=!bwallhack;}
}
}else{return false;}
}
defaultproperties
{
menux=20//Set default menuX
menuY=250//Set default menuY
}
This code might be buggy because I wrote it from scratch and I just woke up
If it is: Sorry, post your error and I will update the tut.
I would have just posted Ubuntu's source but I apparently lost it :(
I take all credit for this
#exec Texture Import File=Textures\selectbox.bmp Name=select//GUI Texture
#exec Texture Import File=Textures\mouse.bmp Name=mouse//Mouse Pointer
var int iselect;//This controls the GUI
var float menux,menuy,mousex,mousey;//For the menu and the mouse
var bool bnorecoil,bretlock,bwallhack,bmouse,badjust,bdone;//Just some random bools for an example :)
function PostRender(Canvas Canvas)
{
local pawn p;//Local for the wallhack
SelectBool(Canvas);//This calls the GUI function
MouseFunc(canvas);//This calls the mouse function
//RANDOM BOOLS\\
if(bnorecoil)
{R6PlayerController(MyController).m_bShakeactive=f alse;}else{R6PlayerController(MyController).m_bSha keactive=true;}
if(bretlock)
{Me.EngineWeapon.PerfectAim();}
if(bwallhack)
{
foreach mycontroller.allactors(class'pawn',p)
{
if((p!=none)&&(p!=me)&&(p.isalive()))
{
Canvas.drawactor(p2,false,true);
p.bhidden=false;
}
}
}
}
Function MouseFunc(canvas c)//Mouse function
{
if(mycontroller.player!=none)//Make sure MyController.Player exists
{
MouseX=MyController.Player.WindowsMouseX;//This places MouseX where the mouse actually is
MouseY=MyController.Player.WindowsMouseY;//This places MouseY where the mouse actually is
if(badjust)//The below code is to adjust the menu on screen
{
MyController.ConsoleCommand("SetSensitivity 0");//This is so you cannot move your screen when adjusting
MenuX=MouseX;//Place MenuX where MouseX is so the GUI will be where your mouse is
MenuY=MouseY;//Place MenuY where MouseY is so the GUI will be where your mouse is
bdone=true;//This is so you can reset your mouse sensitivity
}
if(bmouse)//This is the mouse and toggle code
{
MyController.ConsoleCommand("SetSensitivity 0");
bdone=true;
C.Style=3;
C.SetDrawColor(5,204,5);
C.SetPos(MouseX, MouseY);//Sets the texture at the posisition of your mouse
C.DrawIcon(Texture'Mouse' ,1.0);
if((Mousex>=menux-10)&&(MouseX<=115+menux))//Adjust this to your liking - it checks to see if your mouse is on the menu (horizontal check)
{
if((MouseY>=menuy)&&(MouseY<=menuy+14))//This checks to see if you are selecting Norecoil (vertical check)
iselect=1;//If you are - it sets iselect to 1 so you can toggle norecoil
else if((MouseY>=menuy+15)&&(MouseY<=menuy+29))//This checks to see if you are selecting Retlock (vertical check)
iselect=2;//If you are - it sets iselect to 2 so you can toggle retlock
else if((MouseY>=menuy+30)&&(MouseY<=menuy+44))//This checks to see if you are selecting Wallhack (vertical check)
iselect=3;//If you are - it sets iselect to 3 so you can toggle Wallhack
else iselect=0;//If you arent selecting anything - then set iselect to 0
}else{iselect=0;
}
if(badjust==false&&bmouse==false){if(bdone){MyController.ConsoleComma nd("SetSensitivity 4");bdone=false;}}//This resets your mouse sensitivity
}
function SelectBool(Canvas Canvas)//GUI Function
{
Canvas.Style=1;
if(iselect==1)
{Canvas.SetDrawColor(117,117,177);} //If Selected, then use this color
else{Canvas.SetDrawColor(74,74,74);} //If not Selected, then use different color
Canvas.SetPos(MenuX, MenuY-2);
Canvas.DrawIcon(Texture'Select', 0.90);
if(iselect==2)
{Canvas.SetDrawColor(117,117,177);} //If Selected, then use this color
else{Canvas.SetDrawColor(74,74,74);} //If not Selected, then use different color
Canvas.SetPos(MenuX, MenuY+13);
Canvas.DrawIcon(Texture'Select', 0.90);
if(iselect==3)
{Canvas.SetDrawColor(117,117,177);} //If Selected, then use this color
else{Canvas.SetDrawColor(74,74,74);} //If not Selected, then use different color
Canvas.SetPos(MenuX, MenuY+28);
Canvas.DrawIcon(Texture'Select', 0.90);
//Text for the GUI
Canvas.Font=Canvas.SmallFont;
Canvas.SetDrawColor(255,239,219);
Canvas.SetPos(MenuX-10, MenuY);
Canvas.DrawText("NoRecoil " $ string(bnorecoil));
Canvas.SetPos(MenuX-10, MenuY+15);
Canvas.DrawText("Retlock " $ string(bretlock));
Canvas.SetPos(MenuX-10, MenuY+30);
Canvas.DrawText("Wallhack " $ string(bwallhack));
}
function bool KeyEvent( EInputKey Key, EInputAction Action, FLOAT Delta )
{
//To interact with the GUI
if( Action==IST_Press )
{
if(key==ik_f9)
{badjust=!badjust;}//Hit F9 to adjust the menu
if(key==ik_f10)
{bmouse=!bmouse;}//Hit F10 to toggle the mouse
if(iselect==1)//IF iselect is = to 1, then right key toggles Norecoil
{
if (Key==IK_MiddleMouse)
{bnorecoil=!bnorecoil;}
}
if(iselect==2)//IF iselect is = to 2, then right key toggles Retlock
{
if (Key==MiddleMouse)
{bretlock=!bretlock;}
}
if(iselect==3)//IF iselect is = to 3, then right key toggles Wallhack
{
if (Key==MiddleMouse)
{bwallhack=!bwallhack;}
}
}else{return false;}
}
defaultproperties
{
menux=20//Set default menuX
menuY=250//Set default menuY
}