@zxy:
So you think that the other conditions are also checked if you go by
if (...) then begin
if (...) then begin
end;
end;
If you need to handle such a code: (taken from a project by me)
if (Copy(Text,1,5) = '/grav') AND (Gravity_Enabled = true) then
if (GetPiece(Text,' ',1) <> '') then begin
try
Tmp2 := StrToFloat(GetPiece(Text,' ',1));
if (not ModifyGravity(Tmp2)) then
WriteConsole(ID,'ERROR: Input too high/low. Max: ' + FloatToStr(Gravity_Max) + ', Min: ' + FloatToStr(Gravity_Min), Bad)
else begin
WriteConsole(ID,'New gravity value: ' + FloatToStr(Tmp2), NotifierColour);
WriteConsole(0,'Gravity changed.', Yellow);
WriteLn('Gravity value was changed to ' + FloatToStr(Tmp2));
end;
except
WriteConsole(ID,'ERROR: Invalid input', Bad);
end;
end else WriteConsole(ID,'ERROR: Command: /grav X.XX', Bad);
You must use those if-elses, but more simple code like
repeat
(...)
until (...) or (...);
It's better to use AND/OR statements.