0 Members and 3 Guests are viewing this topic.
var Counter: integer;function OnCommand(ID: byte; Text: string): boolean;begin if Text = '/slots' then begin for Counter := 1 to 16 do begin if GetPlayerStat(Counter, 'active') then begin WriteConsole(ID,'Slot ' + inttostr(Counter) + ' is occupied by ' + IDToName(Counter) + '.',$FF0000); end; if GetPlayerStat(Counter, 'active') = false then begin WriteConsole(ID,'Slot ' + inttostr(Counter) + ' is inactive.',$FF0000); end; end; end; Result := false;end;
if GetPlayerStat(Counter, 'active') then begin
Whitespace in Soldat scripts uses too much disk space imo. :p
if GetPlayerStat(Counter, 'active') = true then begin
Super Vegeta, I didn't really make this for ARSSE. It is meant for in-game use.
Code: [Select]if GetPlayerStat(Counter, 'active') then begin should be Code: [Select]if GetPlayerStat(Counter, 'active') = true then begin sense GetPlayerStat returns variant, not boolean, and may not always work (i had a problem with this before, anything that returns a boolean, you can leave as just "if _ then")
Quote from: DorkeyDear on July 02, 2008, 05:02:14 pmCode: [Select]if GetPlayerStat(Counter, 'active') then begin should be Code: [Select]if GetPlayerStat(Counter, 'active') = true then begin sense GetPlayerStat returns variant, not boolean, and may not always work (i had a problem with this before, anything that returns a boolean, you can leave as just "if _ then")yeah but 'active' returns boolean. I tested it out, it does work.
Yahh.. w/e. It works and that's that.This script is useful if you think about it.You can check the ID of each player.
if not GetPlayerStat(Counter, 'active') then begin
Yahh.. w/e. It works and that's that.
Quote from: Bellamy on July 03, 2008, 12:38:39 amYahh.. w/e. It works and that's that.This script is useful if you think about it.You can check the ID of each player. Not really.and again - USE 'ELSE'!But if you want to get false from boolean you can useCode: [Select]if not GetPlayerStat(Counter, 'active') then begin
2) if i want to get false, i use '= false' its that easy.
varCounter: integer;function OnCommand(ID: byte; Text: string): boolean;begin if Text = '/slots' then begin for Counter := 1 to 16 do begin case GetPlayerStat(Counter, 'active') of True: WriteConsole(ID,'Slot '+inttostr(Counter)+' is occupied by '+IDToName(Counter)+'.',$FF0000); False: WriteConsole(ID,'Slot '+inttostr(Counter)+' is inactive.',$FF0000); end; end; Result := false; end;end;
if GetPlayerStat(Counter, 'active') then WriteConsole(ID,'Slot ' + inttostr(Counter) + ' is occupied by ' + IDToName(Counter) + '.',$FF0000)else WriteConsole(ID,'Slot ' + inttostr(Counter) + ' is inactive.',$FF0000);
function OnCommand(ID: Byte; Text: String): Boolean;var i: Integer;begin if LowerCase(Text) = '/slots' then  for i := 1 to 32 do   if GetPlayerStat(i, 'Active') then    WriteConsole(ID, 'Slot ' + IntToStr(i) + ' (' + GetPlayerStat(i, 'Name') + ') is occupied.', $FF0000);end;
wouldn't you want to use MaxPlayers instead of 32?