Advertisement
Guest User

Untitled

a guest
Jan 13th, 2013
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 51.12 KB | None | 0 0
  1. code]{
  2. ZRPG EVOLVED by Hacktank
  3.  /-------------------\
  4.  |   Version 1.8.0   |
  5.  \-------------------/
  6.  Explode By CurryWurst and DorkeyDear
  7. }
  8.  
  9. const
  10.     accdir = 'scripts/zrpgevolved/accounts/';
  11.     botdir = 'scripts/zrpgevolved/bots/';
  12.     botlvlmod = 3;
  13.     maxcalclvl = 1000;
  14.     startmaxbots = 20;
  15.    
  16.     acclen=12;
  17.     aname=0;
  18.     apass=1;
  19.     alvl=2;
  20.     axp=3;
  21.     aspts=4;
  22.     amana=5;
  23.     amaxmana=6;
  24.     aextrahp=7;
  25.     admg=8;
  26.     afatalstate=9;
  27.     akazistl=10;
  28.     asouls=11;
  29.    
  30.     skilllen = 29;
  31.     sheal = 0;
  32.     snade = 1;
  33.     scluster = 2;
  34.     svanish = 3;
  35.     sturret = 4;
  36.     swave = 5;
  37.     sshield = 6;
  38.     sflamer = 7;
  39.     scrit = 8;
  40.     sfatalh = 9;
  41.     svamp = 10;
  42.     slootammo = 11;
  43.     slootitems = 12;
  44.     srage = 13;
  45.     sbarret = 14;
  46.     spush = 15;
  47.     sruger = 16;
  48.     smine = 17;
  49.     sbulletvortex = 18;
  50.     skazi = 19;
  51.     swarp = 20;
  52.     spsg = 21;
  53.     ssonicburst = 22;
  54.     ssoulshield = 23;
  55.     sbacklash = 24;
  56.     sreload = 25;
  57.     smissile = 26;
  58.     svulture = 27;
  59.     sfogshield = 28;
  60.    
  61.     sdamage = 0;
  62.     sfireinterval = 1;
  63.     sammo = 2;
  64.     sreloadtime = 3;
  65.     sspeed = 4;
  66.     sbulletstyle = 5;
  67.     sstartuptime = 6;
  68.     sbink = 7;
  69.     smovementacc = 8;
  70.     srecoil = 9;
  71.    
  72.     sbotlen = 15;
  73.     sbothealth = 0;
  74.     sbothealthreg = 1;
  75.     sbotweapon = 2;
  76.     sbotbonus = 3;
  77.     sbotdmg = 4;
  78.     sbotmana = 5;
  79.     sbotspts = 6;
  80.     sbotspc = 7;
  81.     sbotminxp = 8;
  82.     sbotmaxxp = 9;
  83.     sbotkind = 10;
  84.     sbotwaveammount = 11;
  85.     sbotwavestl = 12;
  86.     sbotwavespeed = 13;
  87.     sbotsouls = 14;
  88.    
  89.     snormal = 0;
  90.     ssdmg = 1;
  91.     smirror = 2;
  92.     skamakazi = 3;
  93.     scopycat = 4;
  94.    
  95.     totalbots = 17;
  96.     sbcopycat = 0;
  97.     sbdemon = 1;
  98.     sbdoppleganger = 2;
  99.     sbeliteslicerzombie = 3;
  100.     sbelitezombie = 4;
  101.     sbghoul = 5;
  102.     sbgrimreaper = 6;
  103.     sbkamakazi = 7;
  104.     sbmirror = 8;
  105.     sbmummy = 9;
  106.     sbnitrokamakazi = 10;
  107.     sbrocketzombie = 11;
  108.     sbslicerzombie = 12;
  109.     sbturncoat = 13;
  110.     sbvortex = 14;
  111.     sbzombie = 15;
  112.     sbxpbank = 16;
  113.    
  114.     smessages = 7;
  115.     shelp = 0;
  116.     snotloggedin = 1;
  117.     scommands = 2;
  118.     stimedinfo = 3;
  119.     sjoininfo = 4;
  120.     sadmincommands = 5;
  121.     srules = 6;
  122.  
  123. type vect = record
  124.     x,y,thea,radius: single;
  125.     end;
  126.  
  127. type minetype = record
  128.     x,y: single;
  129.     end;
  130.  
  131. type missiletype = record
  132.     active: boolean;
  133.     vec: vect;
  134.     target: byte;
  135.     end;
  136.  
  137. type psgtype = record
  138.     active: boolean;
  139.     vec: vect;
  140.     target: byte;
  141.     flame,ammo: integer;
  142.     end;
  143.    
  144. type plr = record
  145.     pass: string;
  146.     accname: string;
  147.     accountfileindex: integer;
  148.     autosavecountdown: integer;
  149.     logged: boolean;
  150.     allowbravo: boolean;
  151.     lastcommand: string;
  152.     lvl: integer;
  153.     xp: integer;
  154.     spts: integer;
  155.     mana: single;
  156.     maxmana: integer;
  157.     souls: single;
  158.     maxsouls: single;
  159.     extrahp: integer;
  160.     tempextrahp: integer;
  161.     dmg: single;
  162.     raging: boolean;
  163.     fatalstate: string;
  164.     kazistl: string;
  165.     soulshield: boolean;
  166.     turretid: integer;
  167.     turrettime: integer;
  168.     flamertime: integer;
  169.     hptimer: integer;
  170.     hptarget: byte;
  171.     missile: missiletype;
  172.     fogshield: boolean;
  173.     fogshieldchance: single;
  174.     secondarybuffer: byte;
  175.     canbacklash: boolean;
  176.     backlash: boolean;
  177.     inground: integer;
  178.     psg: psgtype;
  179.     skills: array[0..skilllen-1] of integer;
  180.     cooldown: array[0..skilllen-1] of integer;
  181.     mine: array of minetype;
  182.     end;
  183.  
  184. type sbottype = record
  185.     assigned: boolean;
  186.     heal: boolean;
  187.     flatdamage: integer;
  188.     lastshooter: byte;
  189.     infigun: boolean;
  190.     health: integer;
  191.     maxhealth: integer;
  192.     healthreg: integer;
  193.     weapon: byte;
  194.     bonus: byte;
  195.     dmg: single;
  196.     mana: single;
  197.     souls: single;
  198.     spts: integer;
  199.     spc: single;
  200.     minxp: integer;
  201.     maxxp: integer;
  202.     kind: byte;
  203.     waveammount: integer;
  204.     wavestl: byte;
  205.     wavespeed: single;
  206.     end;
  207.  
  208. type skilltype = record
  209.     cost: integer;
  210.     mcost: single;
  211.     scost: single;
  212.     minlvl: integer;
  213.     specint1: integer;
  214.     specint2: integer;
  215.     specfloat1: single;
  216.     specfloat2: single;
  217.     cooldown: integer;
  218.     end;
  219.  
  220. var
  221.     accounts: array of string;
  222.     player: array[1..32] of plr;
  223.     skills: array[0..skilllen] of array of skilltype;
  224.     weapons: array[0..16] of array[0..9] of integer;
  225.     bots: array[1..16] of array[1..16] of string;
  226.     sbot: array[1..32] of sbottype;
  227.     botstatics: array[0..totalbots] of sbottype;
  228.     botcost: array[0..totalbots-1] of integer;
  229.     botorder: array of integer;
  230.     messages: array[0..smessages-1] of string;
  231.     compiled,threadrunning,checkbots,accountfilechanged: boolean;
  232.     threadrestart,maxbots,totalaccounts,runningbotvalue: integer;
  233.  
  234. function Explode(Source: string; const Delimiter: string): array of string;
  235. var
  236.   Position, DelLength, ResLength: integer;
  237. begin
  238.   DelLength := Length(Delimiter);
  239.   Source := Source + Delimiter;
  240.   repeat
  241.     Position := Pos(Delimiter, Source);
  242.     SetArrayLength(Result, ResLength + 1);
  243.     Result[ResLength] := Copy(Source, 1, Position - 1);
  244.     ResLength := ResLength + 1;
  245.     Delete(Source, 1, Position + DelLength - 1);
  246.   until (Position = 0);
  247.   SetArrayLength(Result, ResLength - 1);
  248. end;
  249.  
  250. function XJoin(ary: array of string; splitter: string): string;
  251. var i: integer;
  252. begin
  253. result := ary[0];
  254. for i := 1 to getarraylength(ary)-1 do begin
  255.     result := result+splitter+ary[i];
  256.     end;
  257. end;
  258.  
  259. function sprintf(Mask: string; Input: array of variant): string;
  260. var cur,add: string; i,ii: integer;
  261. begin
  262. result := '';
  263. i := 0;
  264. ii := 0;
  265. cur := getpiece(mask,'%',i);
  266. while (cur <> nil) do begin
  267.     if i mod 2 = 0 then begin
  268.         add := cur;
  269.         end else begin
  270.             cur := lowercase(cur);
  271.             add := 'ERROR';
  272.             case cur of
  273.                 's': add := input[ii];
  274.                 'i': add := inttostr(input[ii]);
  275.                 'd': add := floattostr(input[ii]);
  276.                 'f': add := floattostr(input[ii]);
  277.                 end;
  278.             ii := ii + 1;
  279.             end;
  280.     i := i + 1;
  281.     cur := getpiece(mask,'%',i);
  282.     result := result + add;
  283.     end;
  284. end;
  285.  
  286. function GetSequentialFilename(Mask: string; Max: integer): string;
  287. var i: integer; newname: string;
  288. begin
  289. result := '';
  290. i := 0;
  291. while true do begin
  292.     newname := sprintf(mask,[i]);
  293.     if not fileexists(newname) then break;
  294.     if i >= max-1 then exit;
  295.     i := i + 1;
  296.     end;
  297. result := newname;
  298. end;
  299.  
  300. function CheckSum(const str: string): int64;
  301. var i: integer;
  302. begin
  303. result := 0;
  304. for i := 0 to length(str)-1 do result := result + ord(str[i]);
  305. end;
  306.  
  307. function StrComp(const s1,s2: string): integer;
  308. begin
  309. result := checksum(s2) - checksum(s1);
  310. end;
  311.  
  312. //The two functions below have been created by Curt (DorkeyDear), thanks for sharing!
  313. //#1
  314. function MonthDays(const Month: byte): byte;
  315. begin
  316.   case (Month) of
  317.     1, 3, 5, 7, 9, 11: Result := 31;
  318.     4, 6, 8, 10, 12: Result := 30;
  319.     2: Result := 28;
  320.   end;
  321. end;
  322. //#2
  323. function GetMiniTime(): int64;
  324. begin
  325.   Result :=
  326.   31536000000 * (StrtoInt(FormatDate('y')) - 2010) +
  327.   86400000 * MonthDays(StrtoInt(FormatDate('m'))) * StrtoInt(FormatDate('m')) +
  328.   86400000 * StrtoInt(FormatDate('d')) + 3600000 * StrtoInt(FormatDate('h')) +
  329.   60000 * StrtoInt(FormatDate('n')) +
  330.   1000 * StrtoInt(FormatDate('s')) +
  331.   StrtoInt(FormatDate('zzz'));
  332. end;
  333.  
  334. //
  335.  
  336. function IntToFloat(Num: integer): single;
  337. begin
  338. result := strtofloat(inttostr(num));
  339. end;
  340.  
  341. function CharMultiply(char: string; times: variant): string;
  342. var u: integer;
  343. begin
  344. result := '';
  345. for u := 1 to round(times) do begin
  346.     result := (result + char);
  347.     end;
  348. end;
  349.  
  350. function WrapValue(ValueRaw,Min,Max: variant; Flatten: boolean): variant;
  351. begin
  352. result := valueraw;
  353. if valueraw < min then result := iif(flatten=true,min,(max-(min-valueraw)));
  354. if valueraw > max then result := iif(flatten=true,max,(min+(valueraw-max)));
  355. end;
  356.  
  357. function Average(Values: array of variant): variant;
  358. var i,len: integer; total: variant;
  359. begin
  360. len := getarraylength(values);
  361. total := 0;
  362. for i := 0 to len - 1 do total := total + values[i];
  363. if len > 0 then result := total / len else result := 0;
  364. end;
  365.  
  366. function ContainsNum(Source,Test: string): integer;
  367. var temp: integer;
  368. begin
  369. repeat
  370.     temp := pos(test,source);
  371.     result := result + 1;
  372.     delete(source,1,temp);
  373.     until temp = 0;
  374. end;
  375.  
  376. function ToStr(Input: variant): string;
  377. begin
  378. case vartype(input) of
  379.     3: result := inttostr(input);
  380.     5: result := floattostr(input);
  381.     11: result := iif(input=true,'true','false');
  382.     256: result := input;
  383.     end;
  384. end;
  385.  
  386. function ParseNum(Input: string): string;
  387. var i,ii: integer; cur: string; sign,dot: boolean;
  388. begin
  389. result := '';
  390. for i := 1 to length(input) do begin
  391.     cur := copy(input,i,1);
  392.     if not sign then if cur = '-' then begin
  393.         result := result + cur;
  394.         sign := true;
  395.         end;
  396.     if not dot then if cur = '.' then begin
  397.         result := result + cur;
  398.         dot := true;
  399.         sign := true;
  400.         end;
  401.     for ii := 0 to 9 do if cur = inttostr(ii) then begin
  402.         result := result + cur;
  403.         sign := true;
  404.         end;
  405.     end;
  406. end;
  407.  
  408. function Choose(Input: array of variant): variant;
  409. var i,len: integer;
  410. begin
  411. len := getarraylength(input);
  412. i := random(0,len);
  413. if i < 0 then i := 0;
  414. if i > len-1 then i := len-1;
  415. result := input[i];
  416. end;
  417.  
  418. function Chance(Perc: single): boolean;
  419. begin
  420. result := (inttofloat(random(0,1000001))/1000000 < perc);
  421. end;
  422.  
  423. function Min(Input: array of variant): variant;
  424. var i: integer;
  425. begin
  426. result := input[0];
  427. for i := 1 to getarraylength(input)-1 do if input[i] < result then result := input[i];
  428. end;
  429.  
  430. function Maxnum(Input: array of variant): variant;
  431. var i: integer;
  432. begin
  433. result := input[0];
  434. for i := 1 to getarraylength(input)-1 do if input[i] > result then result := input[i];
  435. end;
  436.  
  437. function Frac(X: single): single;
  438. var delta: integer;
  439. begin
  440. result := 0;
  441. if x = 0 then exit;
  442. delta := iif(x<0,-1,1);
  443. x := x * delta;
  444. while(x>1) do begin
  445.     x := x - 1;
  446.     end;
  447. result := x * delta;
  448. end;
  449.  
  450. function Normalize(Value,Max: single): single;
  451. begin
  452. result := value;
  453. value := (value - max) / max;
  454. end;
  455.  
  456. function Atan2(Y,X: single): single;
  457. begin
  458. if y <> 0.0 then result := 2.0 * arctan(y/(x+sqrt(x*x+y*y)))
  459. else if x < 0.0 then result := pi else result := 0.0;
  460. end;
  461.  
  462. function addpolarspeed(Vec: vect; thea,radius: single): vect;
  463. var x,y,s,c: single;
  464. begin
  465. s := sin(vec.thea);
  466. c := cos(vec.thea);
  467. y := vec.radius * s;
  468. x := vec.radius * c;
  469.  
  470. s := sin(thea);
  471. c := cos(thea);
  472. x := x + radius * c;
  473. y := y + radius * s;
  474.  
  475. result.x := vec.x;
  476. result.y := vec.y;
  477. result.thea := atan2(y,x);
  478. result.radius := sqrt(x*x+y*y);
  479. end;
  480.  
  481. function CastRay(X1,Y1,X2,Y2,Accuracy: single; Maxdist: integer): single;
  482. var dst,dx,dy,h,d: single;
  483. begin
  484. result := 0;
  485. if accuracy <= 0 then exit;
  486. if raycast(x1,y1,x2,y2,d,maxdist) then begin
  487.     result := maxdist;
  488.     exit;
  489.     end;
  490. dst := accuracy;
  491. h := distance(x1,y1,x2,y2);
  492. dx := (x2 - x1);
  493. dy := (y2 - y1);
  494. while((raycast(x1+((dst-accuracy)/h)*dx,y1+((dst-accuracy)/h)*dy,x1+dst/h*dx,y1+dst/h*dy,d,maxdist)) AND (dst < maxdist)) do dst := dst + accuracy;
  495. if dst > maxdist then dst := maxdist;
  496. result := dst;
  497. end;
  498.  
  499. function Sort(input: array of integer): array of integer;
  500. // function Sort, by Hacktank, input an array of integers and it will output them in ascending order.
  501. var i,ii,first,last,len,cur: integer; used: array of boolean;
  502. begin
  503. len := getarraylength(input);
  504. setarraylength(result,len);
  505. setarraylength(used,len);
  506. for i := 0 to len-1 do begin
  507.     for ii := 0 to len-1 do if not used[ii] then begin
  508.         cur := input[ii];
  509.         first := ii;
  510.         break;
  511.         end;
  512.     last := first;
  513.     for ii := first to len-1 do if not used[ii] then if input[ii] < cur then begin
  514.         cur := input[ii];
  515.         last := ii;
  516.         end;
  517.     result[i] := cur;
  518.     used[last] := true;
  519.     end;
  520. end;
  521.  
  522. function Columnize(input: array of string; padding: string; maxrows: integer): array of string;
  523. var i,ci,clmax,cmax,columns,len,curcol: integer;
  524. begin
  525. len := getarraylength(input);
  526. if len = 0 then begin
  527.     setarraylength(result,1);
  528.     result[0] := '';
  529.     exit;
  530.     end;
  531. columns := (len div maxrows) + iif(len mod maxrows>0,1,0);
  532. if columns = 1 then begin
  533.     result := input;
  534.     exit;
  535.     end;
  536. ci := 0;
  537. curcol := 0;
  538. setarraylength(result,maxrows);
  539. while(curcol < columns) do begin
  540.     cmax := min([maxrows-1,len-ci-1]);
  541.     clmax := length(input[ci]);
  542.     for i := ci to ci+cmax do if length(input[i]) > clmax then clmax := length(input[i]);
  543.     for i := ci to ci+cmax do begin
  544.         result[i-ci] := result[i-ci] + input[i] + charmultiply(' ',clmax-length(input[i])) + iif(curcol<columns-1=true,padding,'');
  545.         end;
  546.     ci := i;
  547.     curcol := curcol + 1;
  548.     end;
  549. end;
  550.  
  551. procedure TextBoxOLD(ID: byte; inputraw: array of string; headline,ychar,xchar,corner: string; color: longint);
  552. var i,max,allignlength: byte; ii,len: integer; alligncontent,alligntype: string; input: array of string;
  553. begin
  554. max := length(headline);
  555. setarraylength(input,0);
  556. ii := 0;
  557. for i := 0 to getarraylength(inputraw)-1 do begin
  558.     if inputraw[i] <> '' then begin
  559.         ii := ii+1;
  560.         setarraylength(input,ii);
  561.         input[ii-1] := inputraw[i];
  562.         if length(input[ii-1]) > max then max := length(input[ii-1]);
  563.         end;
  564.     end;
  565. len := getarraylength(input);
  566. for i := 0 to len-1 do begin
  567.     if ((getpiece(input[i],' ',0) = 'center') OR (getpiece(input[i],' ',0) = 'right') OR (getpiece(input[i],' ',0) = 'left')) then begin
  568.         alligntype := getpiece(input[i],' ',0);
  569.         alligncontent := getpiece(input[i],alligntype+' ',1);
  570.         allignlength := length(alligncontent);
  571.         if alligntype = 'center' then input[i] := charmultiply(' ',(max-allignlength) div 2)+alligncontent;
  572.         if alligntype = 'right' then input[i] := charmultiply(' ',(max-allignlength))+alligncontent;
  573.         if alligntype = 'left' then input[i] := alligncontent+charmultiply(' ',(max-allignlength));
  574.         end;
  575.     if length(input[i]) > max then max := length(input[i]);
  576.     end;
  577. if ((ID >= 0) AND (ID <= 32)) then begin
  578.     writeconsole(ID,corner+charmultiply(xchar,(max-length(headline)) div 2)+headline+charmultiply(xchar,(max-length(headline)+0.4) div 2)+corner,color);
  579.     for i := 0 to len-1 do if input[i] <> '' then writeconsole(ID,ychar+input[i]+charmultiply(' ',max-length(input[i]))+ychar,color);
  580.     writeconsole(ID,corner+charmultiply(xchar,max)+corner,color);
  581.     end else begin
  582.         writeln(corner+charmultiply(xchar,(max-length(headline)) div 2)+headline+charmultiply(xchar,(max-length(headline)+0.4) div 2)+corner);
  583.         for i := 0 to len-1 do if input[i] <> '' then writeln(ychar+input[i]+charmultiply(' ',max-length(input[i]))+ychar);
  584.         writeln(corner+charmultiply(xchar,max)+corner);
  585.         end;
  586. end;
  587.  
  588. procedure TextBox(ID: byte; title,input,delim: string; wallx,wally,corner: char; color: longint);
  589. var i,lines,lines2,max,tempint,delimlen: integer; output,tempstr: string;
  590. begin
  591. output := '';
  592. max := length(title);
  593. delimlen := length(delim);
  594. i := 0;
  595. lines := 1;
  596. for i := 1 to length(input) do if copy(input,i,delimlen) = delim then lines := lines + 1;
  597. lines2 := lines;
  598. for i := 0 to lines-1 do begin
  599.     tempstr := getpiece(input,delim,i);
  600.     tempint := length(tempstr);
  601.     if tempint > max then max := tempint;
  602.     end;
  603. tempint := ((max-length(title)) div 2);
  604. output := output + corner + replicate(wallx,tempint) + title + replicate(wallx,max-(tempint+length(title))) + corner + delim;
  605. for i := 0 to lines-1 do begin
  606.     tempstr := getpiece(input,delim,i);
  607.     if tempstr = nil then begin
  608.         lines2 := lines2 - 1;
  609.         continue;
  610.         end;
  611.     tempint := length(tempstr);
  612.     output := output + wally;
  613.     case copy(tempstr,1,2) of
  614.         '\r': output := output + replicate(' ',max-(tempint-3)) + copy(tempstr,4,tempint-2);
  615.         '\l': output := output + copy(tempstr,4,tempint-3) + replicate(' ',max-(tempint-2));
  616.         '\c': output := output + replicate(' ',(max-(tempint-3)) div 2) + copy(tempstr,4,tempint-2) + replicate(' ',max-(tempint-3+(max-(tempint-3)) div 2));
  617.         else output := output + tempstr + replicate(' ',max-tempint);
  618.         end;
  619.     output := output + wally + delim;
  620.     end;
  621. output := output + corner + replicate(wallx,max) + corner;
  622. for i := 0 to lines2+1 do begin
  623.     tempstr := getpiece(output,delim,i);
  624.     if ((ID >= 0) AND (ID <= 32)) then
  625.         writeconsole(ID,tempstr,color)
  626.     else
  627.         writeln(tempstr);
  628.     end;
  629. end;
  630.  
  631. function GetAccountIndex(Account: string): integer;
  632. var i: integer; curcheck: string;
  633. begin
  634. result := -1;
  635. for i := 0 to totalaccounts-1 do begin
  636.     curcheck := getpiece(accounts[i],'*',0);
  637.     if ((curcheck <> '') AND (curcheck = account)) then begin
  638.         result := i;
  639.         break;
  640.         end else result := -1;
  641.     end;
  642. end;
  643.  
  644. procedure LoadAccounts();
  645. var i,prevaccs: integer; accountindexfile: array of string;
  646. begin
  647. writeln('Loading account file');
  648. accountindexfile := explode(readfile('scripts/'+scriptname+'/accountindex.txt'),#13+#10);
  649. prevaccs := strtoint(accountindexfile[0]);
  650. writeln('Previous accounts: ' + inttostr(prevaccs));
  651. if not fileexists('scripts/'+scriptname+'/accounts.txt') then begin
  652.     writeln('account file could not be found!');
  653.     exit;
  654.     end;
  655. accounts := explode(readfile('scripts/'+scriptname+'/accounts.txt'),'|');
  656. totalaccounts := getarraylength(accounts);
  657. writeln('Accounts: ' + inttostr(totalaccounts));
  658. if totalaccounts + 10 < prevaccs then begin
  659.     writeln('Account file corruption detected! Attempting auto backup restoration');
  660.     accounts := explode(readfile('scripts/'+scriptname+'/backup_prev_accounts.txt'),'|');
  661.     totalaccounts := getarraylength(accounts);
  662.     writeln('New total: ' + inttostr(totalaccounts));
  663.     end;
  664. accounts[totalaccounts-1] := copy(accounts[totalaccounts-1],0,length(accounts[totalaccounts-1])-3);
  665.  
  666. for i := 1 to 32 do if player[i].logged then begin
  667.     player[i].accountfileindex := getaccountindex(player[i].accname);
  668.     if player[i].accountfileindex < 0 then player[i].logged := false;
  669.     end;
  670.  
  671. writeln('Account file successfully loaded!');
  672. end;
  673.  
  674. procedure SaveAccounts();
  675. begin
  676. writeln('Saving account file');
  677. //movefile('scripts/'+scriptname+'/accounts.txt','scripts/'+scriptname+'/bac_prev_accounts.txt');
  678. writefile('scripts/'+scriptname+'/accounts.txt',xjoin(accounts,'|'));
  679. writefile('scripts/'+scriptname+'/accountindex.txt',inttostr(totalaccounts));
  680. writefile('scripts/'+scriptname+'/backup_prev_accounts.txt',xjoin(accounts,'|'));
  681. accountfilechanged := false;
  682. writeln('Account file saved successfully! Total: ' + inttostr(totalaccounts));
  683. end;
  684.  
  685. procedure BackupAccounts();
  686. var fname: string;
  687. begin
  688. {fname := getsequentialfilename('scripts/'+scriptname+'/backups/backup_'+formatdate('mm-dd')+'_%i%.txt',2);
  689. if fname = nil then fname := 'scripts/'+scriptname+'/backups/backup_'+formatdate('mm-dd')+'_CAP.txt';
  690. writefile(fname,readfile('scripts/'+scriptname+'/accounts.txt'));}
  691.  
  692. fname := 'scripts/'+scriptname+'/backups/backup_'+formatdate('mm-dd-yy')+'.txt';
  693. if not fileexists(fname) then writefile(fname,readfile('scripts/'+scriptname+'/accounts.txt'));
  694. end;
  695.  
  696. function GetSafeName(Input: string): string;
  697. begin
  698. result := regexpreplace('[/\///|/?/</>/:/*/"]',input,'_',true)
  699. end;
  700.  
  701. procedure FixSkills(ID: byte);
  702. var i: byte;
  703. begin
  704. for i := 0 to skilllen-1 do begin
  705.     if player[ID].skills[i] > getarraylength(skills[i])-1 then player[ID].skills[i] := getarraylength(skills[i])-1;
  706.     end;
  707. end;
  708.  
  709. procedure SetAccStatics(ID: byte);
  710. begin
  711. player[ID].maxmana := 10+player[ID].lvl*3;
  712. player[ID].maxsouls := 10+player[ID].lvl*1;
  713. player[ID].extrahp := player[ID].lvl*10;
  714. player[ID].dmg := 1+player[ID].lvl*0.05;
  715. end;
  716.  
  717. function Login(ID: byte; Name,Password: string): byte;
  718. var accountdata,skilldata: array of string; safename: string; i,index: integer;
  719. begin
  720. result := 0;
  721. safename := getsafename(name);
  722. index := getaccountindex(safename);
  723. if index >= 0 then begin
  724.     accountdata := explode(getpiece(accounts[index],':',0),'*');
  725.     setarraylength(accountdata,acclen);
  726.     skilldata := explode(getpiece(accounts[index],':',1),'*');
  727.     setarraylength(skilldata,skilllen);
  728.     if copy(httpencode(md5string(Password)),0,25) = copy(httpencode(accountdata[apass]),0,25) then begin
  729.         player[ID].accountfileindex := index;
  730.         writeln(getplayerstat(ID,'name') + ' hesaba giris yapildi: ' + name); // added by Pablo
  731.         for i := 0 to acclen-1 do begin
  732.             if accountdata[i] = '' then accountdata[i] := '0';
  733.             end;
  734.         for i := 0 to skilllen-1 do begin
  735.             if skilldata[i] = '' then skilldata[i] := '0';
  736.             end;
  737.         player[ID].pass := accountdata[apass];
  738.         player[ID].accname := safename;
  739.         player[ID].logged := true;
  740.         player[ID].lvl := strtoint(accountdata[alvl]);
  741.         player[ID].xp := strtoint(accountdata[axp]);
  742.         player[ID].spts := strtoint(accountdata[aspts]);
  743.         player[ID].mana := strtofloat(accountdata[amana]);
  744.         player[ID].maxmana := strtoint(accountdata[amaxmana]);
  745.         player[ID].souls := strtofloat(accountdata[asouls]);
  746.         player[ID].extrahp := strtoint(accountdata[aextrahp]);
  747.         player[ID].dmg := strtofloat(accountdata[admg]);
  748.         player[ID].fatalstate := accountdata[afatalstate];
  749.         player[ID].kazistl := accountdata[akazistl];
  750.         player[ID].soulshield := false;
  751.         for i := 0 to skilllen-1 do begin
  752.             player[ID].skills[i] := strtoint(skilldata[i]);
  753.             end;
  754.         fixskills(ID);
  755.         setaccstatics(ID);
  756.         player[ID].autosavecountdown := 60;
  757.         result := ID;
  758.         checkbots := true;
  759.         end else writeconsole(ID,'Parola yanlis',$ffff0000);
  760.     end else writeconsole(ID,'Hesap mevcut degil!',$ffff0000);
  761. end;
  762.  
  763. function Save(ID: byte): byte;
  764. var tempaccountdata,tempskilldata: array of string; tempaccount: string; i: integer;
  765. begin
  766. result := 0;
  767. if player[ID].logged then begin
  768.     setarraylength(tempaccountdata,acclen);
  769.     tempaccountdata[aname] := player[ID].accname;
  770.     tempaccountdata[apass] := player[ID].pass;
  771.     tempaccountdata[alvl] := inttostr(player[ID].lvl);
  772.     tempaccountdata[axp] := inttostr(player[ID].xp);
  773.     tempaccountdata[aspts] := inttostr(player[ID].spts);
  774.     tempaccountdata[amana] := floattostr(player[ID].mana);
  775.     tempaccountdata[amaxmana] := inttostr(player[ID].maxmana);
  776.     tempaccountdata[asouls] := floattostr(player[ID].souls);
  777.     tempaccountdata[aextrahp] := inttostr(player[ID].extrahp);
  778.     tempaccountdata[admg] := floattostr(player[ID].dmg);
  779.     tempaccountdata[afatalstate] := player[ID].fatalstate;
  780.     tempaccountdata[akazistl] := player[ID].kazistl;
  781.    
  782.     setarraylength(tempskilldata,skilllen);
  783.     for i := 0 to skilllen-1 do begin
  784.         tempskilldata[i] := inttostr(player[ID].skills[i]);
  785.         end;
  786.     result := ID;
  787.    
  788.     tempaccount := '';
  789.    
  790.     tempaccount := tempaccount + xjoin(tempaccountdata,'*');
  791.     tempaccount := tempaccount + ':';
  792.     tempaccount := tempaccount + xjoin(tempskilldata,'*');
  793.    
  794.     accounts[player[ID].accountfileindex] := tempaccount;
  795.     accountfilechanged := true;
  796.     end else writeconsole(ID,'Giris yapmadin!',$ffff0000);
  797. end;
  798.  
  799. procedure manager_getaccount(account: string);
  800. var accountdata,skilldata: array of string; safename: string; i,index: integer;
  801. begin
  802. safename := getsafename(account);
  803. index := getaccountindex(safename);
  804. if index >= 0 then begin
  805.     writeln(#2 + 'sen' + inttostr(length(accounts[index])) + #31 + accounts[index] + #4);
  806.     end else begin
  807.         writeln(#2 + 'mes' + inttostr(length('cannot find account')) + #31 + 'cannot find account' + #4);
  808.         end;
  809. end;
  810.  
  811. procedure manager_saveaccount(accountstr: string);
  812. var accname: string; index: integer;
  813. begin
  814. accname := getpiece(accountstr,'*',0);
  815. index := getaccountindex(accname);
  816. if index >= 0 then begin
  817.     accounts[index] := accountstr;
  818.     writeln(#2 + 'mes' + inttostr(length('saved')) + #31 + 'saved' + #4);
  819.     end else begin
  820.         writeln(#2 + 'mes' + inttostr(length('cannot find account')) + #31 + 'cannot find account' + #4);
  821.         end;
  822. end;
  823.  
  824. procedure Logout(ID: byte);
  825. var i: integer;
  826. begin
  827. player[ID].accountfileindex := -1;
  828. player[ID].pass := '';
  829. player[ID].accname := '';
  830. player[ID].logged := false;
  831. player[ID].allowbravo := false;
  832. player[ID].lastcommand := '';
  833. player[ID].lvl := 1;
  834. player[ID].xp := 0;
  835. player[ID].spts := 0;
  836. player[ID].mana := 0;
  837. player[ID].maxmana := 10;
  838. player[ID].souls := 1;
  839. player[ID].maxsouls := 10;
  840. player[ID].hptarget := ID;
  841. player[ID].hptimer := 0;
  842. player[ID].tempextrahp := 0;
  843. player[ID].soulshield := false;
  844. player[ID].extrahp := 0;
  845. player[ID].dmg := 1;
  846. player[ID].fatalstate := 'off';
  847. player[ID].kazistl := 'none';
  848. player[ID].turretid := -1;
  849. player[ID].turrettime := 0;
  850. player[ID].raging := false;
  851. player[ID].fogshield := false;
  852. player[ID].flamertime := 0;
  853. player[ID].psg.ammo := 0;
  854. setarraylength(player[ID].mine,0);
  855. for i := 0 to skilllen-1 do begin
  856.     player[ID].skills[i] := 0;
  857.     end;
  858. checkbots := true;
  859. end;
  860.  
  861. procedure ChangePass(ID: byte; Newpass: string);
  862. begin
  863. if player[ID].logged then begin
  864.     if (containsstring(player[ID].accname,'public') = false) AND (containsstring(player[ID].accname,'neg') = false) then begin
  865.         player[ID].pass := md5string(newpass);
  866.         save(ID);
  867.         writeconsole(ID,'Parola suna degistirildi '+newpass,$ff00ff00);
  868.         end else writeconsole(ID,'Hesabin sifresini degistiremezsin!',$ffff0000);
  869.     end else writeconsole(ID,'Giris yapmadin!',$ffff0000);
  870. end;
  871.  
  872. procedure Create(ID: byte; Name,Pass: string);
  873. var safename: string;
  874. begin
  875. safename := getsafename(name);
  876. if getaccountindex(safename) = -1 then begin
  877.     logout(ID);
  878.    
  879.     player[ID].accountfileindex := totalaccounts;
  880.     totalaccounts := totalaccounts + 1;
  881.     setarraylength(accounts,totalaccounts);
  882.    
  883.     player[ID].accname := safename;
  884.     player[ID].pass := md5string(pass);
  885.     player[ID].logged := true;
  886.     save(ID);
  887.     end else writeconsole(ID,'Bu isim kullaniliyor, baska bir tane dene!',$ffff0000);
  888. end;
  889.  
  890. function GetLvlXp(CurLvl: integer): integer;
  891. begin
  892. result := 200+(643*curlvl)+(curlvl*curlvl*18);
  893. end;
  894.  
  895. procedure LevelUp(ID: byte);
  896. var lvlinfo: string;
  897. begin
  898. dec(player[ID].xp,getlvlxp(player[ID].lvl));
  899. inc(player[ID].lvl,1);
  900. inc(player[ID].spts,8);
  901. player[ID].maxmana := player[ID].maxmana + 3;
  902. player[ID].maxsouls := player[ID].maxsouls + 1;
  903. if getplayerstat(ID,'human') then begin
  904.     inc(player[ID].extrahp,10);
  905.     player[ID].dmg := player[ID].dmg+0.05;
  906.     end;
  907. lvlinfo := '';
  908. lvlinfo := lvlinfo + 'Level atladin, yeni levelin '+inttostr(player[ID].lvl)+#6;
  909. lvlinfo := lvlinfo + '8 SP kazandin, mana ve soul duzenlendi'#6;
  910. lvlinfo := lvlinfo + 'Kullanilabilir beceriler icin /skills yazabilirsin';
  911. textbox(ID,'Level Up',lvlinfo,#6,'_','|','+',$ff339933);
  912. if player[ID].xp >= getlvlxp(player[ID].lvl) then levelup(ID);
  913. checkbots := true;
  914. end;
  915.  
  916. procedure AddXp(ID: byte; Ammount: integer);
  917. begin
  918. ammount := round(inttofloat(ammount) * (1+(player[ID].souls/player[ID].maxsouls)));
  919. inc(player[ID].xp,ammount);
  920. if player[ID].xp >= getlvlxp(player[ID].lvl) then levelup(ID);
  921. end;
  922.  
  923. procedure AddMana(ID: byte; Ammount: single);
  924. begin
  925. ammount := ammount * (1+(player[ID].souls/player[ID].maxsouls));
  926. player[ID].mana := player[ID].mana + ammount;
  927. if player[ID].mana > player[ID].maxmana then player[ID].mana := player[ID].maxmana;
  928. if player[ID].mana < 0 then player[ID].mana := 0;
  929. end;
  930.  
  931. procedure AddSouls(ID: byte; Ammount: single);
  932. begin
  933. player[ID].souls := player[ID].souls + ammount;
  934. if player[ID].souls > player[ID].maxsouls then player[ID].souls := player[ID].maxsouls;
  935. if player[ID].souls < 0 then player[ID].souls := 0;
  936. end;
  937.  
  938. procedure GiveSP(ID,Target: byte; Ammount: integer);
  939. var cursp: integer;
  940. begin
  941. cursp := player[ID].spts;
  942. if ID <> target then begin
  943.     if ammount > 0 then begin
  944.         if cursp - ammount >= 0 then begin
  945.             if getplayerstat(target,'active') then begin
  946.                 player[target].spts := player[target].spts + ammount;
  947.                 player[ID].spts := player[ID].spts - ammount;
  948.                 textbox(ID,' SP Transfer ','You give '+tostr(ammount)+' SP to '+getplayerstat(target,'name')+#6+'You have '+tostr(player[ID].spts)+' SP left',#6,'_','|','+',$ff55aa55);
  949.                 textbox(target,' SP Transfer ',getplayerstat(ID,'name')+'gave you '+tostr(ammount)+' SP'#6'You now have '+tostr(player[target].spts)+' SP',#6,'_','|','+',$ff55aa55);
  950.                 end else writeconsole(ID,'Player ID '+tostr(target)+' is not active',$ffaa5555);
  951.             end else writeconsole(ID,'You dont have '+tostr(ammount)+' SP',$ffaa5555);
  952.         end else writeconsole(ID,'You cannot give negative SP',$ffaa5555);
  953.     end else writeconsole(ID,'You cannot give SP to yourself...',$ffaa5555);
  954. end;
  955.  
  956. function SkillNameByNum(Number: integer; Long: boolean): string;
  957. begin
  958. result := '';
  959. if number = sheal then result := 'Heal' else
  960. if number = snade then result := 'Nade' else
  961. if number = scluster then result := 'Cluster' else
  962. if number = svanish then result := 'Vanish' else
  963. if number = sturret then result := 'Turret' else
  964. if number = swave then result := 'Wave' else
  965. if number = sshield then result := 'Shield' else
  966. if number = sflamer then result := 'Flamer' else
  967. if number = scrit then if long then result := 'Critical Hit' else result := 'Crit' else
  968. if number = sfatalh then if long then result := 'Fatal Hit' else result := 'FatalHit' else
  969. if number = svamp then if long then result := 'Vampirism' else result := 'Vamp' else
  970. if number = slootammo then if long then result := 'Loot Ammo' else result := 'LootAmmo' else
  971. if number = slootitems then if long then result := 'Loot Items' else result := 'LootItems' else
  972. if number = ssonicburst then if long then result := 'Sonic Burst' else result := 'SonicBurst' else
  973. if number = ssoulshield then if long then result := 'Soul Shield' else result := 'SoulShield' else
  974. if number = sbulletvortex then result := 'Bulletvortex' else
  975. if number = srage then result := 'Rage' else
  976. if number = sbarret then result := 'Barret' else
  977. if number = spush then result := 'Push' else
  978. if number = sruger then result := 'Ruger' else
  979. if number = smine then result := 'Mine' else
  980. if number = spsg then result := 'PSG' else
  981. if number = swarp then result := 'Warp' else
  982. if number = sbacklash then result := 'Backlash' else
  983. if number = skazi then if long then result := 'Kamakazi' else result := 'Kazi' else
  984. if number = svulture then if long then result := 'Vulture' else result := 'Vulture' else
  985. if number = sfogshield then if long then result := 'Fog Shield' else result := 'FogShield' else
  986. if number = sreload then result := 'Reload' else
  987. if number = smissile then result := 'Missile';
  988. end;
  989.  
  990. function SkillNumByName(Inputraw: string): integer;
  991. var input: string; i: byte;
  992. begin
  993. result := -1;
  994. input := lowercase(inputraw);
  995. for i := 0 to skilllen-1 do begin
  996.     if (lowercase(skillnamebynum(i,false))=input) OR (lowercase(skillnamebynum(i,true))=input) then result := i;
  997.     end;
  998. end;
  999.  
  1000. function BotNameByNum(Number: integer): string;
  1001. begin
  1002. result := '';
  1003. if number = sbcopycat then result := 'Copycat';
  1004. if number = sbdemon then result := 'Demon';
  1005. if number = sbdoppleganger then result := 'Doppleganger';
  1006. if number = sbeliteslicerzombie then result := 'Elite Slicer Zombie';
  1007. if number = sbelitezombie then result := 'Elite Zombie';
  1008. if number = sbghoul then result := 'Ghoul';
  1009. if number = sbgrimreaper then result := 'Grim Reaper';
  1010. if number = sbkamakazi then result := 'Kamakazi';
  1011. if number = sbmirror then result := 'Mirror';
  1012. if number = sbmummy then result := 'Mummy';
  1013. if number = sbnitrokamakazi then result := 'Nitro Kamakazi';
  1014. if number = sbrocketzombie then result := 'Rocket Zombie';
  1015. if number = sbslicerzombie then result := 'Slicer Zombie';
  1016. if number = sbturncoat then result := 'Turncoat';
  1017. if number = sbvortex then result := 'Vortex';
  1018. if number = sbzombie then result := 'Zombie';
  1019. if number = sbxpbank then result := 'xpbank';
  1020. end;
  1021.  
  1022. function BotNumByName(Inputraw: string): integer;
  1023. var input: string; i: byte;
  1024. begin
  1025. result := -1;
  1026. input := lowercase(inputraw);
  1027. for i := 0 to totalbots-1 do begin
  1028.     if lowercase(botnamebynum(i)) = input then result := i;
  1029.     end;
  1030. end;
  1031.  
  1032. function BotStatNameByNum(Number: integer; Long: boolean): string;
  1033. begin
  1034. result := '';
  1035. if number = sbothealth then result := 'Health';
  1036. if number = sbothealthreg then if long then result := 'Health Regen' else result := 'HPRegen';
  1037. if number = sbotweapon then result := 'Weapon';
  1038. if number = sbotbonus then result := 'Bonus';
  1039. if number = sbotdmg then if long then result := 'Damage Multiplyer' else result := 'DmgM';
  1040. if number = sbotmana then result := 'Mana';
  1041. if number = sbotspts then result := 'SP';
  1042. if number = sbotspc then if long then result := 'SP Chance' else result := 'SPC';
  1043. if number = sbotminxp then if long then result := 'Minimum Xp' else result := 'MinXP';
  1044. if number = sbotmaxxp then if long then result := 'Maximum Xp' else result := 'MaxXp';
  1045. if number = sbotkind then result := 'Kind';
  1046. if number = sbotwaveammount then if long then result := 'Wave Ammount' else result := 'WaveNum';
  1047. if number = sbotwavestl then if long then result := 'Wave Style' else result := 'WaveSTL';
  1048. if number = sbotwavespeed then if long then result := 'Wave Speed' else result := 'WaveSpeed';
  1049. end;
  1050.  
  1051. function BotStatNumByName(Inputraw: string): integer;
  1052. var input: string; i: byte;
  1053. begin
  1054. result := -1;
  1055. input := lowercase(inputraw);
  1056. for i := 0 to sbotlen-1 do begin
  1057.     if (botstatnamebynum(i,false)=input) OR (botstatnamebynum(i,true)=input) then result := i;
  1058.     end;
  1059. end;
  1060.  
  1061. function CheckSkillName(Name: string): string;
  1062. var i: byte; curskill: string;
  1063. begin
  1064. result := '';
  1065. if (name <> '') then begin
  1066.     curskill := lowercase(name);
  1067.     for i := 0 to skilllen do if curskill = lowercase(skillnamebynum(i,false)) then result := curskill;
  1068.     end;
  1069. end;
  1070.  
  1071. function CheckBotName(Name: string): string;
  1072. begin
  1073. result := '';
  1074. if (name <> '') AND (getpiece(name,'[',1) = '') then begin
  1075.     if fileexists('bots/'+name+'.bot') then result := name else result := 'Zombie';
  1076.     end;
  1077. end;
  1078.  
  1079. function FloatRandom(Min,Max: single): single;
  1080. begin
  1081. result := random(round(min*100000),round(max*100000))/100000;
  1082. end;
  1083.  
  1084. function Aim(const X1,Y1,X2,Y2: single) : single;
  1085. begin if (X2 - X1)<>0 then begin if X1 > X2 then  result:= arctan((y2 - y1) / (x2 - x1)) + Pi
  1086. else result:= arctan((y2 - y1) / (x2 - x1)); end else begin if Y2 > Y1 then result:= Pi/2 + Pi/4;
  1087. if Y2 < Y1 then result:= -Pi/2 + Pi/4; end;
  1088. end;
  1089.  
  1090. function GPH(ID: byte): integer;
  1091. begin
  1092. result := round(inttofloat(getplayerstat(ID,'health'))*(inttofloat(sbot[ID].maxhealth+player[ID].extrahp+player[ID].tempextrahp)/150));
  1093. end;
  1094.  
  1095. function player_raycast(ID: byte): boolean;
  1096. var x,y,dist: single;
  1097. begin
  1098. result := true;
  1099. x := getplayerstat(ID,'x') + iif(getplayerstat(ID,'direction') = '>', 3, -3);
  1100. y := getplayerstat(ID,'y') - 11;
  1101. if (raycast(x,y-0.1,x,y+0.1,dist,1)=false) AND (raycast(x,y+10.5,x,y+11.5,dist,1)=false) AND (raycast(x-0.1,y,x+0.1,y,dist,1)=false) then result := false;
  1102. end;
  1103.  
  1104. procedure ShowConsumables(ID,ToShow: byte);
  1105. var times1,maxtimes1,times2,maxtimes2: integer; manastr,soulstr: string;
  1106. begin
  1107. maxtimes1 := 15;
  1108. times1 := round(maxtimes1/(player[ID].maxmana/player[ID].mana));
  1109. maxtimes2 := 5;
  1110. times2 := round(maxtimes2/(player[ID].maxsouls/player[ID].souls));
  1111. if (toshow=0) OR (toshow=1) then manastr := 'Mana - ('+charmultiply('/',times1)+charmultiply('-',maxtimes1-times1)+') - '+tostr(roundto(player[ID].mana,2))+'/'+tostr(roundto(player[ID].maxmana,2));
  1112. if (toshow=0) OR (toshow=2) then soulstr := '   Souls - ('+charmultiply('/',times2)+charmultiply('-',maxtimes2-times2)+') - '+tostr(roundto(player[ID].souls,2))+'/'+tostr(roundto(player[ID].maxsouls,2));
  1113. writeconsole(ID,manastr+soulstr,$ff808080);
  1114. end;
  1115.  
  1116. procedure AddAmmo(ID: byte; ammo: integer);
  1117. var fammo, buff1: integer; curwep: byte;
  1118. begin
  1119. curwep := getplayerstat(ID,'primary');
  1120. if curwep <> 255 then begin
  1121.     fammo := ammo;
  1122.     buff1 := weapons[curwep][sammo];
  1123.     if fammo = 0 then fammo := 1;
  1124.     if (getplayerstat(ID,'ammo') + ammo) > buff1 then fammo := (buff1 - getplayerstat(ID,'ammo'));
  1125.     if (curwep = 5) then dec(fammo,1);
  1126.     if (getplayerstat(ID,'alive')=true) AND (fammo > 0) AND (getplayerstat(ID,'ammo') < buff1) then begin
  1127.         forceweapon(ID,curwep,getplayerstat(ID,'secondary'),getplayerstat(ID,'ammo')+fammo);
  1128.         writeconsole(ID,'Elde edildi -:- ' + inttostr(fammo) + ' mermi',$ff5555ff);
  1129.         end;
  1130.     end;
  1131. end;
  1132.  
  1133. function ScaleNumber(Value,Max,Tmax: integer): integer;
  1134. begin
  1135. result := round((inttofloat(value)*(max/inttofloat(tmax))));
  1136. end;
  1137.  
  1138. procedure AllDraw(ID: byte);
  1139. var hp,hp2,hpam,flamerdraw,turretdraw,ragedraw,psgdraw: string; times,timesvest,maxtimes: integer;
  1140. begin
  1141. hp := '';
  1142. hp2 := '';
  1143. if player[ID].hptimer > 0 then if sbot[player[ID].hptarget].health > 0 then begin
  1144.     maxtimes := 15;
  1145.     times := round(inttofloat(maxtimes)/(inttofloat((sbot[player[ID].hptarget].maxhealth+player[player[ID].hptarget].extrahp+player[player[ID].hptarget].tempextrahp))/inttofloat(sbot[player[ID].hptarget].health)));
  1146.     if getplayerstat(player[ID].hptarget,'vest') > 0 then timesvest := round((maxtimes div 2)/(100/inttofloat(getplayerstat(player[ID].hptarget,'vest'))));
  1147.     hp := '   '+(getplayerstat(player[ID].hptarget,'name')+' : ('+charmultiply('/',times)+charmultiply('-',maxtimes-times)+')'+iif(timesvest>0,' - ('+charmultiply('/',timesvest)+charmultiply('-',(maxtimes div 2)-timesvest)+')',''));
  1148.     hpam := inttostr(sbot[player[ID].hptarget].health)+'/'+inttostr(player[player[ID].hptarget].extrahp+player[player[ID].hptarget].tempextrahp+sbot[player[ID].hptarget].maxhealth);
  1149.     hp2 := '   '+charmultiply(' ',(inttofloat(length(hp)) div 2)-(inttofloat(length(hpam)) div 2))+hpam;
  1150.     end;
  1151. if player[ID].psg.ammo > 0 then psgdraw := ('PSG: ' + inttostr(player[ID].psg.ammo)) else psgdraw := '';
  1152. if player[ID].turrettime > 0 then turretdraw := ('Turret: ' + inttostr(player[ID].turrettime)) else turretdraw := '';
  1153. if player[ID].flamertime > 0 then flamerdraw := ('Flamer: ' + inttostr(player[ID].flamertime)) else flamerdraw := '';
  1154. DrawText(ID,' Level: '+inttostr(player[ID].lvl)+chr(10)+' XP: '+inttostr(player[ID].xp)+'/'+inttostr(getlvlxp(player[ID].lvl))+hp+chr(13)+chr(10)+' Mana: '+tostr(roundto(player[ID].mana,2))+'/'+tostr(roundto(player[ID].maxmana,2))+hp2+chr(13)+chr(10)+' Souls: '+tostr(roundto(player[ID].souls,2))+'/'+tostr(roundto(player[ID].maxsouls,2))+chr(13)+chr(10)+charmultiply(' ',5)+flamerdraw+charmultiply(' ',18-length(flamerdraw))+turretdraw+charmultiply(' ',18-length(psgdraw))+psgdraw,300,$ffffffff,0.06,15,350);
  1155. end;
  1156.  
  1157. procedure SetPlayerHealth(ID: byte; Health,Vest: integer; RecalcHealth: boolean);
  1158. var chealth,cvest,delta,failsafe: integer;
  1159. begin
  1160. chealth := getplayerstat(ID,'health');
  1161. cvest := getplayerstat(ID,'vest');
  1162. if recalchealth then sbot[ID].health := round(health*(inttofloat(sbot[ID].maxhealth+player[ID].extrahp+player[ID].tempextrahp)/150));
  1163. if (chealth=health) AND (cvest=vest) then exit;
  1164. if chealth = 0 then dodamage(ID,1000);
  1165. if vest = 0 then begin
  1166.     failsafe := 0;
  1167.     while(cvest > 0) do begin
  1168.         sbot[ID].flatdamage := sbot[ID].flatdamage + 1;
  1169.         dodamage(ID,2);
  1170.         cvest := cvest - 1;
  1171.         failsafe := failsafe + 1;
  1172.         if failsafe > 300 then break;
  1173.         end;
  1174.     sbot[ID].flatdamage := sbot[ID].flatdamage + 1;
  1175.     dodamage(ID,chealth-health);
  1176.     exit;
  1177.     end else begin
  1178.         if cvest = 0 then begin
  1179.             givebonus(ID,3);
  1180.             cvest := 100;
  1181.             end;
  1182.         failsafe := 0;
  1183.         while(chealth <> health) do begin
  1184.             sbot[ID].flatdamage := sbot[ID].flatdamage + 1;
  1185.             if chealth < health then delta := -1 else delta := 1;
  1186.             dodamage(ID,3*delta);
  1187.             chealth := chealth - delta;
  1188.             cvest := wrapvalue(cvest - delta,0,100,true);
  1189.             if cvest = 0 then begin
  1190.                 givebonus(ID,3);
  1191.                 cvest := 100;
  1192.                 end;
  1193.             if cvest <> vest then begin
  1194.                 sbot[ID].flatdamage := sbot[ID].flatdamage + 1;
  1195.                 if cvest < vest then delta := -1 else delta := 1;
  1196.                 dodamage(ID,2*delta);
  1197.                 cvest := cvest - delta;
  1198.                 end;
  1199.             failsafe := failsafe + 1;
  1200.             if failsafe > 300 then break;
  1201.             end;
  1202.         failsafe := 0;
  1203.         while(cvest <> vest) do begin
  1204.             sbot[ID].flatdamage := sbot[ID].flatdamage + 1;
  1205.             if cvest < vest then delta := -1 else delta := 1;
  1206.             dodamage(ID,2*delta);
  1207.             cvest := cvest - delta;
  1208.             failsafe := failsafe + 1;
  1209.             if failsafe > 300 then break;
  1210.             end;
  1211.         exit;
  1212.         end;
  1213. givebonus(ID,3);
  1214. cvest := 100;
  1215. failsafe := 0;
  1216. while(cvest > vest) do begin
  1217.     sbot[ID].flatdamage := sbot[ID].flatdamage + 1;
  1218.     dodamage(ID,2);
  1219.     cvest := cvest - 1;
  1220.     if failsafe > 600 then break;
  1221.     end;
  1222. end;
  1223.  
  1224. procedure SyncHealth(ID: byte);
  1225. var chealth,rhealth: integer;
  1226. begin
  1227. if getplayerstat(ID,'human') then begin
  1228.     chealth := getplayerstat(ID,'health');
  1229.     if chealth <= 0 then exit;
  1230.     if sbot[ID].health <= 0 then begin
  1231.         sbot[ID].flatdamage := sbot[ID].flatdamage + 1;
  1232.         dodamageby(ID,sbot[ID].lastshooter,chealth);
  1233.         exit;
  1234.         end;
  1235.     rhealth := scalenumber(sbot[ID].health,150,player[ID].extrahp+player[ID].tempextrahp+sbot[ID].maxhealth);
  1236.     if chealth = rhealth then exit;
  1237.     if rhealth = 0 then rhealth := 1;
  1238.     setplayerhealth(ID,rhealth,getplayerstat(ID,'vest'),false);
  1239.     end;
  1240. end;
  1241.  
  1242. procedure AddHealth(ID,Shooter: byte; Ammount: integer);
  1243. begin
  1244. sbot[ID].lastshooter := shooter;
  1245. sbot[ID].health := min([sbot[ID].health+ammount,sbot[ID].maxhealth+player[ID].extrahp+player[ID].tempextrahp]);
  1246. synchealth(ID);
  1247. end;
  1248.  
  1249. procedure TimeHeal(ID: byte);
  1250. var health: byte;
  1251. begin
  1252. if getplayerstat(ID,'alive') then begin
  1253.     if getplayerstat(ID,'human') then begin
  1254.         health := getplayerstat(ID,'health');
  1255.         if health = 150 then begin
  1256.             sbot[ID].health := sbot[ID].maxhealth+player[ID].extrahp+player[ID].tempextrahp;
  1257.             end;
  1258.         end else addhealth(ID,ID,sbot[ID].healthreg);
  1259.     end;
  1260. end;
  1261.  
  1262. procedure DeathExplode(ID: byte);
  1263. var i: integer;
  1264. begin
  1265. if sbot[ID].waveammount > 0 then for i := 1 to sbot[ID].waveammount do createbullet(getplayerstat(ID,'x'),getplayerstat(ID,'y')-11,floatrandom(-sbot[ID].wavespeed,sbot[ID].wavespeed),floatrandom(-sbot[ID].wavespeed,sbot[ID].wavespeed),100,sbot[ID].wavestl,ID);
  1266. end;
  1267.  
  1268. procedure BWave(X,Y,Direction,Offset,Radius,Speed,Power,RoomPerBullet,Radiation: single; Bullettype,Bulletcount,Owner: byte);
  1269. var i: integer; angle,centerX,centerY: single;
  1270. begin centerX:=X-cos(Direction)*Radius; centerY:=Y-sin(Direction)*Radius; angle := (Bulletcount * RoomPerBullet) / (2 * pi * Radius);
  1271. for i:=-Bulletcount div 2 to Bulletcount div 2 + Bulletcount mod 2 do CreateBullet(centerX+cos(Direction+angle*i)*Radius+cos(Direction)*Offset,centerY+sin(Direction+angle*i)*Radius+sin(Direction)*Offset, cos(Direction+angle*i*Radiation)*Speed, sin(Direction+angle*i*Radiation)*speed,power,Bullettype,Owner);
  1272. end;
  1273.  
  1274. procedure BulletCircle(X,Y,Radius,Speed: single; Bullets: integer; BulletStyle,Owner: byte);
  1275. var i: integer; thea,s,c,xm,ym,xspeed,yspeed: single;
  1276. begin
  1277. for i := 1 to bullets do begin
  1278.     thea := i*(pi*2.0/bullets);
  1279.     c := cos(thea);
  1280.     s := sin(thea);
  1281.     xm := radius * c;
  1282.     ym := radius * s;
  1283.     xspeed := speed * c;
  1284.     yspeed := speed * s;
  1285.     createbullet(x-xm,y-ym,xspeed,yspeed,5,bulletstyle,owner);
  1286.     end;
  1287. end;
  1288.  
  1289. procedure DirBullet(sx,sy,dx,dy,speed,damage: single; bulletstyle,owner: byte);
  1290. var dist,xx,yy,vx,vy,k: single;
  1291. begin
  1292. xx := sx - dx;
  1293. yy := sy - dy;
  1294. dist := sqrt((xx*xx)+(yy*yy));
  1295. if dist > 0 then begin
  1296.     k := speed / dist;
  1297.     vx := (dx - sx) * k;
  1298.     vy := (dy - sy) * k;
  1299.     createbullet(sx,sy,vx,vy,damage,bulletstyle,owner);
  1300.     end;
  1301. end;
  1302.  
  1303. procedure DoSdmg(BotID,HumanID: byte; Damage: integer);
  1304. var dmgtd: integer; wep: byte;
  1305. begin
  1306. wep := getplayerstat(humanid,'primary');
  1307. if (wep = 7) OR (wep = 16) then exit;
  1308. dmgtd := round(damage*0.1*sbot[botid].dmg);
  1309. if sbot[humanid].health-dmgtd <= 0 then dmgtd := sbot[humanid].health - 1;
  1310. addhealth(humanid,botid,-dmgtd);
  1311. end;
  1312.  
  1313. procedure DoCopyCat(Killer,Victim: byte);
  1314. var wep: byte;
  1315. begin
  1316. wep := getplayerstat(victim,'primary');
  1317. if (wep <> 255) then sbot[killer].weapon := wep;
  1318. end;
  1319.  
  1320. procedure DoVamp(ID: byte; Damage: integer);
  1321. var heal: integer; mult: single;
  1322. begin
  1323. if damage <= 0 then exit;
  1324. mult := skills[svamp][player[ID].skills[svamp]].specfloat1;
  1325. heal := round((damage*mult)+0.6);
  1326. addhealth(ID,ID,heal);
  1327. end;
  1328.  
  1329. procedure MirrorBullet(ID, Target: byte);
  1330. var bulstl,tarwep: byte; bulspeed,damage,x1,y1,x2,y2: single;
  1331. begin
  1332. tarwep := getplayerstat(target,'primary');
  1333. if (tarwep >= 0) AND (tarwep <= 16) then begin
  1334.     bulstl := weapons[tarwep][sbulletstyle];
  1335.     x1 := getplayerstat(ID,'x');
  1336.     y1 := getplayerstat(ID,'y')-11;
  1337.     x2 := getplayerstat(target,'x');
  1338.     y2 := getplayerstat(target,'y')-11;
  1339.     damage := 3;
  1340.     if bulstl = 12 then begin
  1341.         //damage := damage * 5;
  1342.         bulspeed := bulspeed * 3;
  1343.         end;
  1344.     if bulstl = 1 then bulstl := 14;
  1345.     bulspeed := inttofloat(weapons[tarwep][sspeed])*0.06;
  1346.     dirbullet(x1,y1,x2,y2,bulspeed,damage,bulstl,ID);
  1347.     end;
  1348. end;
  1349.  
  1350. procedure DoLootAmmo(ID: byte);
  1351. var maxam,ammo: integer; curwep: byte;
  1352. begin
  1353. curwep := getplayerstat(ID,'primary');
  1354. if (curwep >= 0) AND (curwep <= 16) then if chance(skills[slootammo][player[ID].skills[slootammo]].specfloat1) then begin
  1355.     maxam := weapons[curwep][sammo];
  1356.     ammo := round(maxam/5)+random(1,round(maxam/4));
  1357.     addammo(ID,ammo);
  1358.     end;
  1359. end;
  1360.  
  1361. procedure DoBacklash(ID,Target: byte);
  1362. begin
  1363. if player[ID].mana >= skills[sbacklash][player[ID].skills[sbacklash]].mcost then if player[ID].souls >= skills[sbacklash][player[ID].skills[sbacklash]].scost then begin
  1364.     bwave(getplayerstat(ID,'x'),getplayerstat(ID,'y'),aim(getplayerstat(ID,'x'),getplayerstat(ID,'y'),getplayerstat(target,'x'),getplayerstat(target,'y')),3,1,8,2,0.5,1,14,skills[sbacklash][player[ID].skills[sbacklash]].specint1,ID);
  1365.     dirbullet(getplayerstat(ID,'x'),getplayerstat(ID,'y')-11,getplayerstat(target,'x'),getplayerstat(target,'y')-11,25,6,14,ID);
  1366.     writeconsole(ID,'Backlash',$ffff0000);
  1367.     player[ID].mana := player[ID].mana - skills[sbacklash][player[ID].skills[sbacklash]].mcost;
  1368.     player[ID].souls := player[ID].souls - skills[sbacklash][player[ID].skills[sbacklash]].scost;
  1369.     player[ID].canbacklash := false;
  1370.     end;
  1371. end;
  1372.  
  1373. function DoSoulShield(ID: byte; Dmg: integer): boolean;
  1374. var scost: single;
  1375. begin
  1376. result := false;
  1377. dmg := round(inttofloat(dmg)*(inttofloat(sbot[ID].maxhealth+player[ID].extrahp+player[ID].tempextrahp)/150));
  1378. scost := inttofloat(dmg)*skills[ssoulshield][player[ID].skills[ssoulshield]].specfloat1;
  1379. if player[ID].souls > scost then begin
  1380.     result := true;
  1381.     player[ID].souls := player[ID].souls - scost;
  1382.     showconsumables(ID,2);
  1383.     end else begin
  1384.         player[ID].soulshield := false;
  1385.         writeconsole(ID,'You have run out of souls to bear your damage',$ff5555ff);
  1386.         end;
  1387. end;
  1388.  
  1389. function DoFogShield(ID: byte; Dmg: integer): boolean;
  1390. var scost: single;
  1391. begin
  1392. result := false;
  1393. result := chance(player[ID].fogshieldchance);
  1394. if result then begin
  1395.     player[ID].fogshieldchance := player[ID].fogshieldchance - skills[sfogshield][player[ID].skills[sfogshield]].specfloat2;
  1396.     writeconsole(ID,'You have been missed due to your etherial form',$ff5555ff);
  1397.     writeconsole(ID,'Your miss chance is now ' + floattostr(roundto(player[ID].fogshieldchance*100.0,2)) + '%',$ff5555ff);
  1398.     end;
  1399. end;
  1400.  
  1401. procedure GivePower(ID: byte);
  1402. var power: byte; hp: integer;
  1403. begin
  1404. try
  1405. power := sbot[ID].bonus;
  1406. if power = 1 then hp := getplayerstat(ID,'health');
  1407. if power <> 255 then begin
  1408.     givebonus(ID,power);
  1409.     //if power = 1 then setplayerhealth(ID,hp,getplayerstat(ID,'vest'),false);
  1410.     end;
  1411. except end;
  1412. end;
  1413.  
  1414. function RangePlayer(Team: byte; X1,Y1,MinDist,MaxDist: single; TypeState: byte; UseRaycast: boolean): byte;
  1415. var i: byte; cands: array of byte; dst, raydist, x2,y2: single;
  1416. begin
  1417. for i := 1 to 32 do if getplayerstat(i,'active')=true then begin
  1418.     x2 := getplayerstat(i,'x');
  1419.     y2 := getplayerstat(i,'y');
  1420.     dst:=distance(X1,Y1,X2,Y2);
  1421.     if (dst>=mindist) AND (dst<=maxdist) AND (getplayerstat(i,'alive')=true) AND ((getplayerstat(i,'team')<>team) OR (team=0) OR (team=5)) AND ((((useraycast=true) AND (raycast(x1,y1,x2,y2,raydist,round(maxdist))=true)) OR (useraycast=false))) AND (((typestate=1) AND (getplayerstat(i,'human')=true)) OR ((typestate=2) AND (getplayerstat(i,'human')=false)) OR (typestate=0)) then begin
  1422.         setarraylength(cands,getarraylength(cands)+1);
  1423.         cands[getarraylength(cands)-1] := i;
  1424.         end;
  1425.     end;
  1426. if getarraylength(cands)>1 then result := cands[random(0,getarraylength(cands))] else result := 0
  1427. end;
  1428.  
  1429. function NearestPlayer(Team: byte; X1,Y1,MinDist,MaxDist: single; TypeState: byte; UseRaycast: boolean): byte;
  1430. var i,curlow: byte; x2, y2, curdst, lowdist, raydist: single;
  1431. begin
  1432. lowdist := maxdist+1;
  1433. result := 0;
  1434. for i := 1 to 32 do if getplayerstat(i,'active')=true then begin
  1435.     x2 := getplayerstat(i,'x');
  1436.     y2 := getplayerstat(i,'y');
  1437.     curdst:=distance(X1,Y1,X2,Y2);
  1438.     if (curdst>=mindist) AND (curdst<=maxdist) AND (getplayerstat(i,'alive')=true) AND ((getplayerstat(i,'team')<>team) OR (team=0) OR (team=5)) AND ((((useraycast=true) AND (raycast(x1,y1,x2,y2,raydist,round(maxdist))=true)) OR (useraycast=false))) AND (((typestate=1) AND (getplayerstat(i,'human')=true)) OR ((typestate=2) AND (getplayerstat(i,'human')=false)) OR (typestate=0)) then begin
  1439.         if curdst < lowdist then begin
  1440.             curlow := i;
  1441.             lowdist := curdst;
  1442.             end;
  1443.         end;
  1444.     end;
  1445. result := curlow;
  1446. end;
  1447.  
  1448. function GetInfo(Filename, Key: string): array of string;
  1449. var infofile: array of string; curstr: string; i,l,endln,startln: integer;
  1450. begin
  1451. infofile := explode(readfile('scripts/zrpgevolved/'+filename),(chr(13)+chr(10)));
  1452. startln := getstringindex('['+key+']',infofile);
  1453. if startln >= 0 then begin
  1454.     l := startln+1;
  1455.     repeat
  1456.         inc(l,1);
  1457.         until (getpiece(getpiece(infofile[l],'[',1),']',0) <> '') OR (l = (getarraylength(infofile)-1));
  1458.     endln := l;
  1459.     setarraylength(result,endln-startln+2);
  1460.     for i := startln to endln-1 do begin
  1461.         curstr := getpiece(getpiece(infofile[i],'[',1),']',0);
  1462.         if curstr = '' then begin
  1463.             result[i-startln] := infofile[i];
  1464.             end;
  1465.         end;
  1466.     end;
  1467. end;
  1468.  
  1469. procedure ShowSkillInfo(ID: byte; SkillStrRaw: string);
  1470. var skill,arylen,i,ii,maxlvl,col,max,head,vars,curpos: integer; skillinfo,output: array of string; str,val: string; rows: array of array of string;
  1471. begin
  1472. skill := skillnumbyname(skillstrraw);
  1473. if skill >= 0 then begin
  1474.     maxlvl := getarraylength(skills[skill])-1;
  1475.     skillinfo := getinfo('info/skillinfo.txt',lowercase(skillnamebynum(skill,false)));
  1476.     arylen := getarraylength(skillinfo);
  1477.     setarraylength(rows,maxlvl);
  1478.     setarraylength(output,arylen+6+maxlvl);
  1479.     head := -1;
  1480.     for i := 0 to arylen-1 do begin
  1481.         if getpiece(skillinfo[i],'@head',1) <> '' then begin
  1482.             skillinfo[i] := getpiece(skillinfo[i],'@head',1);
  1483.             head := i;
  1484.             end;
  1485.         if getpiece(skillinfo[i],'@vars',1) <> '' then begin
  1486.             skillinfo[i] := getpiece(skillinfo[i],'@vars',1);
  1487.             vars := i;
  1488.             end;
  1489.         if ((i < head) OR (head = -1)) AND (skillinfo[i] <> '') then begin
  1490.             output[curpos] := '|'+skillinfo[i]; inc(curpos,1);
  1491.             end;
  1492.         end;
  1493.     for i := 0 to curpos do begin
  1494.         if max < length(output[i]) then max := length(output[i]);
  1495.         end;
  1496.     for i := 0 to curpos do begin
  1497.         output[i] := output[i]+charmultiply(' ',max-length(output[i]))+'|';
  1498.         end;
  1499.     col := containsnum(skillinfo[head],'|');
  1500.     output[curpos] := '+'+charmultiply('_',max-1)+'/'; inc(curpos,1);
  1501.     output[curpos] := '+'+charmultiply('-',length(skillinfo[head]))+'+'; inc(curpos,1);
  1502.     output[curpos] := '|'+skillinfo[head]+'|'; inc(curpos,1);
  1503.     for i := 0 to maxlvl-1 do begin
  1504.         setarraylength(rows[i],col+1);
  1505.         end;
  1506.     for i := 0 to maxlvl-1 do begin
  1507.         for ii := 0 to col do begin
  1508.             str := getpiece(getpiece(skillinfo[vars],'|',ii),'%',1);
  1509.             if str <> '' then begin
  1510.                 if str = 'SP' then val := tostr(skills[skill][i+1].cost);
  1511.                 if str = 'MANA' then val := tostr(roundto(skills[skill][i+1].mcost,3));
  1512.                 if str = 'SOUL' then val := tostr(roundto(skills[skill][i+1].scost,3));
  1513.                 if str = 'SI1' then val := tostr(skills[skill][i+1].specint1);
  1514.                 if str = 'SI2' then val := tostr(skills[skill][i+1].specint2);
  1515.                 if str = 'SF1' then val := tostr(roundto(skills[skill][i+1].specfloat1,3));
  1516.                 if str = 'SF2' then val := tostr(roundto(skills[skill][i+1].specfloat2,3));
  1517.                 if str = 'ML' then val := tostr(skills[skill][i+1].minlvl);
  1518.                 if str = 'CD' then val := tostr(skills[skill][i+1].cooldown);
  1519.                 if str = 'LVL' then val := tostr(i+1);
  1520.                 rows[i][ii] := val;
  1521.             end
  1522.         end;
  1523.     end;
  1524.     for i := 0 to maxlvl-1 do begin
  1525.         output[i+curpos] := '|';
  1526.         for ii := 0 to col do begin
  1527.             max := length(getpiece(skillinfo[head],'|',ii));
  1528.             if max > 0 then begin
  1529.                 output[i+curpos] := output[i+curpos]+charmultiply(' ',(max-length(rows[i][ii])) div 2)+rows[i][ii]+charmultiply(' ',((max-length(rows[i][ii]))+0.4) div 2)+'|';
  1530.             end
  1531.         end;
  1532.     end;
  1533.     inc(curpos,maxlvl);
  1534.     output[curpos] := '+'+charmultiply('-',length(skillinfo[head]))+'+'; inc(curpos,1);
  1535.     textbox(ID,' '+skillnamebynum(skill,true)+' ',xjoin(output,#6),#6,'_','|','+',$ff44cc44);
  1536.     end else textbox(ID,' Error ','You must enter a skill to get info'#6'For example  /skillinfo heal  would give info on the skill heal',#6,'_','|','+',$ffcc4444);
  1537. end;
  1538.  
  1539. procedure LearnSkill(ID: byte; SkillStrRaw: string);
  1540. var output: string; skill,curlvl: integer; color: longint;
  1541. begin
  1542. skill := skillnumbyname(skillstrraw);
  1543. if skill = smissile then begin
  1544.     writeconsole(ID,'Sorry, missile is disabled at the moment',$ffffffff);
  1545.     exit;
  1546.     end;
  1547. output := '';
  1548. color := $ffcc4444;
  1549. if skill >= 0 then begin
  1550.     curlvl := player[ID].skills[skill];
  1551.     if curlvl < getarraylength(skills[skill])-1 then begin
  1552.         if player[ID].lvl >= skills[skill][curlvl+1].minlvl then begin
  1553.             if player[ID].spts >= skills[skill][curlvl+1].cost then begin
  1554.                 dec(player[ID].spts,skills[skill][curlvl+1].cost);
  1555.                 inc(player[ID].skills[skill],1);
  1556.                 color := $ff44cc44;
  1557.                 output := output + 'Ogrendin '+skillnamebynum(skill,true)+', level '+inttostr(curlvl+1) + #6;
  1558.                 output := output + 'Skillpoints left - '+inttostr(player[ID].spts) + #6;
  1559.                 end else output := output + 'You do not have enough SP, needed have '+inttostr(skills[skill][curlvl+1].cost)+', you have '+inttostr(player[ID].spts) + #6;
  1560.             end else output := output + 'Yeterli seviyede degilsin, en az - '+inttostr(skills[skill][curlvl+1].minlvl) + #6;
  1561.         end else output := output + skillnamebynum(skill,true)+' becerin maksimum seviyede' + #6;
  1562.     textbox(ID,' Learn Skill ',output,#6,'_','|','+',color);
  1563.     end;
  1564. end;
  1565.  
  1566. procedure UseSkill(ID: byte; SkillStrRaw: string);
  1567. var output: string; skill, curlvl: integer; oldmana,oldsouls: single; color: longint;
  1568. begin
  1569. skill := skillnumbyname(skillstrraw);
  1570. output := '';
  1571. color := $ffcc4444;
  1572. if skill >= 0 then begin
  1573.     curlvl := player[ID].skills[skill];
  1574.     if curlvl > 0 then begin
  1575.         if getplayerstat(I
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement