Saturday, January 15, 2011

How to run a CS(Counter Strike) server from home

Wanna play Counter Strike with your clan?and no arrangements for the LAN party then this tutorial might helpful for you,run your private CS server from your home and play with your mates despite anywhere they are.It's pretty easy to do that,you just need.........

1. half-life server (HLDS) properly installed in your computer.
2. A properly forward port.(so you are visible to outside world)
3. A free dynamic IP forwarding service (if you don't have a static IP)

And thanks to all copy cats out there,the internet is flooding with the tutorials for 1st step,but still if you can't find one here it is   http://gamehacking.com/index.php?/topic/4786-make-your-own-cs-server/
(NOTE: i am a proud member of this site,so no i am not a copy cat)

2. port forwarding
If you are using a router/modem then you are behind the walls and others can't see you,so that's why he have to port forward the modem/router,so others can connect to your application using that port.
Check what kind of connection type you are using "bridge mode" or "PPPOE"
bridge-mode : you dial every-time from your PC to connect to internet.
PPPOE mode : you are always connected to internet,unless your modem is not switched off.
  If you are using bridge mode follow this steps otherwise skip to ☻
While your modem switched on and LAN properly connected type 192.168.1.1 into your internet browser (no matter it's firefox,ie,chrome or opera) your modem's login window will appear type "admin" in both username and password that's by default but if you already changed it and forget then reset your modem to factory setting by pressing and holding small button,somewhere behind or bottom of your modem.

Once you are in,try to find something similar to "internet connection configuration" mine is inside configuration->internet

The first one is bridge mode connection and second one (marked also) is PPPOE mode connection which we need,click on add button......

something similar will open now as you can see,in mine VCI is 35 because i am using BSNL as my ISP and   35 work on that,if 35 not works for you try 38.Leave service category = UBR without PCR,and click on next.....
choose "PPP over ethernet" form the option leave everything else unchanged and click on next...
configure this same as per image and click on next.....
In this field you can use anything for the Service Name but your username and password should be correct as your ISP provided and select always on.
Now your modem is set to PPPOE mode and every time you switched it on,it will connect to internet directly but you have to configure your LAN settings to use it.
Go to your LAN connection properties then TCP/IP properties and select "use following IP" and enter an IP address for your computer in the format 192.168.1.X ,In "default gateway" enter your modem's IP 192.168.1.1 and click ok.
Restart your modem,wait untill DSL LED gets constant and try to open any website just to check everything went OK and you are able to access internet.

☻PORT-FORWARDING
Open your modem configuration again by entering 192.168.1.1 in browser,login again,now try to find something like  "Advanced Security"
This thing is hidden in some modems like mine and i have to enter "192.168.1.1/advan_menu.html" manually to open "advanced menu". If you are also not able to find it take some help from http://portforward.com/
and once you find it you will see "port forwarding" some where in it.
In my modem the "half life server" is already given in games but if not in yours just use "user defined"and enter a name for it like CSserver,"WAN interface" will be ppoe_0_35 or ppoe_0_38 whatever you are using,In
"Forward to Internal Host IP Address:" enter IP of your computer which you wanna make server in my case it's 192.168.1.4
in Protocol choose TCP/UDP and for all 4 ports enter 27015 you can use other HL supported ports too but as this one is standard we are using it.Click apply and your port 27015 is now forwarded.

3.IP forwarding (if you don't have a static-IP)
 There are many sites who provide free IP forwarding but my personal fav. is no-ip.com it's free but you must use your host atleast once in 60 days to keep it running .Just go to http://www.no-ip.com/services/managed_dns/free_dynamic_dns.html  and once you are registered click on "add host" option and choose a name which suite you for example mine is "insanitygames.myftp.org" once you are done with creating host go and download No-IP DUC from https://www.no-ip.com/downloads.php this tool updates your current IP to the No-IP server.You are almost done open No-IP DUC ,login with your no-ip.com username and password and select the host name you created.
(Note: Whenever you run the server,make sure you are running No-IP DUC too otherwise your IP will not updated to your host) 
All settings done here,lets test your server run hlds.exe (configure all server settings correctly)
along with the No-IP DUC,make sure internet is working fine,now you can call your friends and tell them to join the server by typing
connect [your host name]:[port]  example "insanitygames.myftp.org:27015"
NOTE: static IP users use this
 connect [your ip address]:[port]  example "111.91.122.162:27015"
in console or by adding it to "favorites" in find server option. you can join your own server in same pc using hl.exe and play with your friends. 
I hope this post will help you to creating your own server,also check my another post it's all about administrating a CS server http://mybooleanblog.blogspot.com/2010/08/cscounter-strike-admin-manual-complete.html

Wednesday, January 12, 2011

Tricks for custom form design in VB.NET

In this tutorial we are going to learn some simple tricks for changing a simple form to cool design in VB.NET (i am using 2005) off-course beginners level.

 

so which one is looking cool to you?I hope that's the right one.
lets see how to achieve this,first choose an image(better to select *.png or *.gif with transparent background) which you want to use as your form template,you can do this by selecting BackgorundImage in form properties or you can use me.BackgroundImage and remember to add it as a resource file not a local file.once your image is imported you have to set it's layout by  
BackgroundImageLayout=None or  me.BackgroundImageLayout=ImageLayout.None 
and change the form size to cover the image completely,something like
 
we are allmost done just have to hide the original form which holds our image,this is a two step process
1.) Hide the form border.
2.) Make transparent the form background.

first step is easy just go to form properties and set 
FormBorderStyle=None or me.FormBorderStyle=Windows.Forms.FormBorderStyle.None 
however when you make your form border-less you can't move it,So we have to add some extra code here to avoid that problem.Copy this code anywhere in your form coding body.
#Region " ClientAreaMove Handling "
    Const WM_NCHITTEST As Integer = &H84
    Const HTCLIENT As Integer = &H1
    Const HTCAPTION As Integer = &H2
    Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
        Select Case m.Msg
            Case WM_NCHITTEST
                MyBase.WndProc(m)
                If m.Result = HTCLIENT Then m.Result = HTCAPTION
                'If m.Result.ToInt32 = HTCLIENT Then m.Result = IntPtr.op_Explicit(HTCAPTION) 'Try this in VS.NET 2002/2003 if the latter line of code doesn't do it... thx to Suhas for the tip.
            Case Else
                'Make sure you pass unhandled messages back to the default message handler.
                MyBase.WndProc(m)
        End Select
    End Sub
#End Region
now your form can move even without a border (don't ask me how this code works cause i don't completely  understand either,and all credit goes to the original coder)

Second step is pretty easy you just have to set form backcolor to transparent however you can't set 
BackColor=Transperant   or Me.BackColor = Color.Transparent 
because this is not supported by VB.NET.
so again need to do a little trick here,go to form properties and set BackColor to anycolor which is rarely used and ensure you are not  going to use it any where else.(In this case i am using hot pink,because that would be the most ugly color for me :P ) so again form properties
BackColor=HotPink or Me.BackColor = Color.HotPink
now we have to set the TransparencyKey exaclty same to color we choose (in this case HotPink)
TransparencyKey=HotPink or Me.TransparencyKey = Color.HotPink

that's it! your form is now boderless and transparent and after some coding this will look like......
isn't it cool? now go make one for yourself  :)