SA-MP Forums Archive
Need Some Help With Visual Basic(VB) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Need Some Help With Visual Basic(VB) (/showthread.php?tid=331656)



Need Some Help With Visual Basic(VB) - [Dk]RoCk - 05.04.2012

Hello SAMP Members


i Need Some Help With Visual Basic(VB) i want to make a Control panel Like
there will be 3 buttons
"Start Server
Stop Server
Restart Server"


I know the Code of Stop Server

But i dont know how to script Start Server And Restart Server :/
like what's the code when players clicks the first button which is Start Server
The Control panel seraches the Whole Computer And Find The samp-server.exe And opens it
Can someone give me the code for this

And Also The restart Server
It just Closes The samp-server.exe And Then Reopens It
I also need code for this

I will Be Very Very Happy if someone Help's Me


Re: Need Some Help With Visual Basic(VB) - Jonny5 - 05.04.2012

well this is not a VB site!
you need to learn threw some other site how to invoke an exe file
search ****** or the likes...

and the restart will be a combo of both Shut-down && Start


Re: Need Some Help With Visual Basic(VB) - [Dk]RoCk - 05.04.2012

i know how to run a File but it wants The Path Of it Also
i dont want to specify file i just want it To Search The File Wherever it is and then Just Simply Open it?


Re: Need Some Help With Visual Basic(VB) - TzAkS. - 05.04.2012

I don`t think you can do like this..to search on computer for samp-server.exe,becouse if you have many servers wich server will open?
You need to have the program and samp-server.exe in same folder and do like this

Код:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Process.Start("samp-server.exe")
    End Sub
And for closing it you can to like
Код:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim myprocess() As Process = System.Diagnostics.Process.GetProcessesByName("samp-server.exe")
        For Each myKill As Process In myprocess
            myKill.Kill()
        Next
That`s for button 1 and 2 you can change them..

And do you know that this is a forum for scripting?
Not for this :P