0 Members and 1 Guest are viewing this topic.
procedure SwitchBots(lvl: integer);var bots: byte; blvl: string;beginif lvl >= 0 then if lvl <= 3 then blvl := '1';if lvl >= 4 then if lvl <= 7 then blvl := '2';if lvl >= 8 then if lvl <= 11 then blvl := '3';if lvl >= 12 then if lvl <= 15 then blvl := '4';if lvl >= 16 then if lvl <= 19 then blvl := '5';if lvl >= 20 then if lvl <= 25 then blvl := '6';if lvl >= 26 then if lvl <= 30 then blvl := '7';if lvl >= 31 then if lvl <= 34 then blvl := '8';if lvl >= 35 then if lvl <= 39 then blvl := '9';if lvl >= 40 then if lvl <= 900 then blvl := '10';for bots := 1 to 16 do beginif botslot[bots] <> inigetvalue(botsini,blvl,inttostr(bots),'0') then beginCommand('/kick ' + inttostr(bots));Command('/addbot2 ' + inigetvalue(botsini,blvl,inttostr(bots),'0'));end;end;end;
procedure SwitchBots(lvl: integer);var bots: byte; bot_level: integer; i: integer; bot_level_data: array[1..9] of integer;begin // Populate an array - the key is the bot level we'll read from the .ini, and the value is the maximum level allowed to set this bot level. bot_level_data[1] := 3; bot_level_data[2] := 7; bot_level_data[3] := 11; bot_level_data[4] := 15; bot_level_data[5] := 19; bot_level_data[6] := 25; bot_level_data[7] := 30; bot_level_data[8] := 34; bot_level_data[9] := 39; // Note that the maximum level is NOT included in this array. // By default, set the bot level to the maximum, which is number of entries in the array + 1 (i.e. 10). bot_level := ArrayHigh(bot_level_data)+1; // Iterate through the array, and check which level of bots we should use. for i := 1 to ArrayHigh(bot_level_data) do begin if lvl <= bot_level_data[i] then begin bot_level = i; break; // Exit the for loop end; end; // If we didn't find a suitable level inside the array, then the old assignment to bot_level would assure that the bot level is now 10. // Loop through the bots... at this point I'm not certain what you're trying to do., so sorry, without any more information, I can't do much. for bots := 1 to 16 do begin if botslot[bots] <> inigetvalue(botsini, inttostr(bot_level), inttostr(bots), '0') then begin Command('/kick ' + inttostr(bots)); Command('/addbot2 ' + inigetvalue(botsini, inttostr(bot_level), inttostr(bots),'0')); end; end;end;
procedure AppOnIdle(Ticks: integer);var i: byte; buffer: integer;beginbuffer := 0; for i:= 1 to 32 do begin if getplayerstat(i,'human') then if not players[i].logged then begin if players[i].kt > 0 then dec(players[i].kt,1); DrawText(i,'You have ' + IntToStr(players[i].kt) + ' seconds',60,$FFFF0000,0.18,10,150); if players[i].kt = 0 then Command('/kick '+inttostr(i)); end; if getplayerstat(i,'active') then if players[i].logged then begin if players[i].mana > players[i].maxmana then players[i].mana := players[i].maxmana; if players[i].xp >= round(100 * (nextlvlm * strtofloat(inttostr(players[i].lvl)))) then begin players[i].xp := players[i].xp - round(100 * (nextlvlm * strtofloat(inttostr(players[i].lvl)))); LVLUP(i); end; if players[i].turrettime > 0 then begin dec(players[i].turrettime,1); DrawText(i,inttostr(players[i].turrettime),60,$FF555555,0.2,240,300); end; if players[i].turrettime = 0 then if players[i].turretout then begin KillObject(players[i].turretid); players[i].turretout := false; end; if IDToName(i) <> IGB[i].BName then Assign(i); if (IGB[i].BBonT >= 60) and (IGB[i].BBonus <> 255) then if Ticks mod IGB[i].BBonT = 0 then GiveBonus(i, IGB[i].BBonus); if IGB[i].BWeapon <> 255 then if (GetPlayerStat(i, 'Primary') <> IGB[i].BWeapon) or (GetPlayerStat(i, 'Secondary') <> 255) then ForceWeapon(i, IGB[i].BWeapon, 255, 0); //if (IGB[i].BHPReg <> 0) and GetPlayerStat(i,'Alive') then Regenerate(i); end; if IDToName(i) <> IGB[i].BName then Assign(i); if getplayerstat(i,'active') then if players[i].logged then begin buffer := buffer + players[i].lvl; end; if i <= 16 then begin botslot[i] := getplayerstat(i,'name'); end;end;SwitchBots(buffer);end;
procedure OnJoinTeam(ID, Team: byte);beginif ID > 16 then beginif not players[ID].logged then if not Team = 5 then beginCommand('/setteam5 ' + inttostr(ID));ShowInfo(ID,false);end;if Team = 2 then Command('/setteam1 ' + inttostr(ID));end;end;