Advertisement
Guest User

climb error

a guest
Jul 17th, 2014
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 20.02 KB | None | 0 0
  1. //Climb Script Re-coded, v1.0.1, by Squiddy ~ [BR]
  2. //Última atualização: 09/03/2013
  3. //Créditos para HackTank pela função IDByName; CurryWurst e DorkeyDear pela função Explode.
  4.  
  5. const
  6. maxtops = 30;
  7. rankingdisplay = 15;
  8. maxplayerstats = 500;
  9. errorcolor = $FF474A;
  10.  
  11. type tplayer = record
  12. timer: integer;
  13. tracking: byte;
  14. drawinfo: string;
  15. drawcolor: longint;
  16. end;
  17.  
  18. var
  19. player: array[1..32] of tplayer;
  20. tops: array[1..maxtops] of integer;
  21. changingmap, dokill, doupdate, compiled: boolean;
  22.  
  23. //~~~~~~~~~~~~~~~~~~~~~~
  24. //GO!
  25.  
  26. //créditos para hacktank por essa função
  27. {FUNÇÃO ADAPTADA!!!!}
  28. function idbyname(name: string; exc: byte): byte;
  29. var i: byte;
  30. begin
  31. result := 0;
  32. for i := 1 to 32 do if getplayerstat(i,'active')=true then if getplayerstat(i,'team') <> exc then begin
  33.     if containsstring(lowercase(getplayerstat(i,'name')),lowercase(name)) then begin
  34.         result := i;
  35.         break;
  36.         end;
  37.     end;
  38. end;
  39.  
  40. //créditos para currywurst e dorkeydear por esta função
  41. function explode(source: string; const delimiter: string): array of string;
  42. var position, dellength, reslength: integer;
  43. begin
  44. dellength := length(delimiter);
  45. source := source + delimiter;
  46. position := pos(delimiter, source);
  47. repeat
  48.     setarraylength(result, reslength + 1);
  49.     result[reslength] := copy(source, 1, position - 1);
  50.     reslength := reslength + 1;
  51.     delete(source, 1, position + dellength - 1);
  52.     position := pos(delimiter, source);
  53.     until (position = 0);
  54. setarraylength(result, reslength - 1);
  55. end;
  56.  
  57. procedure resetstats(id: byte);
  58. begin
  59. player[id].timer := 0;
  60. player[id].tracking := 0;
  61. player[id].drawinfo := '';
  62. player[id].drawcolor := $FEDEBA;
  63. end;
  64.  
  65. procedure updatetops();
  66. var s: byte; q: array of string;
  67. begin
  68. if readfile('scripts/'+scriptname+'/stats/maps/'+currentmap+'.txt') <> nil then begin
  69.     q := explode(readfile('scripts/'+scriptname+'/stats/maps/'+currentmap+'.txt'),#13#10);
  70.     for s := 1 to maxtops do if s <= getarraylength(q) then tops[s] := strtoint(getpiece(q[s-1],' ## ',0)) else tops[s] := 0;
  71.     end else for s := 1 to maxtops do tops[s] := 0;
  72. end;
  73.  
  74. function writetopcapper(id: byte): byte;
  75. var s, q, u: integer; pfile, mfile, info, temp: string; text: array of string; carryon, foundhwid, newfile: boolean;
  76. begin
  77. result := 0;
  78. //PLAYER STATS
  79. info := getplayerstat(id,'hwid') + ' ## ' + getplayerstat(id,'name') + ' ## ';
  80. temp := 'scripts/'+scriptname+'/stats/player stats ';
  81. if not fileexists(temp + '1.txt') then begin
  82.     writefile(temp + '1.txt',info + '1 ## ' + currentmap);
  83.     carryon := false; //não dá pra dar exit aqui né :(
  84.     end else carryon := true;
  85. if carryon then begin
  86.     for s := 1 to 254 do if fileexists(temp + inttostr(s) + '.txt') then begin
  87.         foundhwid := false;
  88.         newfile := false;
  89.         text := explode(readfile(temp + inttostr(s) + '.txt'),#13#10);
  90.         if getarraylength(text) = maxplayerstats then begin
  91.             pfile := temp + inttostr(s+1) + '.txt';
  92.             newfile := true;
  93.             break;
  94.             end else pfile := temp + inttostr(s) + '.txt';
  95.         foundhwid := containsstring(readfile(pfile),getplayerstat(id,'hwid'));
  96.         if foundhwid then break;
  97.         end else break;
  98.     temp := '';
  99.     if newfile then writefile(pfile,info + '1 ## ' + currentmap) else begin
  100.         if not foundhwid then writefile(pfile,readfile(pfile) + info + '1 ## ' + currentmap) else begin
  101.             for s := 0 to getarraylength(text)-1 do if getpiece(text[s],' ## ',0) = getplayerstat(id,'hwid') then begin
  102.                 q := strtoint(getpiece(text[s],' ## ',2));
  103.                 q := q + 1;
  104.                 for u := 0 to s-1 do temp := temp + text[u] + #13#10;
  105.                 temp := temp + info + inttostr(q) + ' ## ' + currentmap + #13#10;
  106.                 if s < getarraylength(text)-1 then for u := s+1 to getarraylength(text)-1 do temp := temp + text[u] + #13#10;
  107.                 writefile(pfile,temp);
  108.                 break;
  109.                 end;
  110.             end;
  111.         end;
  112.     end;
  113. //MAP STATS
  114. info := inttostr(player[id].timer) + ' ## ' + formatdate('dd.mm.yy') + ' ## ' + formatdate('hh:nn:ss') + ' ## ' + getplayerstat(id,'name');
  115. mfile := 'scripts/'+scriptname+'/stats/maps/'+currentmap+'.txt';
  116. if readfile(mfile) = nil then begin
  117.     writefile(mfile,info);
  118.     result := 1;
  119.     exit;
  120.     end;
  121. text := explode(readfile(mfile),#13#10);
  122. q := getarraylength(text);
  123. for s := 0 to q-1 do if player[id].timer <= strtoint(getpiece(text[s],' ## ',0)) then break;
  124. if q = maxtops then if s = q then exit;
  125. if q < maxtops then setarraylength(text,q+1);
  126. q := getarraylength(text);
  127. for u := q-1 downto s+1 do text[u] := text[u-1];
  128. text[s] := info;
  129. info := '';
  130. for u := 0 to q-1 do info := info + text[u] + iif(u=q-1,'',#13#10);
  131. writefile(mfile,info);
  132. result := s+1;
  133. end;
  134.  
  135. function getdrawcolor(id: byte): longint;
  136. var s, q, u: byte;
  137. begin
  138. result := $FEDEBA;
  139. for s := 1 to maxtops do if tops[s] = 0 then break; //s is now how many tops there are.
  140. if s <> 1 then q := (s-1) div 6 else q := 1; //q is now the "step sequence".
  141. if s <> 1 then for s := 1 to maxtops do if (player[id].timer <= tops[s]) or (tops[s] = 0) then break; //s is now the next top position.
  142. for u := 1 to 6 do if s <= (q*u) then break; //u is now the number in the color scale (1-6). if it is 7, it is because the time surpasses the tops[maxtops] time.
  143. if q = 0 then for s := 1 to maxtops do if (player[id].timer <= tops[s]) or (tops[s] = 0) then begin //if the number of tops is lower than 6, than this loop starts
  144.     u := s; //u is now the nearest top position
  145.     break;
  146.     end;
  147. case u of
  148.     1: result := $25AF00; //greener
  149.     2: result := $83B000;
  150.     3: result := $B28200;
  151.     4: result := $B33F00;
  152.     5: result := $B51000;
  153.     6: result := $B60000;
  154.     7: result := $CE0000; //reder
  155.     end;
  156. if getplayerstat(id,'team') = 5 then if player[id].tracking <> 0 then result := player[player[id].tracking].drawcolor else result := $FEDEBA;
  157. end;
  158.  
  159. procedure updatedrawinfo(id: byte);
  160. var s, q: byte; temp: string;
  161. begin
  162. player[id].drawcolor := getdrawcolor(id);
  163. if getplayerstat(id,'team') <> 5 then begin
  164.     for s := 1 to maxtops do if (player[id].timer <= tops[s]) or (tops[s] = 0) then break;
  165.     if tops[1] <> 0 then begin
  166.         if s = maxtops+1 then q := maxtops else if tops[s] = 0 then q := s-1 else q := s;
  167.         temp := #13#10 + 'Top #' + inttostr(q) + ': ' + inttostr(tops[q]) + 's';
  168.         end else temp := #13#10 + 'Sem top!';
  169.     player[id].drawinfo := inttostr(player[id].timer) + 's' + temp;
  170.     end else if player[id].tracking = 0 then player[id].drawinfo := 'Oyunya bakmak icin !bak <nickin bir kismi>' + #13#10 + 'eslik edecek' else player[id].drawinfo := getplayerstat(player[id].tracking,'name') + #13#10 + player[player[id].tracking].drawinfo;
  171. end;
  172.  
  173. //MOTHERFUCKING FUNCTION COST ME LOTS OF HOURS!!
  174. function retrievepropertext(text, linesplitter, datasplitter, nds, textontop: string; fillwith, corner, fillx, filly: char): array of string; //nds = new data splitter
  175. var s, q, u, y, datalen: byte; bef, af: array of string; i: array of integer; d: array of array of string; sq: array of array of integer;
  176. begin
  177. if (text = nil) or (linesplitter = nil) or (datasplitter = nil) or (nds = '') or (fillwith = '') or (fillx = '') or (filly = '') then exit;
  178. setarraylength(result,0);
  179. text := text + linesplitter; //PRECISA fazer isso
  180. bef := explode(text,linesplitter);
  181. while bef[getarraylength(bef)-1] = nil do setarraylength(bef,getarraylength(bef)-1); //isso TAMBÉM precisa fazer
  182. for s := 0 to getarraylength(bef)-1 do bef[s] := bef[s] + datasplitter;
  183. af := explode(bef[0],datasplitter); //pra poupar variáveis né.. vida de pobre dá nisso
  184. datalen := getarraylength(af);
  185. setarraylength(i,datalen);
  186. setarraylength(d,getarraylength(bef));
  187. setarraylength(sq,getarraylength(bef));
  188. setarraylength(af,getarraylength(bef));
  189. setarraylength(result,getarraylength(bef));
  190. for s := 0 to getarraylength(d)-1 do setarraylength(d[s],datalen);
  191. for s := 0 to getarraylength(sq)-1 do setarraylength(sq[s],datalen);
  192. for s := 0 to getarraylength(af)-1 do begin //loop principal
  193.     af[s] := '';
  194.     for q := 0 to datalen do begin //nesse loop, retirar o velho datasplitter e adicionar o novo no lugar dele (nds)
  195.         u := pos(datasplitter,bef[s]);
  196.         if q < datalen then sq[s][q] := u;
  197.         af[s] := af[s] + copy(bef[s],1,u-1) + iif(q = datalen,'',nds);
  198.         delete(bef[s],1,u + length(datasplitter) - 1);
  199.         end;
  200.     bef[s] := af[s];
  201.     for q := 0 to datalen-1 do begin //nesse loop, verificar quais são as maiores datas de cada linha
  202.         u := pos(nds,bef[s]);
  203.         if u-1 > i[q] then i[q] := u-1;
  204.         delete(bef[s],1,u + length(nds) - 1);
  205.         end;
  206.     end;
  207. for s := 0 to getarraylength(af)-1 do for q := 0 to datalen-1 do begin //nesse loop, adicionar os chars à variável result
  208.     u := sq[s][q];
  209.     for y := u-1 to i[q] do d[s][q] := d[s][q] + iif(y = i[q],'',fillwith);
  210.     result[s] := result[s] + copy(af[s],1,u-1) + d[s][q] + iif(q = datalen-1,'',nds);
  211.     delete(af[s],1,u + length(nds) - 1);
  212.     end;
  213. setarraylength(result,getarraylength(result)+2); //adicionar dois "blanks" no final da array
  214. for s := getarraylength(result)-2 downto 1 do result[s] := result[s-1]; //e agora mover os textos para uma posição acima
  215. result[0] := '';
  216. i[0] := 0;
  217. for s := 0 to getarraylength(result)-1 do if length(result[s])+2 > i[0] then i[0] := length(result[s])+2; //i[0] is now the lenghtiest motherfucking line
  218. for s := 1 to i[0]-2 do result[getarraylength(result)-1] := result[getarraylength(result)-1] + fillx; //put some filling
  219. for s := 1 to (((i[0]-2) div 2) - (length(textontop) div 2)) do result[0] := result[0] + fillx; //fill before the text on top
  220. result[0] := result[0] + textontop; //put the text on top
  221. for s := length(result[0]) to i[0]-3 do result[0] := result[0] + fillx; //fill after the text on top
  222. result[0] := corner + result[0] + corner; //put some motherfucking corners
  223. result[getarraylength(result)-1] := corner + result[getarraylength(result)-1] + corner; //put some more motherfucking corners
  224. for s := 1 to getarraylength(result)-2 do result[s] := filly + result[s] + filly; //and box it up to finish it!!
  225. end;
  226.  
  227. procedure showranking(id: byte);
  228. var rawtext: string; s, q, d, y: byte; u, i: array of string;
  229. begin
  230. for q := 1 to 254 do if not fileexists('scripts/'+scriptname+'/stats/player stats ' + inttostr(q) + '.txt') then break;
  231. q := q - 1; //q is now the number of files that actually exist
  232. if q = 0 then exit;
  233. for s := 1 to q do rawtext := rawtext + readfile('scripts/'+scriptname+'/stats/player stats ' + inttostr(s) + '.txt') + #13#10; //gather all info in one text
  234. u := explode(rawtext,#13#10);
  235. if getarraylength(u) < rankingdisplay then d := getarraylength(u) else d := rankingdisplay; //d is now the ammount of positions displayed on !ranking
  236. setarraylength(i,d); //i is now the array that will effectively contain the positions
  237. for s := 0 to d-1 do i[s] := '0 ## ';
  238. for s := 0 to getarraylength(u)-1 do if (u[s] <> nil) and (u[s] <> #13#10) then if strtoint(getpiece(u[s],' ## ',2)) >= strtoint(getpiece(i[d-1],' ## ',0)) then begin
  239.     for q := 0 to d-1 do if strtoint(getpiece(u[s],' ## ',2)) >= strtoint(getpiece(i[q],' ## ',0)) then break;
  240.     for y := d-1 downto q+1 do i[y] := i[y-1];
  241.     i[q] := getpiece(u[s],' ## ',2) + ' ## ' + getpiece(u[s],' ## ',1);
  242.     end;
  243. rawtext := '';
  244. for s := 0 to d-1 do if getpiece(i[s],' ## ',0) <> '0' then rawtext := rawtext + '#'+inttostr(s+1) + ' ## ' + i[s] + #13#10;
  245. setarraylength(u,0);
  246. u := retrievepropertext(rawtext,#13#10,'##','-',' Top Players ',' ','+','-','|');
  247. for s := 0 to getarraylength(u)-1 do writeconsole(id,u[s],$3D9FC1);
  248. end;
  249.  
  250. procedure showhighscores(id: byte);
  251. var s: byte; q: array of string; rawtext: string;
  252. begin
  253. if readfile('scripts/'+scriptname+'/stats/maps/'+currentmap+'.txt') = nil then begin
  254.     writeconsole(id,'Bu haritada henuz cap yapilmadi!',errorcolor);
  255.     exit;
  256.     end;
  257. rawtext := '';
  258. q := explode(readfile('scripts/'+scriptname+'/stats/maps/'+currentmap+'.txt'),#13#10);
  259. for s := 0 to getarraylength(q)-1 do rawtext := rawtext + '#'+inttostr(s+1) + ' ## ' + getpiece(q[s],' ## ',0) + 's ## ' + getpiece(q[s],' ## ',3) + #13#10;
  260. setarraylength(q,0);
  261. q := retrievepropertext(rawtext,#13#10,'##','-',' '+currentmap+' ',' ','+','-','|');
  262. for s := 0 to getarraylength(q)-1 do writeconsole(id,q[s],$1CC61C);
  263. end;
  264.  
  265. procedure showstats(id: byte; comp: string);
  266. var s, q, i, y: byte; u, d: array of string;
  267. begin
  268. if comp <> nil then begin
  269.     s := idbyname(comp,0);
  270.     if s = 0 then exit;
  271.     end else s := id;
  272. for q := 1 to 254 do if fileexists('scripts/'+scriptname+'/stats/player stats '+inttostr(q)+'.txt') then if containsstring(readfile('scripts/'+scriptname+'/stats/player stats '+inttostr(q)+'.txt'),getplayerstat(s,'hwid')) then begin
  273.     u := explode(readfile('scripts/'+scriptname+'/stats/player stats '+inttostr(q)+'.txt'),#13#10);
  274.     for i := 0 to getarraylength(u)-1 do if getpiece(u[i],' ## ',0) = getplayerstat(s,'hwid') then begin
  275.         d := retrievepropertext('Caps registrados ## '+getpiece(u[i],' ## ',2) + #13#10 + 'Último mapa pontuado ## '+getpiece(u[i],' ## ',3),#13#10,'##','-->',' '+iif(s <> id,getplayerstat(s,'name'),'Seus stats')+' ',' ','+','-','|');
  276.         for y := 0 to getarraylength(d)-1 do writeconsole(id,d[y],$8EC4FD);
  277.         exit;
  278.         end;
  279.     end;
  280. writeconsole(id,iif(s = id,'Oyuncu',getplayerstat(s,'name'))+' kayitli statuye sahip!',errorcolor);
  281. end;
  282.  
  283. procedure showmaps(id, part: byte; source: string);
  284. var d: array of string; temp, s, q, u: integer; i: string;
  285. begin
  286. if source = nil then exit;
  287. if (part = 255) or (part = -1) then begin
  288.     writeconsole(id,#13#10+' !harita 0  !harita 1',$D1A347);
  289.     writeconsole(id,'Tip        ,        , vb',errorcolor);
  290.     exit;
  291.     end;
  292. d := explode(source,#13#10);
  293. s := getarraylength(d);
  294. temp := 0;
  295. if s = 1 then begin
  296.     writeconsole(id,'Harita Listesi: '+d[0],$1BE06A);
  297.     exit;
  298.     end;
  299. while (s >= 4) do begin
  300.     s := s - 4;
  301.     temp := temp + 1; //temp = número de linhas finais (com 4 maps em cada linha)
  302.     end;
  303. if s > 0 then temp := temp + 1;
  304. u := 0;
  305. i := '';
  306. for q := 0 to temp - iif(s = 0,1,2) do begin
  307.     i := i + d[u] + ' ## ' + d[u+1] + ' ## ' + d[u+2] + ' ## ' + d[u+3] + #13#10;
  308.     u := u + 4;
  309.     end;
  310. if s <> 0 then for q := 1 to s do begin
  311.     i := i +  d[u] + ' ## ';
  312.     u := u + 1;
  313.     end;
  314. d := retrievepropertext(i,#13#10,'##',' - ',' Lista de mapas ',' ','+','-','|');
  315. if (part * 30) > getarraylength(d) then begin
  316.     writeconsole(id,'Liste sonu!',errorcolor);
  317.     exit;
  318.     end;
  319. if ((part * 30) + 30) > getarraylength(d)-1 then s := getarraylength(d)-1 else s := ((part * 30) + 30);
  320. for q := (part * 30) to s do writeconsole(id,d[q],$1BE06A);
  321. end;
  322.  
  323. procedure oncompile();
  324. var s: byte;
  325. begin
  326. for s := 1 to 32 do resetstats(s);
  327. dokill := true;
  328. changingmap := false;
  329. compiled := true;
  330. doupdate := true;
  331. if gamestyle <> 3 then command('/gamemode 3');
  332. writeln('Climb Script by MrHamsTR basariyla duzenlendi!');
  333. writeconsole(0,'Climb Script by MrhamsTR basariyla duzenlendi!',$FFFFFF);
  334. end;
  335.  
  336. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  337.  
  338. procedure apponidle(ticks: integer);
  339. var s: byte;
  340. begin
  341. if not compiled then oncompile();
  342. if doupdate then begin
  343.     doupdate := false;
  344.     updatetops();
  345.     end;
  346. for s := 1 to 32 do if getplayerstat(s,'active') = true then begin
  347.     if getplayerstat(s,'alive') = true then if not changingmap then player[s].timer := player[s].timer + 1;
  348.     updatedrawinfo(s);
  349.     drawtext(s,player[s].drawinfo,200,player[s].drawcolor,0.12,20,357);
  350.     end;
  351. if dokill then begin
  352.     for s := 1 to 32 do if getplayerstat(s,'active') = true then begin
  353.         dodamage(s,40000);
  354.         resetstats(s);
  355.         end;
  356.     dokill := false;
  357.     end;
  358. end;
  359.  
  360. procedure onplayerspeak(id: byte; text: string);
  361. var s: byte;
  362. begin
  363. case lowercase(getpiece(text,' ',0)) of
  364.     '!maps','!haritalar','!maplist','!mapslist': showmaps(id,strtoint(getpiece(text,' ',1)),readfile('mapslist.txt'));
  365.     '!rank','!siralama','!ranking': showranking(id);
  366.     '!hi','!derece','!high': showhighscores(id);
  367.     '!puanlar','!stats': showstats(id,getpiece(text,getpiece(text,' ',0)+' ',1));
  368.     '!map','!harita': writeconsole(id,'Gecerli harita '+currentmap,$00A2FF);
  369.     '!bak','!track': begin
  370.                 if getplayerstat(id,'team') <> 5 then begin
  371.                     writeconsole(id,'Bu komutu kullanmak icin bir izleyici olmali',errorcolor);
  372.                     exit;
  373.                     end;
  374.                 if getpiece(text,' ',1) = nil then begin
  375.                     writeconsole(id,#13#10+'Oyuncu nickinin bir kismini yazmaniz gerekiyor!',errorcolor);
  376.                     writeconsole(id,'Ornek !bak hams !bak hamstr !bak mrha  !',errorcolor);
  377.                     writeconsole(id,'Sen de calis senin de olsun!',errorcolor);
  378.                     exit;
  379.                     end;
  380.                 s := idbyname(getpiece(text,getpiece(text,' ',0)+' ',1),5);
  381.                 if s = 0 then exit;
  382.                 player[id].tracking := s;
  383.                 writeconsole(id,'Suan '+getplayerstat(s,'name')+' izleniyor!',$FF99CC);
  384.                 end;
  385.     end;
  386. end;
  387.  
  388. function oncommand(id: byte; text: string): boolean;
  389. var s, top: byte; temp: string; bla: array of string;
  390. begin
  391. text := lowercase(text);
  392. result := false;
  393. if getpiece(text,' ',0) = '/removetop' then if getpiece(text,' ',1) <> nil then begin // /removetop <top>
  394.     top := strtoint(getpiece(text,' ',1));
  395.     if top = 255 then begin
  396.         writeconsole(id,'Gecerli bir sayi girin!',errorcolor);
  397.         exit;
  398.         end;
  399.     bla := explode(readfile('scripts/'+scriptname+'/stats/maps/'+currentmap+'.txt'),#13#10);
  400.     if getarraylength(bla) = 1 then begin
  401.         writefile('scripts/'+scriptname+'/stats/maps/'+currentmap+'.txt','');
  402.         writeconsole(id,'Harita uzerindeki derece silindi!',$FFFFFF);
  403.         exit;
  404.         end;
  405.     if not fileexists('scripts/'+scriptname+'/stats/maps/'+currentmap+'.txt') then begin writeln('Arquivo nao existe!'); exit; end;
  406.     for s := 0 to getarraylength(bla)-1 do temp := temp + iif(s+1 <> top,bla[s],'') + iif(s <> getarraylength(bla)-1,iif(s+1 <> top,#13#10,''),'');
  407.     writefile('scripts/'+scriptname+'/stats/maps/'+currentmap+'.txt',temp);
  408.     writeconsole(id,'Oyuncu '+inttostr(top)+' top derecesi kaldirildi!',$FFFFFF);
  409.     updatetops();
  410.     end;
  411. end;
  412.  
  413. procedure onflagscore(id, teamflag: byte);
  414. var s: byte;
  415. begin
  416. changingmap := true;
  417. command('/nextmap');
  418. s := writetopcapper(id);
  419. writeconsole(0,getplayerstat(id,'name')+' atti '+inttostr(player[id].timer)+' saniye!'+iif(s <> 0,' Yerlestirme '+inttostr(s)+'!',''),$FFB21A);
  420. writeln(getplayerstat(id,'name')+' atti '+inttostr(player[id].timer)+' saniye!'+iif(s <> 0,' Yerlestirme '+inttostr(s)+'!',''));
  421. end;
  422.  
  423. procedure onmapchange(newmap: string);
  424. begin
  425. changingmap := false;
  426. dokill := true;
  427. updatetops();
  428. end;
  429.  
  430. function onplayercommand(id: byte; text: string): boolean;
  431. var s: integer; q: array of string; u: string;
  432. begin
  433. result := false;
  434. text := lowercase(text);
  435. if getpiece(text,' ',0) = '/ara' then if (getpiece(text,' ',2) <> nil) and (strtoint(getpiece(text,' ',2)) <> -1) then begin
  436.     q := explode(readfile('mapslist.txt'),#13#10);
  437.     for s := 0 to getarraylength(q)-1 do if containsstring(lowercase(q[s]),getpiece(text,' ',1)) then u := u + q[s] + #13#10;
  438.     showmaps(id,strtoint(getpiece(text,' ',2)),u);
  439.     end else begin
  440.         writeconsole(id,#13#10+'Aramak icin /ara <haritanin bir kismi> <liste numarasi>',errorcolor);
  441.         writeconsole(id,'Ornek /ara kz 0  /ara kz 1',errorcolor);
  442.         writeconsole(id,'Bu kadar basit',errorcolor);
  443.         end;
  444. end;
  445.  
  446. procedure onjointeam(id, team: byte);
  447. var s: byte;
  448. begin
  449. if team = 5 then for s := 1 to 32 do if player[s].tracking = id then player[s].tracking := 0;
  450. end;
  451.  
  452. procedure onleavegame(id, team: byte; kicked: boolean);
  453. var s: byte;
  454. begin
  455. for s := 1 to 32 do if player[s].tracking = id then player[s].tracking := 0;
  456. player[id].tracking := 0;
  457. end;
  458.  
  459. procedure onplayerrespawn(id: byte);
  460. begin
  461. player[id].timer := 0;
  462. end;
  463.  
  464. procedure activateserver();
  465. begin
  466. oncompile();
  467. doupdate := true;
  468. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement