Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Check server status with pictures.


boyesjs03
 Share

Recommended Posts

So this is my first tutorial, and Im doing it for my 100th post xD This tutorial will show you how to add a piece of code that checks if the sever is online then shows the appropriate picture ( Online or Offline ). This is fairly basic and can teach those new to vb some basic stuff.

Lets Start.

All Client Side.

On frmMain add a timer with these properties.

Timer Name: tmrStatus

Top: 0

Left: 0

Interval: 1000

Then double click the timer and add this code inside the Sub:

```

If ConnectToServer(1) Then

PicOnline.Visible = True

PicOffline.Visible = False

Else

PicOnline.Visible = False

PicOffline.Visible = True

End If

```

Then we need to head over to Mod generals and add the file directories for the pictures.

Find 'Menu pics And add

```

frmMenu.PicOnline.Picture = LoadPicture(App.Path & "\data files\graphics\gui\menu\Offline.jpg

frmMenu.PicOffline.Picture = LoadPicture(App.Path & "\data files\graphics\gui\menu\Offline.jpg

```
To the bottom.

All you need to do now is create two picture boxes somewhere on your frmMenu with these pictures "Online" and "Offline" and set their visibility to false in properties and create the actual pictures themselves in gui/menu and name them appropriately.

Im pretty sure thats everything, please let me know if ive mistyped something important ect ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png)
Link to comment
Share on other sites

> ```
>
> PicOnline.Picture = /graphics/gui/menu/Online.jpeg
>
> PicOffline.Picture = /graphics/gui/menu/Offline.jpeg
>
> ```

Unless I'm mistaken, the directory you're providing will result in an error. I'm fairly confident you need to change it to```
App.path & "/graphics/gui/menu/Offline.jpeg"
```

Otherwise, its a good and simple tutorial! I look forward to seeing more from you!
Link to comment
Share on other sites

Sorry, I did this off the top of my head: it should look like this.

```

frmMenu.PicOnline.Picture = LoadPicture(App.Path & "\data files\graphics\gui\menu\Offline.jpg

frmMenu.PicOffline.Picture = LoadPicture(App.Path & "\data files\graphics\gui\menu\Offline.jpg

```

Will fix this in main post.
Link to comment
Share on other sites

  • 1 year later...
> So this is my first tutorial, and Im doing it for my 100th post xD This tutorial will show you how to add a piece of code that checks if the sever is online then shows the appropriate picture ( Online or Offline ). This is fairly basic and can teach those new to vb some basic stuff.
>
> Lets Start.
>
> All Client Side.
>
> On frmMain add a timer with these properties.
>
> Timer Name: tmrStatus
>
> Top: 0
>
> Left: 0
>
> Interval: 1000
>
> Then double click the timer and add this code inside the Sub:
>
>  
>
> ```
> If ConnectToServer(1) Then PicOnline.Visible = True PicOffline.Visible = False Else PicOnline.Visible = False PicOffline.Visible = True End If
> ```
> Then we need to head over to Mod generals and add the file directories for the pictures.
>
> Find 'Menu pics And add
> ```
> frmMenu.PicOnline.Picture = LoadPicture(App.Path & "\data files\graphics\gui\menu\Offline.jpg
> frmMenu.PicOffline.Picture = LoadPicture(App.Path & "\data files\graphics\gui\menu\Offline.jpg
> ```
> To the bottom.
>
> All you need to do now is create two picture boxes somewhere on your frmMenu with these pictures "Online" and "Offline" and set their visibility to false in properties and create the actual pictures themselves in gui/menu and name them appropriately.
>
> Im pretty sure thats everything, please let me know if ive mistyped something important ect ![](http://www.touchofdeathforums.com/community/public/style_emoticons/default/smile.png)

Shouldn't the online pic be this:

```
frmMenu.PicOnline.Picture = LoadPicture(App.Path & "\data files\graphics\gui\menu\Online.jpg")
```
? otherwise it's displaying that the server is offline even when the server is online…
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...