Command | X values | Default | Description |
/flashhelp | - | - | Shows admin commands |
/flashmod X | 1/0 | 1 | Turn the script ON/OFF |
/flashwait X | seconds | 3 | Time till knife explodes (counted since hitting smth) |
/flashlen X | ticks? | 200 | Blinding time |
/flashrange X | distance | 700 | Blinding range |
/flashbreak X | minutes | 4 | Flash picking interval (not in Survival script: 1 flash/round there) |
Command | X values | Default | Description |
/flash | - | - | Gives player a flashbang as secondary |
!flash | - | - | Sends some info about the script |
(...)
if FlashesOnCount > 0 then
begin
for i:=1 to 128 do
begin
if (Flash[i].Counter > 1) then
begin
if (GetObjectStat(Flash[i].LinkedTo,'active') = true) then // If still on the ground
begin
// countinue countdown
Flash[i].Counter := Flash[i].Counter - 1;
end
else if (GetObjectStat(Flash[i].LinkedTo,'active') = false) then // If picked up during countdown
begin
WriteConsole(0,'Impressive! FlashBang picked up!',Yellow);
Flash[i].Counter := 0; // reset counter
FlashesOnCount := FlashesOnCount - 1; // substract picked knife
Flash[i].CounterStarted := FALSE; // reset vars so the flash can be used again
Flash[i].Used := FALSE;
ObjectLinked[Flash[i].LinkedTo] := FALSE; // unlink the object completely
end;
end;
if (Flash[i].Counter = 1) then // 1 because then there is no 2nd statement needed
begin
Flash[i].BlindMade := TRUE;
Flash[i].Counter := 0;
WriteConsole(0,' * Flash! * ',White);
for j:=1 to MaxPlayers do
if CheckFlash(i,j) = TRUE then Blind(j);
FlashesOnCount := FlashesOnCount - 1;
Flash[i].CounterStarted := FALSE;
Flash[i].Used := FALSE;
ObjectLinked[Flash[i].LinkedTo] := FALSE;
KillObject(Flash[i].LinkedTo); // totaly kill the knife (no longer on map)
end;
end;
end;
(...)
questions - does it include:
1. line-of-sight?
2. less time/less blinding if relatively far?
Sometimes flashes just don't blow up. I actually don't have any idea why but I'm gonna check it more minutely. For now: just change your weapons few times both before and after using "/flash" cmd. Let's say you arm your nade that way :P
if (...) then begin
if (...) then begin
if (...) then begin
(.....)
end;
end;
end;
if (...) AND (...) AND (...) then begin
(.....)
end;
if (ABC = true) then begin
if (DEF = false) then begin
(.....)
end;
end;
if (ABC) AND (not DEF) then begin
(.....)
end;
Instead of...Actually the first option is faster especially with heavy functions in conditions. If the first one is false then the rest is not checked unlike in the second example.Code: [Select]if (...) then begin
if (...) then begin
if (...) then begin
(.....)
end;
end;
end;
...you can just use:Code: [Select]if (...) AND (...) AND (...) then begin
(.....)
end;
Instead of...Actually the first option is faster especially with heavy functions in conditions. If the first one is false then the rest is not checked unlike in the second example.Code: [Select]if (...) then begin
if (...) then begin
if (...) then begin
(.....)
end;
end;
end;
...you can just use:Code: [Select]if (...) AND (...) AND (...) then begin
(.....)
end;
Also AND does not have to be written in upper case
if (condition1) then
if (condition2) then
...
else
...;
If it's like C, then I believe you are mistaken. as soon as the first false result occurs, it skips the rest. or is that just compiler-optimization? or are all conditions rendered first in soldat core?It doesn't skip the rest, it checks all
at any rate i case i have a question (if someone can answer )Under the second
Code: [Select]
if (condition1) then
if (condition2) then
...
else
...;
under which if-statement is does the else-statement operate. Is it the same in C as it is in soldat?
if (...) then begin
if (...) then begin
end;
end;
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);
repeat
(...)
until (...) or (...);
It's better to use AND/OR statements.
It's better to use AND/OR statements.it's better to back your points up. Care to elaborate?