Home
2012-03-23 03:52:34
Hello, this is new CrashSmart function. I know that there is already like 3 ways of doing it but here is my version.
So how does this work.
It will Get current script Process ID and kills it after that it restarts simba and cleans traces after.
If you Download script that has Spaces and stuff. Rename it.
Ex.
WRONG. Narcles Fast Fighter.simba
CORRECT. NarclesFastFighter.simba
Usage: Ex. Script.
Ask questions if any.
Future update when newest Simba is released to you don't have to input Script Name anymore.
function WriteToFile(Text, FileName: string) :Boolean;
var
iFile: Integer;
begin
try
iFile := RewriteFile(ScriptPath + FileName, False);
Result := WriteFileString(iFile, Text);
CloseFile(iFile);
except
end;
end;
procedure CrashSmart(ScriptName :String);
var
T :TSysProcArr;
Pid, I :Integer;
Title :String;
begin
Disguise(ScriptName);
T := GetProcesses;
for I := 0 to High(T) do
If T[I].Title = ScriptName then
begin
Pid := T[I].Pid;
Title := T[I].Title;
Break;
end;
If FileExists(ScriptPath + 'RestartSimba' + ScriptName + IntToStr(PID) + '.cmd') then
begin
WriteLn('Calling Crash Smart File. Name : RestartSimba' + IntToStr(PID) + '.cmd');
OpenWebPage(ScriptPath + 'RestartSimba' + ScriptName + IntToStr(PID) + '.cmd');
WriteLn('Current Simba / Script Title : ' + Title + ' PID : ' + IntToStr(PID));
TerminateScript;
end;
WriteLn('Current Simba / Script Title : ' + Title + ' PID : ' + IntToStr(PID));
If WriteToFile('Taskkill /F /PID ' + IntToStr(PID) + #13 + #10 + 'cd ' + AppPath + #13 + #10 + 'Simba.exe -o ' + ScriptPath + ScriptName + ' -r' + #13 + #10 +
'ping -n 02 127.0.0.1 >NUL' + #13 + #10 + 'DEL ' + ScriptPath + 'RestartSimba' + ScriptName + IntToStr(PID) + '.cmd', 'RestartSimba' + ScriptName + IntToStr(PID) + '.cmd') then
WriteLn('Crash Smart File Created. Name : RestartSimba' + IntToStr(PID) + '.cmd');
end; So how does this work.
It will Get current script Process ID and kills it after that it restarts simba and cleans traces after.
CrashSmart('NarclesFastFighter.simba');You need to input your script name into CrashSmart. That's all.If you Download script that has Spaces and stuff. Rename it.
Ex.
WRONG. Narcles Fast Fighter.simba
CORRECT. NarclesFastFighter.simba
Usage: Ex. Script.
function WriteToFile(Text, FileName: string) :Boolean;
var
iFile: Integer;
begin
try
iFile := RewriteFile(ScriptPath + FileName, False);
Result := WriteFileString(iFile, Text);
CloseFile(iFile);
except
end;
end;
procedure CrashSmart(ScriptName :String);
var
T :TSysProcArr;
Pid, I :Integer;
Title :String;
begin
Disguise(ScriptName);
T := GetProcesses;
for I := 0 to High(T) do
If T[I].Title = ScriptName then
begin
Pid := T[I].Pid;
Title := T[I].Title;
Break;
end;
If FileExists(ScriptPath + 'RestartSimba' + ScriptName + IntToStr(PID) + '.cmd') then
begin
WriteLn('Calling Crash Smart File. Name : RestartSimba' + IntToStr(PID) + '.cmd');
OpenWebPage(ScriptPath + 'RestartSimba' + ScriptName + IntToStr(PID) + '.cmd');
WriteLn('Current Simba / Script Title : ' + Title + ' PID : ' + IntToStr(PID));
TerminateScript;
end;
WriteLn('Current Simba / Script Title : ' + Title + ' PID : ' + IntToStr(PID));
If WriteToFile('Taskkill /F /PID ' + IntToStr(PID) + #13 + #10 + 'cd ' + AppPath + #13 + #10 + 'Simba.exe -o ' + ScriptPath + ScriptName + ' -r' + #13 + #10 +
'ping -n 02 127.0.0.1 >NUL' + #13 + #10 + 'DEL ' + ScriptPath + 'RestartSimba' + ScriptName + IntToStr(PID) + '.cmd', 'RestartSimba' + ScriptName + IntToStr(PID) + '.cmd') then
WriteLn('Crash Smart File Created. Name : RestartSimba' + IntToStr(PID) + '.cmd');
end;
procedure RestartIt;
begin
CrashSmart('Home21200Run.simba');
end;
begin
CrashSmart('Home21200Run.simba');
Smart_Server := 39;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
SRL_Procs[srl_OnRSUpdate] := @RestartIt;
DeclarePlayers;
LoginPlayer;
end;Ask questions if any.
Future update when newest Simba is released to you don't have to input Script Name anymore.
~Home