question before i attempt something
ok folks heres one for you, i know this must be possible but i have no clue how to do it, how do you run an EXE from code within another EXE
for example, im wanting to make a /bootmap command
so in game u can type /bootmap aresden /bootmap middleland
etc and the GServer you are on will attempt to boot up the other map from in game..
ooh ooh also.. can you end a task using code?
cause being able to kill a dead gameserver b4 trying to boot it wud be sweet..
u must be able to or else task manager wouldnt be able to.. but the big question is, does anyone know how?
/edit
ooh, CreateProcess and TerminateProcess, but they look complicated ill play wif em tomorrow.
for example, im wanting to make a /bootmap command
so in game u can type /bootmap aresden /bootmap middleland
etc and the GServer you are on will attempt to boot up the other map from in game..
ooh ooh also.. can you end a task using code?
cause being able to kill a dead gameserver b4 trying to boot it wud be sweet..
u must be able to or else task manager wouldnt be able to.. but the big question is, does anyone know how?
/edit
ooh, CreateProcess and TerminateProcess, but they look complicated ill play wif em tomorrow.
google.com knows how.
<!--QuoteBegin-crazymnig88+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (crazymnig88)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->by notepad??? it didn't show any code, just show words wif no mean<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd--><br><!--QuoteBegin-charlie+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (charlie)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->he'll probably save it as 600pagebook.bmp<br><br>400gb file plzkthnx<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd-->
ShellExecuteA()
<img src='http://www.helbreathx.net/sig/sig.jpeg' border='0' alt='user posted image' /><br><a href='http://mafia.cheats4us.org/index.php?x=231030' target='_blank'>#1 on Mafia </a><br><!--QuoteBegin-Slipknight+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (Slipknight)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->100mb Internet, burstable too 10GB oc192<br>his speed can go up too 10gbs<br>...<br>Yes my car can have a top speed of 1000mph<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd--><br>^^ I wonder where the retard went to.
-
- Loyal fan
- Posts: 391
- Joined: Sat Mar 26, 2005 12:41 am
you mean like start up another HGserver, or just the map?
<img src='http://freewebs.com/trickro/70s.png' border='0' alt='user posted image' /><img src='http://freewebs.com/trickro/70s2.jpg' border='0' alt='user posted image' />
if you're in game then when you exit an hg.. it will have a pop up for the player data not saved. so you would have to go back to windows anyhow to close it. so there is really no point. i suggest that you remove the messagebox in the hg if you are going to do an in-game cmd.
zero posted the shellexecute line which is used to execute a program. there is, however, another function inside the shellexecute that is used which is createprocess. that function is strictly for the use of opening a program. shell can do other things though but createprocess is actually meant to open an exe/program. i advise that you look into studying these functions and become familiar with them so that you can come up with your own code to open and close an exe.
if you make a stable and clean coded hg. you woulnd't run into any of these problems.
zero posted the shellexecute line which is used to execute a program. there is, however, another function inside the shellexecute that is used which is createprocess. that function is strictly for the use of opening a program. shell can do other things though but createprocess is actually meant to open an exe/program. i advise that you look into studying these functions and become familiar with them so that you can come up with your own code to open and close an exe.
if you make a stable and clean coded hg. you woulnd't run into any of these problems.
<i>"Always write good code. Feel bad to write bad code."</i>
the first part i think u misunderstood there, i want it so that if a HG hangs on my PC my GM's can reboot it, without access to my PC, lol it would be pointless if i wanted it to reboot HG's myself i agree
and yes i agree if the HG was perfect then this wouldnt happen, but no matter what HG iv worked on, who's, or how stable they claim it to be, theres always some player who manages to find some completely random way of crashing the thing, and its just getting on my nerves:P
so i figured a remote map reboot was a better idea than the GM's having to wait around for the hoster to come home so they can get a map back up, i cant be the only one that has this problem surely?
hell even HBint GMs had to wait hours on end to get maps back up when they crashed.
oh /edit, you also implied that i was waiting for someone to do the code for me as you said you suggest i come up with my own code to do it, i just wanna make it clear that i always try my hardest to come up with my own code and only use what other people post as a guide.
so dont worry im not askin for babysitting here i was just makin sure i was on the right track
iv never actually learnt C++ everything i have coded i have figured out from lookin at the HB sources and backwards engeneering it to figure out whats goin on, thats why a lot of the time im guessing
also thats why a lot of the time i will post here first just to make sure my brain isnt randomly makin stuff up
and yes i agree if the HG was perfect then this wouldnt happen, but no matter what HG iv worked on, who's, or how stable they claim it to be, theres always some player who manages to find some completely random way of crashing the thing, and its just getting on my nerves:P
so i figured a remote map reboot was a better idea than the GM's having to wait around for the hoster to come home so they can get a map back up, i cant be the only one that has this problem surely?
hell even HBint GMs had to wait hours on end to get maps back up when they crashed.
oh /edit, you also implied that i was waiting for someone to do the code for me as you said you suggest i come up with my own code to do it, i just wanna make it clear that i always try my hardest to come up with my own code and only use what other people post as a guide.
so dont worry im not askin for babysitting here i was just makin sure i was on the right track
iv never actually learnt C++ everything i have coded i have figured out from lookin at the HB sources and backwards engeneering it to figure out whats goin on, thats why a lot of the time im guessing
also thats why a lot of the time i will post here first just to make sure my brain isnt randomly makin stuff up
createprocess - file: taskkill.exe params: /F /IM HGMAPNAME.exe
example would be the aresden town : HGARESDEN.exe. That way you can differentiate between hgs and don't close the wrong one. This will kill the hg without save or a popup. Only used for hanging apps.
After that, use shellexecute or createprocess as has been said.
STARTUPINFO si;
PROCESS_INFORMATION pi;
char * szCmdline = "taskkill.exe /F /IM hgname.exe";
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
CreateProcess( NULL, (LPTSTR*)szCmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi );//kills the hg
ShellExecute(NULL, "open", "<fully_qualified_path_to_folder>+hg", NULL, NULL, SW_SHOWNORMAL);//reopens it
example would be the aresden town : HGARESDEN.exe. That way you can differentiate between hgs and don't close the wrong one. This will kill the hg without save or a popup. Only used for hanging apps.
After that, use shellexecute or createprocess as has been said.
STARTUPINFO si;
PROCESS_INFORMATION pi;
char * szCmdline = "taskkill.exe /F /IM hgname.exe";
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
CreateProcess( NULL, (LPTSTR*)szCmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi );//kills the hg
ShellExecute(NULL, "open", "<fully_qualified_path_to_folder>+hg", NULL, NULL, SW_SHOWNORMAL);//reopens it
<img src='http://www.helbreathx.net/sig/sig.jpeg' border='0' alt='user posted image' /><br><a href='http://mafia.cheats4us.org/index.php?x=231030' target='_blank'>#1 on Mafia </a><br><!--QuoteBegin-Slipknight+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (Slipknight)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->100mb Internet, burstable too 10GB oc192<br>his speed can go up too 10gbs<br>...<br>Yes my car can have a top speed of 1000mph<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd--><br>^^ I wonder where the retard went to.