Advertisement
Guest User

shop script

a guest
Aug 12th, 2011
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 60.56 KB | None | 0 0
  1. type TSection = record
  2.     Name: string;
  3.     Keys: array of string;
  4. end;
  5.  
  6. type TINIFile = record
  7.     Sections: array of TSection;
  8. end;
  9.  
  10. function xsplit(const source: string; const delimiter: string):TStringArray;
  11. var
  12.     i,x,d:integer;
  13.     s:string;
  14. begin
  15.     d:=length(delimiter);
  16.     x:=0;
  17.     i:=1;
  18.     SetArrayLength(Result,1);
  19.     while(i<=length(source)) do begin
  20.         s:=Copy(source,i,d);    
  21.             if(s=delimiter) then begin
  22.                 inc(i,d);      
  23.                 inc(x,1);
  24.                 SetArrayLength(result,x+1);
  25.             end else begin           
  26.                 result[x]:= result[x]+Copy(s,1,1);
  27.                 inc(i,1);
  28.         end;
  29.     end;
  30. end;
  31.  
  32. function iniLoad(FileName: string): TINIFile;
  33. var
  34.     iSections, iKeys, i: integer;
  35.     lines: TStringArray;
  36. begin
  37.     lines := xsplit(ReadFile(FileName), chr(13) + chr(10));
  38.  
  39.     iSections := 0;
  40.     iKeys := 0;
  41.  
  42.     for i := 0 to GetArrayLength(lines) - 1 do
  43.     begin
  44.         if Length(lines[i]) > 0 then
  45.         begin
  46.             if (lines[i][1] = '[') and (lines[i][Length(lines[i])] = ']') then
  47.             begin
  48.                 iSections := iSections + 1;
  49.                 iKeys := 0;
  50.                 SetArraylength(Result.Sections, iSections);
  51.                 Result.Sections[iSections - 1].Name := Copy(lines[i], 2, Length(lines[i]) - 2);
  52.             end
  53.             else if (iSections > 0) and (StrPos('=', lines[i]) > 0) then
  54.             begin
  55.                 iKeys := iKeys + 1;
  56.                 SetArrayLength(Result.Sections[iSections - 1].Keys, iKeys);
  57.                 Result.Sections[iSections - 1].Keys[iKeys - 1] := lines[i];
  58.             end;
  59.         end;
  60.     end;
  61. end;
  62.  
  63. procedure iniSave(FileName: string; iniFile: TINIFile);
  64. var
  65.     i, j: integer;
  66.     data: string;
  67. begin
  68.     for i := 0 to GetArrayLength(iniFile.Sections) - 1 do
  69.     begin
  70.         if Length(iniFile.Sections[i].Name) > 0 then
  71.         begin
  72.             data := data + '[' + iniFile.Sections[i].Name + ']' + chr(13) + chr(10);
  73.  
  74.             for j := 0 to GetArrayLength(iniFile.Sections[i].Keys) - 1 do
  75.                 if Length(iniFile.Sections[i].Keys[j]) > 0 then
  76.                     data := data + iniFile.Sections[i].Keys[j] + chr(13) + chr(10);
  77.  
  78.             if i < GetArrayLength(iniFile.Sections) - 1 then
  79.                 data := data + chr(13) + chr(10);
  80.         end;
  81.     end;
  82.  
  83.     WriteFile(FileName, data);
  84. end;
  85.  
  86. function iniGetValue(var iniFile: TINIFile; section, key, errorResult: string): string;
  87. var
  88.     i, j, idx: integer;
  89. begin
  90.     Result := errorResult;
  91.  
  92.     if StrPos('=', key) > 0 then
  93.     begin
  94.         WriteLn('Error: the key can''t contain the character ''='' (asshole)');
  95.         exit;
  96.     end;
  97.  
  98.     for i := 0 to GetArrayLength(iniFile.Sections) - 1 do
  99.     begin
  100.         if LowerCase(iniFile.Sections[i].Name) = LowerCase(section) then
  101.         begin
  102.             for j := 0 to GetArrayLength(iniFile.Sections[i].Keys) - 1 do
  103.             begin
  104.                 if GetPiece(iniFile.Sections[i].Keys[j], '=', 0) = key then
  105.                 begin
  106.                     idx := StrPos('=', iniFile.Sections[i].Keys[j]);
  107.                     Result := Copy(iniFile.Sections[i].Keys[j], idx + 1, Length(iniFile.Sections[i].Keys[j]));
  108.                     break;
  109.                 end;
  110.             end;
  111.             break;
  112.         end;
  113.     end;
  114. end;
  115.  
  116. procedure iniSetValue(var iniFile: TINIFile; section, key, value: string);
  117. var
  118.     i, j: integer;
  119.     sectionFound, keyFound: boolean;
  120. begin
  121.     if StrPos('=', key) > 0 then
  122.     begin
  123.         WriteLn('Error: the key can''t contain the character ''='' (asshole)');
  124.         exit;
  125.     end;
  126.  
  127.     sectionFound := false;
  128.     keyFound := false;
  129.  
  130.     for i := 0 to GetArrayLength(iniFile.Sections) - 1 do
  131.     begin
  132.         if LowerCase(iniFile.Sections[i].Name) = LowerCase(section) then
  133.         begin
  134.             sectionFound := true;
  135.  
  136.             for j := 0 to GetArrayLength(iniFile.Sections[i].Keys) - 1 do
  137.             begin
  138.                 if GetPiece(iniFile.Sections[i].Keys[j], '=', 0) = key then
  139.                 begin
  140.                     keyFound := true;
  141.                     iniFile.Sections[i].Keys[j] := key + '=' + value;
  142.                     break;
  143.                 end;
  144.             end;
  145.  
  146.             if keyFound = false then
  147.             begin
  148.                 j := GetArrayLength(iniFile.Sections[i].Keys);
  149.                 SetArrayLength(iniFile.Sections[i].Keys, j + 1);
  150.                 iniFile.Sections[i].Keys[j] := key + '=' + value;
  151.             end;
  152.  
  153.             break;
  154.         end;
  155.     end;
  156.  
  157.     if sectionFound = false then
  158.     begin
  159.         i := GetArrayLength(iniFile.Sections);
  160.         SetArrayLength(iniFile.Sections, i + 1);
  161.         iniFile.Sections[i].Name := section;
  162.  
  163.         SetArrayLength(iniFile.Sections[i].Keys, 1);
  164.         iniFile.Sections[i].Keys[0] := key + '=' + value;
  165.     end;
  166. end;
  167.  
  168. procedure iniDeleteSection(var iniFile: TINIFile; section: string);
  169. var
  170.     i: integer;
  171. begin
  172.     for i := 0 to GetArrayLength(iniFile.Sections) - 1 do
  173.     begin
  174.         if LowerCase(iniFile.Sections[i].Name) = LowerCase(section) then
  175.         begin
  176.             iniFile.Sections[i].Name := '';
  177.             break;
  178.         end;
  179.     end;
  180. end;
  181.  
  182. procedure iniDeleteKey(var iniFile: TINIFile; section, key: string);
  183. var
  184.     i, j: integer;
  185. begin
  186.     if StrPos('=', key) > 0 then
  187.     begin
  188.         WriteLn('Error: the key can''t contain the character ''='' (asshole)');
  189.         exit;
  190.     end;
  191.  
  192.     for i := 0 to GetArrayLength(iniFile.Sections) - 1 do
  193.     begin
  194.         if LowerCase(iniFile.Sections[i].Name) = LowerCase(section) then
  195.         begin
  196.             for j := 0 to GetArrayLength(iniFile.Sections[i].Keys) - 1 do
  197.             begin
  198.                 if GetPiece(iniFile.Sections[i].Keys[j], '=', 0) = key then
  199.                 begin
  200.                     iniFile.Sections[i].Keys[j] := '';
  201.                     break;
  202.                 end;
  203.             end;
  204.             break;
  205.         end;
  206.     end;
  207. end;
  208.  
  209. procedure iniWrite(FileName, section, key, value: string);
  210. var
  211.     iniFile: TINIFile;
  212. begin
  213.     iniFile := iniLoad(FileName);
  214.     iniSetValue(iniFile, section, key, value);
  215.     iniSave(FileName, iniFile);
  216. end;
  217.  
  218. procedure Nova(const X,Y,speed,decentralize,power: single; ID,style: byte; n: integer);
  219. var i: integer;
  220.   angle: single;
  221. begin
  222.   angle := 2*pi/n;
  223.   for i:=0 to n do
  224.     CreateBullet(X+cos(angle*i)*decentralize, Y+sin(angle*i)*decentralize, cos(angle*i)*speed, sin(angle*i)*speed, power,style , ID );
  225. end;
  226.  
  227. const
  228. Grenade = 2;
  229. M79 = 4;
  230. CNade = 9;
  231. CPellet = 10;
  232. LAW = 12;
  233. Knife = 13;
  234.  
  235.  
  236. procedure BigBangDeath(Killer,Victim,BulletType:Byte; speed:Integer);
  237. begin
  238.   Nova(GetPlayerstat(Victim,'X'),Getplayerstat(Victim,'Y'),speed,35,100, Killer,BulletType,5);
  239.   Nova(GetPlayerstat(Victim,'X'),Getplayerstat(Victim,'Y'),speed,70,100, Killer,BulletType,25);
  240.   Nova(GetPlayerstat(Victim,'X'),Getplayerstat(Victim,'Y'),speed,105,100, Killer,BulletType,25);
  241.   Nova(GetPlayerstat(Victim,'X'),Getplayerstat(Victim,'Y'),speed,140,100, Killer,BulletType,25);
  242.   Nova(GetPlayerstat(Victim,'X'),Getplayerstat(Victim,'Y'),speed,175,100, Killer,BulletType,25);
  243.   Nova(GetPlayerstat(Victim,'X'),Getplayerstat(Victim,'Y'),speed,210,100, Killer,BulletType,25);
  244.   Nova(GetPlayerstat(Victim,'X'),Getplayerstat(Victim,'Y'),speed,245,100, Killer,BulletType,25);
  245.   Nova(GetPlayerstat(Victim,'X'),Getplayerstat(Victim,'Y'),speed,270,100, Killer,BulletType,25);
  246.   Nova(GetPlayerstat(Victim,'X'),Getplayerstat(Victim,'Y'),speed,305,100, Killer,BulletType,25);
  247.   Nova(GetPlayerstat(Victim,'X'),Getplayerstat(Victim,'Y'),speed,340,100, Killer,BulletType,25);
  248.   Nova(GetPlayerstat(Victim,'X'),Getplayerstat(Victim,'Y'),speed,375,100, Killer,BulletType,75);
  249.   Nova(GetPlayerstat(Victim,'X'),Getplayerstat(Victim,'Y'),speed,410,100, Killer,BulletType,150);
  250. end;
  251.  
  252. procedure Shoot(x, y, x2, y2, speed, dmg: single; style, owner: byte);
  253. var dist: single;
  254. begin
  255.  dist := Distance(x, y, x2, y2) / speed;
  256.  x2 := (x2 - x) / dist;
  257.  y2 := (y2 - y) / dist;
  258.  createbullet(x, y, x2, y2, dmg, style, owner);
  259. end;
  260.  
  261. Procedure ShootPlayer(Victim,Shooter:Byte;x,y,speed,dmg:single; Bullettype:Byte);
  262. var dist: single;
  263. var x2,y2:Integer;
  264. begin
  265.  dist := Distance(x, y, Getplayerstat(Victim,'x'), GetPlayerStat(Victim,'y')) / speed;
  266.  x2 := (GetplayerStat(Victim,'x') - x) / dist;
  267.  y2 := (Getplayerstat(Victim,'y') - y) / dist;
  268.  createbullet(x, y, x2, y2, dmg, Bullettype, Shooter);
  269.  end;
  270.  
  271.  const  
  272.  ClBad  = $FFFF44;  
  273.  ClGood = $EE00FF;
  274.  PredTime = 25;
  275.  RankDamageMult = 3;
  276.  const RedFlag = 1;
  277.  const BlueFlag = 2;
  278.  
  279. Const
  280. T = True;
  281. F = False;
  282.  
  283. Type  
  284.  Stats = Record  
  285.  LongTime: Boolean;  
  286. TSec,Tmin,BTSec,BTMin: Integer;  
  287. end;
  288.  
  289. Type PLStats = Record
  290. PlayerID: Byte;
  291. Name: String;
  292. Kills: integer;
  293. Rank: integer;
  294. Caps: integer;
  295. Team: Byte;
  296. Achievements:integer;
  297. RankNum: Integer;
  298. RankName: String;
  299. DefSkill: String; // skill 1
  300. lvl1learned:Boolean;
  301. lvl1percentage:Integer;
  302. Specialty: String; // skill 2
  303. lvl2learned:Boolean;
  304. MFSkill: String; // skill 3
  305. lvl3learned:Boolean;
  306. THSkill: String; // skill 4
  307. lvl4learned:Boolean;
  308. ofsSkill: String; // skill 5
  309. lvl5learned:Boolean;
  310. MedSkill: String; // skill 6
  311. lvl6learned:Boolean;
  312. SmnSkill: String; // skill 7
  313. lvl7learned:Boolean;
  314. randnum:Integer;
  315. Admin:Boolean;
  316. OrigrankdamagePerc:Integer;
  317. RankDamageMultiplier:Integer;
  318. Killstreak:Integer;
  319. CashEarnt:Integer;
  320. end;
  321.  
  322. Type Itemz = Record
  323. x:Integer;
  324. y:Integer;
  325. Name:string;
  326. TrigTimer:Integer;
  327. Armed:Boolean;
  328. Cool: Boolean;
  329. end;
  330.  
  331. var
  332. Owner: Array [1..32] of PLStats;
  333. ItemOwner: Array [1..225] of PLStats;
  334. ItemInfo: Array [1..225] of Itemz;
  335. ItemID: Integer;
  336. Playerinfo: Array [1..32] of PLStats;
  337. z:Integer;
  338. ini: TINIFile;
  339. Cash,DEC,DECC,EBNN,EBNND,EBNNT,EBNNTT,EDMM,EDMMT,EDMMD,Tcash,i,i2,BonusID,ID,EBN,EBNM,ED,EDM,DED,Dude,DEXN,Bottoset,SetBotTeam:Integer;
  340. OBFLX,OBFLY,NBFLX,NBFLY,PlayerID:Integer;
  341. HC,Shop: Boolean;
  342. PStat,Skill: String;
  343. deathexp,HBFT,TA,NTB,NTA,NTAN,TP,greatgahooka,yeahyeah,speedster,Boolvar,holyshit,FlagCaptured,catchme,SoloChaser,QuitTeasin,waiting4bot:Array[1..32] of Boolean;
  344. Killnum,NFT,NKS,BKS,TFC,TTCash,LongestTime,ntTimer,ntfTimer,tna,TUPred,TNA,deKills,barKills,LKills,FKills,knKills,mpKills,SpeedTimer,DamCalc,KBZombie,Flaghold: Array[1..32] of Integer;
  345.  Player: Array[1..32] of Stats;  
  346.  TSec,Tmin,BTSec,BTMin,ntPosX,ntPosY,RankNum,RankDam,DamagePerc: Array[1..32] of Integer;
  347.  nTurretPos:Integer;
  348. Timer:Integer;  
  349. Dist:Single;
  350. iniPFile:String;
  351. Accname,BotOwner:Array [1..32] of String;
  352.  
  353. Procedure ResetStats(ID:Byte);  
  354.  begin  
  355.       Player[ID].LongTime := false;  
  356.     end;  
  357.      
  358. Procedure CheckTime(ID:Byte);    
  359.     begin  
  360.    if Player[ID].BTMin > LongestTime[1] then begin  
  361.           LongestTime[1] := Player[ID].BTMin;  
  362.         LongestTime[2] := Player[ID].BTSec;  
  363.         Player[ID].LongTime := true;  
  364.             WriteConsole(0,IDToName(ID) + ' beats the record! His surviving time is ' + inttostr(Player[ID].BTMin) + ' minutes and ' + inttostr(Player[ID].BTSec) + ' seconds!', ClGood);  
  365.         end else begin  
  366.      if Player[ID].BTMin = LongestTime[1] then  
  367.               if Player[ID].BTSec > LongestTime[2] then begin  
  368.               LongestTime[1] := Player[ID].BTMin;  
  369.                 LongestTime[2] := Player[ID].BTSec;  
  370.                 Player[ID].LongTime := true;  
  371.                     WriteConsole(0,IDToName(ID) + ' beats the record! His surviving time is ' + inttostr(Player[ID].BTMin) + ' minutes and ' + inttostr(Player[ID].BTSec) + ' seconds!', ClGood);  
  372.                 end;      
  373.      end;        
  374.  end;  
  375.  
  376. procedure ForceAchUpdate(ID:Byte; Ach:String);
  377. begin
  378. if ReadINI('Players/'+Accname[ID]+'.ini','achievements',Ach,'*ERROR*') = '*ERROR*' then iniWrite('Players/'+Accname[ID]+'.ini','achievements',Ach,'0');
  379.       if ReadINI('Players/'+Accname[ID]+'.ini','achievements',Ach,'*ERROR while loading achievement*') = '1' then Boolvar[ID]:=True;
  380.       if ReadINI('Players/'+Accname[ID]+'.ini','achievements',Ach,'*ERROR while loading achievement*') = '0' then Boolvar[ID]:=False;
  381. end;
  382.  
  383. Procedure NewLogin(ID:Byte;Name,Pass:String);
  384. begin
  385.  iniPFile :='Players/'+Name+'.ini';
  386.       ini:=iniLoad(iniPFile);
  387.       WriteFile('Players/'+Name+'.ini','');
  388.       iniPFile :='Players/'+Name+'.ini';
  389.       ini:=iniLoad(iniPFile);
  390.       IniWrite(IniPFile,'stats','IP', GetPlayerStat(ID,'IP'));
  391.       IniWrite(IniPFile,'stats','user', Name);
  392.       IniWrite(IniPFile,'stats','pass', Pass);
  393.       IniWrite(IniPFile,'stats','reg', '1');
  394.       IniWrite(IniPFile,'stats','kills', '0');
  395.       iniWrite('Players/'+Name+'.ini','stats','rank','1');
  396.        iniWrite('Players/'+Name+'.ini','stats','ranknum','0');
  397.       iniWrite('Players/'+Name+'.ini','stats','class','1');
  398.       IniWrite(IniPFile,'stats','tna', '0');
  399.       IniWrite(IniPFile,'stats','barkills', '0');
  400.        iniWrite('Players/'+Name+'.ini','stats','tupred','0');
  401.       iniWrite('Players/'+Name+'.ini','achievements','TP','0');
  402.       iniWrite('Players/'+Name+'.ini','achievements','greatgahooka','0');
  403.       iniWrite('Players/'+Name+'.ini','achievements','yeahyeah','0');
  404.       iniWrite('Players/'+Name+'.ini','achievements','speedster','0');
  405.       iniWrite('Players/'+Name+'.ini','achievements','holyshit','0');
  406.       iniWrite('Players/'+Name+'.ini','achievements','catchme','0');
  407.       iniWrite('Players/'+Name+'.ini','achievements','solochaser','0');
  408.       iniWrite('Players/'+Name+'.ini','achievements','quitteasin','0');
  409.       WriteConsole(ID,'login system Activated, new user creation detected',$EE81FAA1);
  410.       WriteConsole(ID,'you have been registered as: '+Name+' and your password has been recorded as: '+Pass+'!',$EE81FAA1);
  411.       WriteConsole(ID,'Remember to login to your account when you join game',$EE81FAA1);
  412.       WriteConsole(ID,'otherwise your stats will be recorded to your starter acc',$EE81FAA1);
  413.       WriteConsole(ID,'you can create as many accs as you wish',$EE81FAA1);
  414.       WriteConsole(ID,'if you need a password reset send an email to snowman533@gmail.com',$EE81FAA1);
  415.       WriteConsole(ID,'remember to include your username in your email',$EE81FAA1);
  416.       WriteConsole(ID,'unauthorized requests will be ignored and will get you banned',$EE81FAA1);
  417.       WriteConsole(ID,'Now recording your stats to your new account',$EE81FAA1);
  418.       WriteConsole(ID,'enjoy your stay :D',$EE81FAA1);
  419.       WriteConsole(ID,'as you rank, your hits will become more powerful',$EE81FAA1);
  420.       Playerinfo[ID].Kills:= strtoint(ReadINI('Players/'+Name+'.ini','stats','kills','0'));
  421.       TP[ID]:=F;
  422.       greatgahooka[ID]:=F;
  423.       yeahyeah[ID]:=F;
  424.       speedster[ID]:=F;
  425.       holyshit[ID]:=F;
  426.       catchme[ID]:=F;
  427.       solochaser[ID]:=F;
  428.       quitteasin[ID]:=F;
  429.       Playerinfo[ID].lvl1percentage:=0;
  430.       playerinfo[ID].defskill:= '';
  431.       playerinfo[ID].lvl1learned:=F;
  432. end;
  433.  
  434. function GetSkillPerk(ID:Byte; SkillPerk:String):String;
  435.   begin
  436.   Result := ReadINI('Players/'+Accname[ID]+'.ini','skills',SkillPerk,'*ERROR*');
  437. end;
  438.  
  439. procedure ExistingLogin(ID:Byte;Name:String);
  440. begin
  441.  
  442.       Playerinfo[ID].Kills:= strtoint(ReadINI('Players/'+Name+'.ini','stats','kills','0'));
  443.       iniPFile :='Players/'+Name+'.ini';
  444.       ini:=iniLoad(iniPFile);
  445.       barKills[ID]:=strtoint(ReadINI('Players/'+Name+'.ini','stats','barkills','0'));
  446.       Playerinfo[ID].Ranknum:=strtoint(ReadINI('Players/'+Name+'.ini','stats','ranknum','0'));
  447.       ForceAchUpdate(ID, 'TP');
  448.       TP[ID]:=Boolvar[ID];
  449.       Playerinfo[ID].achievements:=0;
  450.       if TP[ID] then Playerinfo[ID].achievements:=Playerinfo[ID].achievements + 1;
  451.       ForceAchUpdate(ID, 'greatgahooka');
  452.       greatgahooka[ID]:=Boolvar[ID]
  453.       if greatgahooka[ID] then Playerinfo[ID].achievements:=Playerinfo[ID].achievements + 1;
  454.       ForceAchUpdate(ID, 'yeahyeah');
  455.       yeahyeah[ID]:=Boolvar[ID];
  456.       if yeahyeah[ID] then Playerinfo[ID].achievements:=Playerinfo[ID].achievements + 1;
  457.       ForceAchUpdate(ID, 'speedster');
  458.       speedster[ID]:=Boolvar[ID];
  459.       if speedster[ID] then Playerinfo[ID].achievements:=Playerinfo[ID].achievements + 1;
  460.       DamagePerc[ID]:=(Playerinfo[ID].Ranknum*RankDamageMult)+Playerinfo[ID].achievements;
  461.       ForceAchUpdate(ID, 'holyshit');
  462.       holyshit[ID]:=Boolvar[ID];
  463.       if holyshit[ID] then Playerinfo[ID].achievements:=Playerinfo[ID].achievements + 1;
  464.       ForceAchUpdate(ID, 'catchme');
  465.       catchme[ID]:=Boolvar[ID];
  466.       if catchme[ID] then Playerinfo[ID].achievements:=Playerinfo[ID].achievements + 1;
  467.       ForceAchUpdate(ID, 'solochaser');
  468.       SoloChaser[ID]:=Boolvar[ID];
  469.       if solochaser[ID] then Playerinfo[ID].achievements:=Playerinfo[ID].achievements + 1;
  470.       ForceAchUpdate(ID, 'quitteasin');
  471.       QuitTeasin[ID]:=Boolvar[ID];
  472.       if quitteasin[ID] then Playerinfo[ID].achievements:=Playerinfo[ID].achievements + 1;
  473.       iniWrite('Players/'+Accname[ID]+'.ini','stats','tna',inttostr(Playerinfo[ID].achievements));
  474.       Playerinfo[ID].lvl1percentage:=StrtoInt(ReadINI('Players/'+Accname[ID]+'.ini','skills','defpercent','100'));
  475.       playerinfo[ID].defskill:= GetSkillPerk(ID,'lvl1');
  476.       if getSkillPerk(ID,'lvl1') <> '*ERROR*' then playerinfo[ID].lvl1learned:=T;
  477. end;
  478.  
  479. procedure Achievement(ID:Byte; BroadcastAch, WriteAch:String);
  480. begin
  481.   WriteConsole(ID,BroadcastAch+'!',$EE81FAA1);
  482.       WriteConsole(0,IdtoName(ID)+' has just completed the "'+BroadcastAch+'" achievement',$EE81FAA1);
  483.       WriteConsole(0,'and has earned 500 Cash + 1% DO as an achievement bonus',$EE81FAA1);
  484.       Cash:=Cash+500;
  485.       Playerinfo[ID].achievements:=Playerinfo[ID].achievements+1;
  486.       iniWrite('Players/'+Accname[ID]+'.ini','stats','tna',inttostr(Playerinfo[ID].achievements));
  487.       iniWrite('Players/'+Accname[ID]+'.ini','achievements',WriteAch,'1');
  488.       iniWrite('Players/'+Accname[ID]+'.ini','stats','tupred',inttostr(TUPred[ID]));
  489.       iniWrite('Players/'+Accname[ID]+'.ini','stats','barkills',inttostr(barKills[ID]));
  490.       Playerinfo[ID].achievements:=0;
  491.       if TP[ID] then Playerinfo[ID].achievements:=Playerinfo[ID].achievements + 1;
  492.       if greatgahooka[ID] then Playerinfo[ID].achievements:=Playerinfo[ID].achievements + 1;
  493.       if yeahyeah[ID] then Playerinfo[ID].achievements:=Playerinfo[ID].achievements + 1;
  494.       if speedster[ID] then Playerinfo[ID].achievements:=Playerinfo[ID].achievements + 1;
  495.       if holyshit[ID] then Playerinfo[ID].achievements:=Playerinfo[ID].achievements + 1;
  496.       if catchme[ID] then Playerinfo[ID].achievements:=Playerinfo[ID].achievements + 1;
  497.       if solochaser[ID] then Playerinfo[ID].achievements:=Playerinfo[ID].achievements + 1;
  498.       if quitteasin[ID] then Playerinfo[ID].achievements:=Playerinfo[ID].achievements + 1;
  499.       iniWrite('Players/'+Accname[ID]+'.ini','stats','tna',inttostr(Playerinfo[ID].achievements));
  500. end;
  501.  
  502. Procedure Setstats();
  503. begin
  504.   BonusID:=4;
  505.   DEC:=3000;
  506.   EBN:=2;
  507.   EBNM:=1;
  508.   EDM:=1;
  509.   DED:=47;
  510.   Bottoset:=2;
  511.   DEXN:=1;
  512.   EBNN:=EBN*30;
  513.   EBNNTT:=45;
  514.   EBNNT:=EBNN/3;
  515.   EBNND:=EBNNT*2;
  516.   EDMM:=DED*EDM;
  517.   EDMMT:=EDMM/3;
  518.   EDMMD:=EDMMT*2;
  519.   SetBotTeam:=1;
  520.         OBFLX:=GetSpawnStat(6,'x');
  521.         OBFLY:=GetSpawnStat(6,'x');
  522.  Timer:= 300;
  523.  for i:= 1 to 32 do begin
  524.  if Getplayerstat(i,'Ping') > 0 then begin
  525.   Playerinfo[i].Kills:=strtoint(ReadINI('Players/'+IDtoname(i)+'.ini','stats','kills','0'));
  526.   Playerinfo[i].achievements:=strtoint(ReadINI('Players/'+IDtoname(i)+'.ini','stats','tna','0'));
  527.   TUPred[i]:=strtoint(ReadINI('Players/'+IDtoname(i)+'.ini','stats','tupred','0'));
  528.   Playerinfo[i].Ranknum:=strtoint(ReadINI('Players/'+IDtoname(i)+'.ini','stats','ranknum','0'));
  529.   end;
  530.   end;
  531. end;
  532.  
  533. Procedure NewPlayer(ID:Byte);
  534. begin
  535.  iniPFile :='Players/'+IDtoname(ID)+'.ini';
  536.       ini:=iniLoad(iniPFile);
  537.       WriteFile('Players/'+IDtoname(ID)+'.ini','');
  538.       iniPFile :='Players/'+IDtoname(ID)+'.ini';
  539.       ini:=iniLoad(iniPFile);
  540.       IniWrite(IniPFile,'stats','IP', GetPlayerStat(ID,'IP'));
  541.       IniWrite(IniPFile,'stats','reg', '1');
  542.       IniWrite(IniPFile,'stats','kills', '0');
  543.       iniWrite('Players/'+IDtoname(ID)+'.ini','stats','rank','1');
  544.        iniWrite('Players/'+IDtoname(ID)+'.ini','stats','ranknum','0');
  545.       iniWrite('Players/'+IDtoname(ID)+'.ini','stats','class','1');
  546.       IniWrite(IniPFile,'stats','tna', '0');
  547.       IniWrite(IniPFile,'stats','barkills', '0');
  548.        iniWrite('Players/'+IDtoname(ID)+'.ini','stats','tupred','0');
  549.       iniWrite('Players/'+IDtoname(ID)+'.ini','achievements','TP','0');
  550.       iniWrite('Players/'+IDtoname(ID)+'.ini','achievements','greatgahooka','0');
  551.       iniWrite('Players/'+IDtoname(ID)+'.ini','achievements','yeahyeah','0');
  552.       iniWrite('Players/'+IDtoname(ID)+'.ini','achievements','speedster','0');
  553.       iniWrite('Players/'+IDtoname(ID)+'.ini','achievements','holyshit','0');
  554.       iniWrite('Players/'+IDtoname(ID)+'.ini','achievements','catchme','0');
  555.       iniWrite('Players/'+IDtoname(ID)+'.ini','achievements','solochaser','0');
  556.       iniWrite('Players/'+IDtoname(ID)+'.ini','achievements','quitteasin','0');
  557.       WriteConsole(ID,'Automated login system Activated, new/unregistered user detected',$EE81FAA1);
  558.       WriteConsole(ID,'Welcome '+idtoname(ID)+'!',$EE81FAA1);
  559.       WriteConsole(ID,'Your player name has been registered to your IP: '+getplayerstat(ID,'IP'),$EE81FAA1);
  560.       WriteConsole(ID,'should you need to change your name, ie add clan tags:',$EE81FAA1);
  561.       WriteConsole(ID,'admin will update your registration details',$EE81FAA1);
  562.       WriteConsole(ID,'remember you are allowed 3 different player names before being kicked',$EE81FAA1);
  563.       WriteConsole(ID,'Beginning stats collection for your account',$EE81FAA1);
  564.       WriteConsole(ID,'use !stats to see your current player stats',$EE81FAA1);
  565.       WriteConsole(ID,'You will now receive achievements',$EE81FAA1);
  566.       WriteConsole(ID,'enjoy your stay :D',$EE81FAA1);
  567.       WriteConsole(ID,'as you rank, your hits will become more powerful',$EE81FAA1);
  568.       Playerinfo[ID].lvl1percentage:=0;
  569.       playerinfo[ID].defskill:= '';
  570.       playerinfo[ID].lvl1learned:=F;
  571. end;
  572.  
  573. procedure ExistingPlayer(ID:Byte);
  574. begin
  575.       Playerinfo[ID].Kills:= strtoint(ReadINI('Players/'+Accname[ID]+'.ini','stats','kills','0'));
  576.       WriteConsole(ID,'Automated Login System Activated',$EE81FAA1);
  577.       WriteConsole(ID,'Welcome back '+idtoname(ID)+'!',$EE81FAA1);
  578.       iniPFile :='Players/'+IDtoname(ID)+'.ini';
  579.       ini:=iniLoad(iniPFile);
  580.       barKills[ID]:=strtoint(ReadINI('Players/'+IDtoname(ID)+'.ini','stats','barkills','0'));
  581.       Playerinfo[ID].RankNum:=strtoint(ReadINI('Players/'+IDtoname(ID)+'.ini','stats','ranknum','0'));
  582.       ForceAchUpdate(ID, 'TP');
  583.       TP[ID]:=Boolvar[ID];
  584.       ForceAchUpdate(ID, 'greatgahooka');
  585.       greatgahooka[ID]:=Boolvar[ID]
  586.       ForceAchUpdate(ID, 'yeahyeah');
  587.       yeahyeah[ID]:=Boolvar[ID];
  588.       ForceAchUpdate(ID, 'speedster');
  589.       speedster[ID]:=Boolvar[ID];
  590.       TNA[ID]:=strtoint(ReadINI('Players/'+IDtoname(i)+'.ini','stats','tna','0'));
  591.       DamagePerc[ID]:=(Playerinfo[ID].Ranknum*RankDamageMult)+tna[ID];
  592.       ForceAchUpdate(ID, 'holyshit');
  593.       holyshit[ID]:=Boolvar[ID];
  594.       ForceAchUpdate(ID, 'catchme');
  595.       catchme[ID]:=Boolvar[ID];
  596.       ForceAchUpdate(ID, 'solochaser');
  597.       SoloChaser[ID]:=Boolvar[ID];
  598.       ForceAchUpdate(ID, 'quitteasin');
  599.       QuitTeasin[ID]:=Boolvar[ID];
  600.       Playerinfo[ID].lvl1percentage:=StrtoInt(ReadINI('Players/'+Accname[ID]+'.ini','skills','defpercent','10'));
  601.       playerinfo[ID].defskill:= GetSkillPerk(ID,'lvl1');
  602.       if getSkillPerk(ID,'lvl1') <> '*ERROR*' then playerinfo[ID].lvl1learned:=T;
  603. end;
  604.  
  605. procedure UpdateCharVars();
  606. begin
  607. for i := 1 to 32 do
  608.     begin
  609.       if GetPlayerStat(i,'Human') = true then begin
  610.         BKS[i]:= BKS[i];
  611.          Cash:=Cash+(Killnum[i]*BKS[i]);
  612.         TTCash[i]:=Killnum[i]*BKS[i];
  613.         WriteConsole(i,'Match Bonus!',$EE81FAA1);
  614.         WriteConsole(i,'Your performance this map:',$EE81FAA1);
  615.         WriteConsole(i,'Total Kills: '+Inttostr(Killnum[i])+'!',$EE81FAA1);
  616.         WriteConsole(i,'Total Flag Scores: '+inttostr(TFC[i])+'!',$EE81FAA1);
  617.         WriteConsole(i,'Best Kill-Streak: '+inttostr(BKS[i])+'!',$EE81FAA1);
  618.         WriteConsole(i,'Longest Time Survived: '+inttostr(BTMin[i])+':'+inttostr(BTSec[i])+' (M:S)!',$EE81FAA1);
  619.         if shop = true then begin
  620.           WriteConsole(i,'Congrats, you have earned your team: '+inttostr(Killnum[i]*BKS[I])+' bonus cash for kills this match',$EE81FAA1);
  621.           Tcash:=Tcash+Killnum[i];
  622.         end;
  623.       end;
  624.     end;
  625.     if shop = true then WriteConsole(0,'Alpha Team Match Bonus: '+inttostr(Tcash)+' (+'+inttostr(Tcash)+' Cash)!',$EE00FFFF);
  626.     Tcash:=0;
  627.   end;
  628.  
  629.   Function SetRank(ID:Byte; Rank, PlayerClass:String; PRanknum: Integer):String;
  630. begin
  631.   iniWrite('Players/'+Accname[ID]+'.ini','stats','rank',Rank);
  632.   iniWrite('Players/'+Accname[ID]+'.ini','stats','class',PlayerClass);
  633.   Playerinfo[ID].Ranknum:=Playerinfo[ID].Ranknum*RankDamageMult;
  634.   WriteConsole(ID,'Congratulations on promotion soldier!',$EE81FAA1);
  635.   WriteConsole(ID,'You are now: '+Rank,$EE81FAA1);
  636.   WriteConsole(0,IDtoname(ID)+' has just ranked to '+Rank+'!',$EE81FAA1);
  637.   Playerinfo[ID].Ranknum:=PRankNum;
  638.   iniWrite('Players/'+Accname[ID]+'.ini','stats','ranknum',inttostr(Playerinfo[ID].Ranknum));
  639. end;
  640.  
  641. function CheckPlayerDist(ID:Byte;chkpxID,chkpyID,Distance:Integer):Boolean;
  642. var Dist:Single;
  643. begin
  644.   if RayCast(GetPlayerStat(ID,'x'),GetPlayerstat(ID,'y'),chkpxID,chkpyID,Dist,Distance) then Result:=T;
  645. end;
  646.  
  647. function PlayerSeenFromFlag(ID,Flag:Byte):Boolean;
  648. var Dist:Single;
  649. begin
  650.   if RayCast(GetPlayerStat(ID,'x'),GetPlayerstat(ID,'y'),GetObjectstat(Flag,'x'),GetObjectstat(Flag,'y'),Dist,5000000) then Result:=T;
  651. end;
  652.  
  653. procedure SetSkillPerk(ID:Byte; lvl, SkillPerk:String);
  654. begin
  655.   iniWrite('Players/'+Accname[ID]+'.ini','skills', lvl, SkillPerk);
  656.   Skill:=SkillPerk;
  657. end;
  658.  
  659. {Function SaveAccName(ID:Byte;):String;
  660. begin
  661.   for i:= 1 to 32 do begin}
  662.    
  663.  
  664. Const
  665. predat = 225;
  666. teampred = 600;
  667. serk = 200;
  668. teamserk= 600;
  669. nades = 3000;
  670. ally = 30000;
  671. holycross = 50000;
  672. speed = 200;
  673. teamspeed = 900;
  674. flagtele = 1000;
  675. turret = 30000;
  676.  
  677. procedure ActivateServer();
  678. begin
  679.   Setstats();
  680.   Cash := strtoint(ReadINI('scripts/Shop/profit.ini','profit','cash','0'));
  681.   for i:= 1 to 32 do begin
  682.     ForceAchUpdate(i, 'TP');
  683.     TP[i]:=Boolvar[i];
  684.     ForceAchUpdate(i, 'greatgahooka');
  685.     greatgahooka[i]:=Boolvar[i]
  686.     ForceAchUpdate(i, 'yeahyeah');
  687.     yeahyeah[i]:=Boolvar[i];
  688.     ForceAchUpdate(i, 'speedster');
  689.     speedster[i]:=Boolvar[i];
  690.     ItemID:=1;
  691.   end;
  692.   if ReadINI('scripts/Shop/profit.ini','script','shop','*ERROR*') = '1' then shop := True;
  693.   if ReadINI('scripts/Shop/profit.ini','script','shop','*ERROR*') = '0' then shop := False;
  694. end;
  695.  
  696. function OnPlayerCommand(ID: Byte; Text: string): boolean;
  697. begin
  698. if shop = True then begin
  699.   Case Lowercase(Text) of
  700.    '/save' : begin
  701.     Writeconsole(ID,'Saved all accs, thanks for helping',$0000FFFF);
  702.     for i:= 1 to 32 do if Getplayerstat(i,'Ping') > 0 then begin
  703.       iniWrite('Players/'+Accname[i]+'.ini','stats','kills',inttostr(Playerinfo[i].Kills));
  704.       iniWrite('Players/'+Accname[i]+'.ini','stats','tupred',inttostr(TUPred[i]));
  705.       iniWrite('Players/'+Accname[i]+'.ini','stats','barkills',inttostr(barKills[i]));
  706.       iniWrite('Players/'+Accname[i]+'.ini','stats','ranknum',inttostr(Playerinfo[i].Ranknum));
  707.     end;
  708.     iniWrite('scripts/Shop/profit.ini','profit','cash',inttostr(Cash));
  709.     if TP[ID] = False then begin
  710.       TP[ID]:=True;
  711.       Achievement(ID,'Team Mate', 'TP');
  712.     end;
  713.    end;
  714.  
  715.   '/char' : begin
  716.     Playerinfo[ID].achievements:=strtoint(ReadINI('Players/'+Accname[ID]+'.ini','stats','tna','*ERROR while loading achievements*'));
  717.     DamagePerc[ID]:=(Playerinfo[ID].Ranknum*RankDamageMult)+Playerinfo[ID].achievements;
  718.     if Playerinfo[ID].Admin = True then DamagePerc[ID]:=DamagePerc[ID]+10;
  719.     WriteConsole(ID,'Your stats',$EE81FAA1);
  720.     WriteConsole(ID,'Total Kills: '+inttostr(Playerinfo[ID].Kills)+'!',$EE81FAA1);
  721.     WriteConsole(ID,'Rank: '+ReadINI('Players/'+Accname[ID]+'.ini','stats','rank','*ERROR while loading rank*')+'!',$EE81FAA1);
  722.     WriteConsole(ID,'Class: '+ReadINI('Players/'+Accname[ID]+'.ini','stats','class','*ERROR while loading class*')+'!',$EE81FAA1);
  723.     WriteConsole(ID,'Total Barret Kills: '+inttostr(barKills[ID])+'!',$EE81FAA1);
  724.     WriteConsole(ID,'Total number of Predators used: '+inttostr(TUPred[ID])+'!',$EE81FAA1);
  725.     WriteConsole(ID,'Total number of Achievements: '+ReadINI('Players/'+Accname[ID]+'.ini','stats','tna','*ERROR while loading achievements*')+'!',$EE81FAA1);
  726.     WriteConsole(ID,'Damage Output: +'+inttostr(DamagePerc[ID])+'%!',$EE81FAA1);
  727.    end;
  728.  
  729.    '/cash' : begin
  730.       WriteConsole(0,IdtoName(ID)+' has just requested Cash levels!',$EE81FAA1);
  731.       WriteConsole(0,'Global Player Cash: '+inttostr(Cash),$EE81FAA1);
  732.     end;
  733.    
  734.    '/buy pred' : begin
  735.       if Cash < 200 then WriteConsole(0,IdtoName(ID)+' just tried to purchase predator, not enough funds!',$EE81FAA1);
  736.       if Cash >= 200 then begin
  737.         Cash :=Cash-200;
  738.         WriteConsole(0,IdtoName(ID)+' has just bought predator for 200 Cash',$EE81FAA1);
  739.         GiveBonus(ID, 1);
  740.         SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),20);
  741.         TUPred[ID]:=TUPred[ID]+1;
  742.       end;
  743.     end;
  744.  
  745.    '/buy tpred' : begin
  746.       if Cash < 600 then WriteConsole(0,IdtoName(ID)+' just tried to purchase Team Predator, not enough funds!',$EE81FAA1);
  747.       if Cash >= 600 then begin
  748.         Cash :=Cash-600;
  749.         WriteConsole(0,IdtoName(ID)+' has just bought Team Predator for 600 Cash',$EE81FAA1);
  750.         for i := 1 to 32 do if GetPlayerStat(i,'Team') = 1 AND GetPlayerStat(i,'Alive') then begin
  751.           GiveBonus(i, 1);
  752.           TUPred[ID]:=TUPred[ID]+1;
  753.         end;
  754.       end;
  755.     end;
  756.    
  757.    '/buy serk' : begin
  758.       if Cash < 195 then WriteConsole(0,IdtoName(ID)+' just tried to purchase berserker, not enough funds!',$EE81FAA1);
  759.       if Cash >= 195 then begin
  760.         Cash :=Cash-195;
  761.         WriteConsole(0,IdtoName(ID)+' has just bought berserker for 195 Cash',$EE81FAA1);
  762.         GiveBonus(ID, 2);
  763.       end;
  764.     end;
  765.    
  766.    '/buy bes' : begin
  767.       if Cash < 200 then WriteConsole(0,IdtoName(ID)+' just tried to purchase The Beserker, not enough funds!',$EE81FAA1);
  768.       if Cash >= 200 then begin
  769.         Cash :=Cash-200;
  770.         WriteConsole(0,IdtoName(ID)+' has just bought Beserker for 600 Cash',$EE81FAA1);
  771.         GiveBonus(i, 2);
  772.       end;
  773.     end;
  774.  
  775.    '/buy tbes' : begin
  776.       if Cash < 600 then WriteConsole(0,IdtoName(ID)+' just tried to purchase Team Beserker, not enough funds!',$EE81FAA1);
  777.       if Cash >= 600 then begin
  778.         Cash:=Cash-600;
  779.         WriteConsole(0,IdtoName(ID)+' has just bought Team Beserker for 600 Cash',$EE81FAA1);
  780.         for i := 1 to 32 do if GetPlayerStat(i,'Team') = 1 AND GetPlayerStat(i,'Alive')=true then GiveBonus(i, 2);
  781.       end;
  782.     end;
  783.    
  784.    '/buy clusters' : begin
  785.       if (Cash < 3000) AND (BonusID <> 5) then WriteConsole(0,IdtoName(ID)+' just tried to purchase the clusters, not enough funds!',$EE81FAA1);
  786.       if BonusID = 5 then WriteConsole(ID,'cluster grenades are already in affect, try normal nades!',$EE81FAA1);
  787.       if (Cash >= 3000) AND (BonusID <> 5) then begin
  788.         Cash :=Cash-3000;
  789.         BonusID:=5;
  790.         WriteConsole(0,IdtoName(ID)+' has just bought the cluster grenade upgrade for 3000 Cash',$EE81FAA1);
  791.         GiveBonus(ID,BonusID);
  792.       end;
  793.     end;
  794.    
  795.    '/buy nades' : begin
  796.       if (Cash < 3000) AND (BonusID <> 4) then WriteConsole(0,IdtoName(ID)+' just tried to purchase the nades, not enough funds!',$EE81FAA1);
  797.       if BonusID = 4 then WriteConsole(ID,'regular grenades are already in affect, try clusters!',$EE81FAA1);
  798.       if (Cash >= 3000) AND (BonusID <> 4) then begin
  799.         Cash :=Cash-3000;
  800.         BonusID:=4;
  801.         WriteConsole(0,IdtoName(ID)+' has just bought the regular grenade upgrade for 3000 Cash',$EE81FAA1);
  802.         GiveBonus(ID,BonusID);
  803.       end;
  804.     end;
  805.    
  806.    '/buy dex' : begin
  807.       if Cash < DEC then WriteConsole(0,IdtoName(ID)+' just tried to purchase bigger bangs, not enough funds!',$EE81FAA1);
  808.       if Cash >= DEC then begin
  809.         EBNM :=EBNM+1;
  810.         EBN :=3*EBNM;
  811.         EDM :=EDM+1;
  812.         ED := (5*EDM)+ED;
  813.         DEXN :=DEXN+1;
  814.         WriteConsole(0,IdtoName(ID)+' has just bought bigger bangs for '+inttostr(DEC)+' Cash',$EE81FAA1);
  815.         Cash :=Cash-DEC;
  816.         DECC :=DEC/3;
  817.         DEC :=(DEC+DECC)*3;
  818.       end;
  819.     end;
  820.    
  821.    '/buy ally' : begin
  822.       if Cash < 30000 then WriteConsole(0,IdtoName(ID)+' just tried to purchase an ally, not enough funds!',$EE81FAA1);
  823.       if Cash >= 30000 then begin
  824.         Cash :=Cash-30000;
  825.         WriteConsole(0,IdtoName(ID)+' has just bought an ally for 30000 Cash',$EE81FAA1);
  826.         Owner[Bottoset].Name := idtoname(ID);
  827.         Owner[Bottoset].PlayerID := ID;
  828.         Command('/setteam1 '+IntToStr(Bottoset));
  829.         Bottoset:=Bottoset+1;
  830.       end;
  831.     end;
  832.    
  833.    '/buy holycross' : begin
  834.       if Cash < 30000 then WriteConsole(0,IdtoName(ID)+' just tried to purchase Holy Cross, not enough funds!',$EE81FAA1);
  835.       if Cash >= 30000 then begin
  836.         HC:=true;
  837.         WriteConsole(0,IdtoName(ID)+' has just bought Holy Cross for 30000 Cash',$EE81FAA1);
  838.         Cash:=Cash-30000;
  839.       end;
  840.     end;
  841.  
  842.    '/buy speed' : begin
  843.       if Cash < predat then WriteConsole(0,IdtoName(ID)+' just tried to purchase the speed gun, not enough funds!',$EE81FAA1);
  844.       if Cash >= predat then begin
  845.         WriteConsole(0,IdtoName(ID)+' has just bought the speed gun for '+inttostr(predat)+' Cash',$EE81FAA1);
  846.         WriteConsole(ID,'Server PM: '+IdtoName(ID)+': remember, when you die, you lose the gun',$EE81FAA1);
  847.         WriteConsole(ID,'Server PM: so use it wisely',$EE81FAA1);
  848.         Cash:=Cash-predat;
  849.         SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),18);
  850.       end;
  851.     end;
  852.  
  853.    '/buy tspeed' : begin
  854.       if Cash < 900 then WriteConsole(0,IdtoName(ID)+' just tried to purchase Team Speed, not enough funds!',$EE81FAA1);
  855.       if Cash >= 900 then begin
  856.         Cash :=Cash-900;
  857.         WriteConsole(0,IdtoName(ID)+' has just bought Team Speed for 300 Cash',$EE81FAA1);
  858.         for i := 1 to 32 do if GetPlayerStat(i,'Team') = 1 AND GetPlayerStat(i,'Alive') then SpawnObject(GetPlayerStat(i,'x'),GetPlayerStat(i,'y'),18);
  859.       end;
  860.     end;
  861.    
  862.    '/buy ftp' : begin
  863.       if Cash < 10000 then WriteConsole(0,IdtoName(ID)+' just tried to purchase a Flag Teleport, not enough funds!',$EE81FAA1);
  864.       if Cash >= 10000 then begin
  865.         Cash :=Cash-10000;
  866.         WriteConsole(0,IdtoName(ID)+' has just bought a Flag Teleport for 10000 Cash',$EE81FAA1);
  867.         NFT[ID]:=NFT[ID]+1;
  868.         WriteConsole(ID,'You now have '+inttostr(NFT[ID])+' teleports!',$EE81FAA1);
  869.       end;
  870.     end;
  871.    
  872.    '/buy turret' : begin
  873.       if Cash < 30000 then WriteConsole(0,IdtoName(ID)+' just tried to purchase an automated Turret, not enough funds!',$EE81FAA1);
  874.       if (PlayerSeenFromFlag(ID,RedFlag)=F) AND (PlayerSeenfromFlag(ID, BlueFlag)=F) AND (Cash >= 30000) then begin
  875.         SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y')-15,15);
  876.         ItemOwner[ItemID].PlayerID:=ID;
  877.         ItemOwner[ItemID].Team:=GetPlayerStat(ID,'Team');
  878.         ItemInfo[ItemID].x:=GetPlayerStat(ID,'x');
  879.         ItemInfo[ItemID].y:=GetPlayerStat(ID,'y');
  880.         ItemInfo[ItemID].Name:= 'Auto Turret';
  881.         ItemID := ItemID+1;
  882.         Cash :=Cash-30000;
  883.         WriteConsole(0,IdtoName(ID)+' has just bought an automated Turret for 30000 Cash',$EE81FAA1)
  884.       end else begin
  885.         WriteConsole(ID,'One of the Flags reports that they have a visual on you...',ClBad);
  886.         WriteConsole(ID,'You cannot place a turret here',ClBad);
  887.       end;
  888.     end;
  889.    
  890.    '/buy mfg' : begin
  891.       if Cash < 200000 then WriteConsole(0,IdtoName(ID)+' just tried to purchase a Massive Flak Gun (MFG), not enough funds!',$EE81FAA1);
  892.       if (PlayerSeenFromFlag(ID,RedFlag)=F) AND (PlayerSeenfromFlag(ID, BlueFlag)=F) AND (Cash >= 200000) then begin
  893.         SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y')-15,15);
  894.         ItemOwner[ItemID].PlayerID:=ID;
  895.         ItemOwner[ItemID].Team:=GetPlayerStat(ID,'Team');
  896.         ItemInfo[ItemID].x:=GetPlayerStat(ID,'x');
  897.         ItemInfo[ItemID].y:=GetPlayerStat(ID,'y');
  898.         ItemInfo[ItemID].Name:= 'Massive Flak Gun';
  899.         ItemID := ItemID+1;
  900.         Cash :=Cash-200000;
  901.         WriteConsole(0,IdtoName(ID)+' has just bought a Massive Flak Gun (MFG) for 200,000 Cash',$EE81FAA1)
  902.       end else begin
  903.         WriteConsole(ID,'One of the Flags reports that they have a visual on you...',ClBad);
  904.         WriteConsole(ID,'You cannot place a turret here',ClBad);
  905.       end;
  906.     end;
  907.  
  908.    '/buy nuke turret' : begin
  909.       if Cash < 50000 then WriteConsole(0,IdtoName(ID)+' just tried to purchase a Nuke Turret, not enough funds!',$EE81FAA1);
  910.       if Cash >= 50000 then begin
  911.         ItemOwner[ItemID].PlayerID:=ID;
  912.         ItemInfo[ItemID].x:=GetPlayerStat(ID,'x');
  913.         ItemInfo[ItemID].y:=GetPlayerStat(ID,'y');
  914.         ItemInfo[ItemID].Name:= 'Nuke Turret';
  915.         ItemInfo[ItemID].TrigTimer := 10;
  916.         SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y')-15,15);
  917.         ItemID := ItemID+1;
  918.         Cash :=Cash-50000;
  919.         WriteConsole(0,IdtoName(ID)+' has just bought a Nuke Turret for 50000 Cash',$EE81FAA1);
  920.         WriteConsole(ID,'Arming...stay close to arm it!',$EE81FAA1);
  921.       end;
  922.     end;
  923.  
  924.    '/buy assassin' : begin
  925.       for i := 1 to 32 do if idtoname(i) = 'Mr.Zombie' then begin
  926.         waiting4bot[ID] := True;
  927.         Command('/kick '+inttostr(i));
  928.         Owner[i].Name := idtoname(ID);
  929.         Owner[i].PlayerID := ID;
  930.         Command('/addbot1 MRZOMBIEA');
  931.         break;
  932.       end;
  933.     end;
  934.  
  935.    '/items' : begin
  936.       WriteConsole(0,'/buy pred - gives u pred bonus - '+inttostr(predat)+' cash',$EE81FAA1);
  937.       WriteConsole(0,'/buy tpred - gives all Alpha team pred bonus - 600 cash',$EE81FAA1);
  938.       WriteConsole(0,'/buy serk - gives u berserker bonus - 195 cash',$EE81FAA1);
  939.       WriteConsole(0,'/buy tbes - gives all Alpha team berserker bonus - 600 cash',$EE81FAA1);
  940.       WriteConsole(0,'/buy clusters - upgrades your nade bonus to clusters - 3000 cash',$EE81FAA1);
  941.       WriteConsole(0,'/buy nades - upgrades your cluster bonus to nades - 3000 cash',$EE81FAA1);
  942.       WriteConsole(0,'---->grenade upgrades affects whole team',$EE81FAA1);
  943.       WriteConsole(0,'/buy dex - upgrades normal death explosion size - '+inttostr(DEC)+' Cash',$EE81FAA1);
  944.       WriteConsole(0,'---->does not affect suicides',$EE81FAA1);
  945.       WriteConsole(0,'/buy holycross - Kills all zombies on Red Team score - 30000 cash',$EE81FAA1);
  946.       WriteConsole(0,'/buy ally - brainwash a zombie to join Alpha team - 30000 cash',$EE81FAA1);
  947.       WriteConsole(0,'/buy speed - gives you the flamer gun - 225 cash',$EE81FAA1);
  948.       WriteConsole(0,'/buy tspeed - gives all Alpha team the flamer gun - 900 cash',$EE81FAA1);
  949.       WriteConsole(0,'/buy FTP - Teleports you to your flag on grab of other - 10000 cash',$EE81FAA1);
  950.       WriteConsole(0,'/buy turret - gives you an automated turret - 30000 cash',$EE81FAA1);
  951.       WriteConsole(0,'/buy nuke turret - gives you a nuke turret - 50000 cash',$EE81FAA1);
  952.       WriteConsole(0,'-->Arms 10 sec after purchase, then a massive explosion',$EE81FAA1);
  953.       WriteConsole(0,'when a zombie comes into range, then same again after 30 seconds',$EE81FAA1);
  954.       WriteConsole(0,'/buy MFG - gives you a Massive Flak Gun (MFG) - 60000 cash',$EE81FAA1);
  955.       WriteConsole(0,'MFG is a defensive turret, fires massive flak bullets at the enemy',$EE81FAA1);
  956.       WriteConsole(0,'place anywhere out of sight of a flag',$EE81FAA1);
  957.     end;
  958.  
  959.    '/dex on' : begin
  960.     deathexp[ID]:=True;
  961.     WriteConsole(ID,'Death explosions enabled for your ID, have fun',$EE81FAA1);
  962.     WriteConsole(ID,'consider others, before you leave please use /dex off',$EE81FAA1);
  963.    end;
  964.  
  965.    '/dex off' : begin
  966.     deathexp[ID]:=False;
  967.     WriteConsole(ID,'Death explosions disabled for your ID, I hope you enjoyed it',$EE81FAA1);
  968.    end;
  969.   end;
  970.  
  971.   if (Playerinfo[ID].lvl1learned=F) AND (PlayerInfo[ID].Kills>50) then begin
  972.     Case Lowercase(Text) of
  973.       '/learn kerbam': begin
  974.         PLayerInfo[ID].lvl1learned:=T;
  975.         Playerinfo[ID].Defskill:= 'kerbam';
  976.         SetSkillPerk(ID,'lvl1','kerbam');
  977.         Playerinfo[ID].lvl1percentage:=10;
  978.         iniWrite('Players/'+Accname[ID]+'.ini','skills','defpercent', inttostr(playerinfo[ID].lvl1percentage));
  979.         WriteConsole(ID,'Perk: kerbam learned, your current chance is 10 percent, will increase with rank',ClGood);
  980.       end;
  981.    
  982.       '/learn shield': begin
  983.         PLayerInfo[ID].lvl1learned:=T;
  984.         Playerinfo[ID].Defskill:= 'shield';
  985.         SetSkillPerk(ID,'lvl1','shield');
  986.       end;
  987.     end;
  988.   end else begin
  989.     //WriteConsole(ID,'You cannot '+Text+' yet, Rookie, Keep Killin ;)',ClBad);
  990.   end;
  991.  
  992.   if GetPiece(Text,' ',0) = '/create' then begin
  993.     NewLogin(ID, GetPiece(Text,' ',1),GetPiece(Text,' ',2));
  994.     AccName[ID]:= GetPiece(Text,' ',1);
  995.     Playerinfo[ID].Ranknum:=strtoint(ReadINI('Players/'+Accname[ID]+'.ini','stats','ranknum','0'));
  996.     Playerinfo[ID].achievements:=strtoint(ReadINI('Players/'+Accname[ID]+'.ini','stats','tna','0'));
  997.   end;
  998.  
  999.   if GetPiece(Text,' ',0) = '/login' then begin
  1000.     if FileExists('Players/'+GetPiece(Text,' ',1)+'.ini') = False then WriteConsole(ID,'This username does not exist or is incorrect, please try again',$EE81FAA1);
  1001.     if FileExists('Players/'+GetPiece(Text,' ',1)+'.ini') then begin
  1002.       if GetPiece(Text,' ',2) <> ReadINI('Players/'+GetPiece(Text,' ',1)+'.ini','stats','pass','*ERROR*') then WriteConsole(ID,'This password is incorrect, please try again',$EE81FAA1);
  1003.       if GetPiece(Text,' ',2) = ReadINI('Players/'+GetPiece(Text,' ',1)+'.ini','stats','pass','*ERROR*') then begin
  1004.         Accname[ID]:= GetPiece(Text,' ',1);
  1005.         WriteConsole(ID,'Login Successful, Welcome Back '+GetPiece(Text,' ',1)+'!',$EE81FAA1);
  1006.         ExistingLogin(ID,Accname[ID]);
  1007.         Playerinfo[ID].achievements:=strtoint(ReadINI('Players/'+Accname[ID]+'.ini','stats','tna','0'));
  1008.       end;
  1009.     end;
  1010.   end;
  1011.   end;
  1012. end;
  1013.  
  1014. procedure OnMapChange(NewMap: string);
  1015. begin
  1016.   for i:= 1 to 32 do if Getplayerstat(i,'Ping') > 0 then iniWrite('Players/'+GetPlayerStat(i,'Name')+'.ini','stats','kills',inttostr(PlayerInfo[i].Kills));
  1017.   for i:= 1 to 32 do begin
  1018.     TFC[i]:=0;
  1019.     BKS[i]:=0;
  1020.     NKS[i]:=0;
  1021.     NTB[i]:=False;
  1022.     ntTimer[i]:=0;
  1023.     ntfTimer[i]:=0;
  1024.     KBZombie[i]:=0;
  1025.     iniPFile :='Players/'+Accname[i]+'.ini';
  1026.     IniWrite(IniPFile,'stats','kills', inttostr(Playerinfo[i].Kills));
  1027.     iniWrite('Players/'+Accname[i]+'.ini','stats','barkills',inttostr(barKills[i]));
  1028.     iniWrite('scripts/Shop/profit.ini','profit','cash',inttostr(Cash));
  1029.     iniWrite('Players/'+Accname[i]+'.ini','stats','ranknum',inttostr(Playerinfo[i].ranknum));
  1030.   end;
  1031.   for z := 1 to ItemID do ItemOwner[z].PlayerID:=0;
  1032.   ItemID:=1;
  1033.   OBFLX:=GetSpawnStat(6,'x');
  1034.   OBFLY:=GetSpawnStat(6,'x');
  1035.   For i := 1 to 32 do if shop = true then GiveBonus(i, BonusID);
  1036.   Tcash:=0;
  1037. end;
  1038.  
  1039. procedure OnPlayerRespawn(ID: byte);
  1040. begin
  1041.   if shop = true then GiveBonus(ID,BonusID);
  1042. end;
  1043.  
  1044. procedure OnJoinTeam(ID, Team: byte);
  1045. begin
  1046.   if ReadINI('Players/'+IDtoname(ID)+'.ini','stats','admin','0') = '1' then Playerinfo[ID].Admin:=True;
  1047.   PlayerInfo[ID].Team:=Team;
  1048.   if (Team = 1) AND FileExists('Players/'+IDtoname(ID)+'.ini') then begin
  1049.     ExistingPlayer(ID);
  1050.     Accname[ID] := idtoname(ID);
  1051.   end;
  1052.   if FileExists('Players/'+IDtoname(ID)+'.ini') = False then NewPlayer(ID);
  1053.   if shop = true then GiveBonus(ID, BonusID);
  1054. end;
  1055.  
  1056. Procedure OnJoinGame(ID,Team:Byte);
  1057. begin
  1058.   ResetStats(ID);
  1059. end;
  1060.  
  1061. procedure OnFlagScore(ID, TeamFlag: byte);
  1062. begin
  1063.   if (SpeedTimer[ID] > 0) AND (speedster[ID]=False) then begin
  1064.     speedster[ID]:=True;
  1065.     Achievement(ID,'Speedster','speedster');
  1066.     SpeedTimer[ID]:=-1;
  1067.   end;
  1068.  
  1069.   if shop = true then begin
  1070.     i:=Random(1,2);
  1071.     if (i = 1) AND (GetPlayerStat(ID,'Team') = 1) then begin
  1072.       for i := 1 to 32 do if GetPlayerStat(i,'Alive') then SpawnObject(GetPlayerStat(i,'x'),GetPlayerStat(i,'y'),18);
  1073.     end;
  1074.     if i = 2 then for i := 1 to 32 do begin
  1075.       if GetPlayerStat(ID,'Team') = 1 then if GetPlayerStat(i,'Alive') = true then if GetPlayerStat(i,'Team') = 1 then begin
  1076.         GiveBonus(i, 1);
  1077.         SpawnObject(GetPlayerStat(i,'x'),GetPlayerStat(i,'y'),20);
  1078.         TUPred[i]:=TUPred[i]+1;
  1079.       end;
  1080.     end;
  1081.   end;
  1082.  
  1083.   if shop = false then begin
  1084.     for i := 1 to 32 do if GetPlayerStat(ID,'Team') = 1 AND GetPlayerStat(i,'Alive') then begin
  1085.       GiveBonus(i, 1);
  1086.       SpawnObject(GetPlayerStat(i,'x'),GetPlayerStat(i,'y'),20);
  1087.       TUPred[i]:=TUPred[i]+1;
  1088.     end;
  1089.   end;
  1090.  
  1091.   TFC[ID]:=TFC[ID]+1;
  1092.   if HC = true then begin
  1093.     if GetPlayerStat(ID,'Human') = true then begin
  1094.       WriteConsole(0,'Holy Cross Activated, Alpha team has scored!',$EE81FAA1);
  1095.       DrawText(0,'HULELUJA!',330,RGB(255,255,255),0.20,40,240);
  1096.       for i := 1 to 32 do if GetPlayerStat(i,'Human') = false then CreateBullet(GetPlayerStat(i,'x'), GetPlayerStat(i,'y') - 0, 0,-20,100, 3, ID);
  1097.     end;
  1098.     Cash:=Cash+50
  1099.     WriteConsole(0,IdtoName(ID)+' earned Alpha Team 50 Cash for scoring under the Cross!',$EE81FAA1);
  1100.   end;
  1101.  
  1102.   if GetPlayerStat(ID,'Human') = true then begin
  1103.     WriteConsole(0,'Human Cappers Bonus @ '+IDtoName(ID)+'! (+50 cash)',$EE81FAA1);
  1104.     Cash:=Cash+50;
  1105.   end;
  1106.  
  1107.   if AlphaScore = 10 then UpdateCharVars();
  1108.   if BravoScore = 10 then UpdateCharVars();
  1109. end;
  1110.  
  1111. function OnCommand(ID: Byte; Text: string): boolean;
  1112. begin
  1113.   if GetPiece(text,' ',0) = '/raisecash' then begin
  1114.     Cash := Cash + Strtoint(GetPiece(Text,' ',1));
  1115.     WriteConsole(0,'Admin has just deposited '+Getpiece(Text,' ',1)+' Global Player Cash!',$EE81FAA1);
  1116.   end;
  1117.  
  1118.   Case Lowercase(Text) of
  1119.   '/deathexplode' : begin
  1120.     WriteConsole(0,'death explosions enabled', $00EE0000);
  1121.     WriteLn('death explosions have been enabled by ' + IntToStr(ID) + '!');
  1122.     for i := 1 to 32 do deathexp[i] := True;
  1123.     Command('/maxrespawntime 20');
  1124.   end;
  1125.  
  1126.   '/nodeathexp' : begin
  1127.     WriteConsole(0,'death explosions disabled', $00EE0000);
  1128.     WriteLn('death explosions have been disabled by ' + IntToStr(ID) + '!');
  1129.     for i := 1 to 32 do deathexp[i] := False;
  1130.     Command('/maxrespawntime 2');
  1131.   end;
  1132.  
  1133.   '/give apred' : begin
  1134.     for i := 1 to 32 do if GetPlayerStat(i,'Team') = 1 AND GetPlayerStat(i,'Alive') = true then begin
  1135.       GiveBonus(i, 1);
  1136.       SpawnObject(GetPlayerStat(i,'x'),GetPlayerStat(i,'y'),20);
  1137.     end;
  1138.     WriteConsole(0,'Admin has just given Alpha Team predator',$EE81FAA1);
  1139.   end;
  1140.  
  1141.   '/give bpred' : begin
  1142.     for i := 1 to 32 do if GetPlayerStat(i,'Team') = 2 then if GetPlayerStat(i,'Alive') = true then begin
  1143.       GiveBonus(i, 1);
  1144.       SpawnObject(GetPlayerStat(i,'x'),GetPlayerStat(i,'y'),20);
  1145.     end;
  1146.   WriteConsole(0,'Admin has just given the zombies predator, Lookout!!',$EEEE0000);
  1147.   end;
  1148.  
  1149.   '/give aspeed' : begin
  1150.     for i := 1 to 32 do if GetPlayerStat(i,'Team') = 1 AND GetPlayerStat(i,'Alive') then SpawnObject(GetPlayerStat(i,'x'),GetPlayerStat(i,'y'),18);
  1151.     WriteConsole(0,'Admin has just given Alpha team the speed gun!',$EE81FAA1);
  1152.   end;
  1153.  
  1154.   '/give bspeed' : begin
  1155.     for i := 1 to 32 do if GetPlayerStat(i,'Team') = 2 AND GetPlayerStat(i,'Alive') then SpawnObject(GetPlayerStat(i,'x'),GetPlayerStat(i,'y'),18);
  1156.     WriteConsole(0,'Admin has just given the zombies the speed gun, Lookout!!',$EEEE0000);
  1157.   end;
  1158.  
  1159.   '/nextmap' : UpdateCharVars();
  1160.  
  1161.   '/shopoff' : begin
  1162.     iniWrite('scripts/Shop/profit.ini','script','shop','0');
  1163.     shop := False;
  1164.     Writeconsole(0,'Items have just been disabled',ClBad);
  1165.   end;
  1166.  
  1167.   '/shopon' : begin
  1168.     iniWrite('scripts/Shop/profit.ini','script','shop','1');
  1169.     shop := True;
  1170.     WriteConsole(0,'Items have just been enabled, have fun',ClBad);
  1171.   end;
  1172.  
  1173.   '/bossbot' : begin;
  1174.     for i := 1 to 32 do if IDToName(i) = 'Mr.Zombie' then begin
  1175.       Command('/kick '+inttostr(i)+'');
  1176.       Command('/addbot2 MRZOMBIEW');
  1177.       WriteConsole(0,'You Hear the distant roar of a warlord zombie, that cant be good...', $00FFEE22);
  1178.       break;
  1179.     end;
  1180.   end;
  1181.  end;
  1182. end;
  1183.  
  1184. procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);
  1185. Var I: Integer;
  1186. var Grencount:Array of Integer;
  1187. begin
  1188. PlayerInfo[Killer].Killstreak:=PlayerInfo[Killer].Killstreak + 1;
  1189. if Playerinfo[Victim].Killstreak > 0 then PlayerInfo[Victim].Killstreak:=0;
  1190.   Case idtoname(Victim) of
  1191.   '[Assassin]Mr.Zombie' : if (Owner[Killer].Name <> '') then PlayerInfo[Owner[Killer].PlayerID].Kills:=Playerinfo[Owner[Killer].PlayerID].Kills+1;
  1192.   'Mr.Zombie' : if (Owner[Killer].Name <> '') then PlayerInfo[Owner[Killer].PlayerID].Kills:=Playerinfo[Owner[Killer].PlayerID].kills+1;
  1193.   '[Warlord]Mr.Zombie' : begin
  1194.     Cash:=Cash+5000;
  1195.     BotChat(Victim,'ARgh! you are a better fighter than me '+idtoname(Killer)+'!');
  1196.     Command('/kick '+inttostr(Victim));
  1197.     Writeconsole(0,idtoname(killer)+' has earnt Alpha team 5,000 Cash for a warlord kill',ClGood);
  1198.   end;
  1199.  end;
  1200.   //Shoot(GetPlayerStat(Killer, 'x') - 10,Getplayerstat(Killer,'y') - 10, Getplayerstat(Victim,'x'), getplayerstat(Victim,'y'), 500, 1000, 4, Killer);
  1201.   Playerinfo[Killer].kills:=playerinfo[Killer].Kills+1;
  1202.   if Weapon = 'Barrett M82A1' then begin
  1203.     barKills[Killer]:=barKills[Killer]+1;
  1204.     if (Distance(GetPlayerStat(Killer,'x'),GetPlayerStat(Killer,'y'),GetPlayerStat(Victim,'x'),GetPlayerStat(Victim,'y')) >= 200) AND (greatgahooka[Killer] = False) then begin
  1205.       greatgahooka[Killer]:=True;
  1206.       Achievement(Killer, 'Ya Great Gahooka', 'greatgahooka');
  1207.     end;
  1208.    
  1209.     if (Distance(GetPlayerStat(Killer,'x'),GetPlayerStat(Killer,'y'),GetPlayerStat(Victim,'x'),GetPlayerStat(Victim,'y')) >= 50) AND (yeahyeah[Killer] = False) then begin
  1210.       yeahyeah[Killer]:=True;
  1211.       Achievement(Killer, 'Yeah Yeah we get it', 'yeahyeah');
  1212.     end;
  1213.    
  1214.   end;
  1215.  
  1216.   Case Playerinfo[Killer].kills of
  1217.   {50 : begin
  1218.     SetRank(Killer, 'Private', 'Player', 1);
  1219.     WriteConsole(0,'Looks like this one might stay',$EE81FAA1);
  1220.     WriteConsole(0,'Please make our newest Player feel welcome',$EE81FAA1);
  1221.   end;
  1222.  
  1223.   if (PlayerInfo[Killer].lvl1learned = False) AND (PlayerInfo[Killer].Kills >= 50) AND (playerinfo[Killer].defskill = '') then begin
  1224.     Writeconsole(KIller,'congrats on your level',ClGood);
  1225.     WriteConsole(KIller,'you can now learn one of the following Defense skills/Perks:',ClGood);
  1226.     //Writeconsole(Killer,'/learn martyrdom - drops all of your remaining grenades live on death (perk)',ClGood);
  1227.     WriteConsole(Killer,'/learn kerbam - 10 percent chance of a tactic nuke on death (perk)',ClGood);
  1228.     //WriteConsole(Killer,'/learn shield - become invincable for 10 seconds (skill)',ClGood);
  1229.     //WriteConsole(KIller,'100 kills for every 1 charge of the shield, "/use shield" to use 1 charge',ClGood);
  1230.     Writeconsole(Killer,'these messages will appear each kill until you select a skill/perk',ClBad);
  1231.   end;
  1232.  
  1233.   200 : SetRank(Killer, 'Corporal', 'Player', 2);
  1234.  
  1235.   500 : SetRank(Killer, 'Sergeant', 'Player', 3);
  1236.  
  1237.   1000 : begin
  1238.     SetRank(Killer, 'Captain', 'Officer', 4);
  1239.     WriteConsole(Killer,'Welcome to the ranks Rookie, great to have you with us',$EE81FAA1);
  1240.     WriteConsole(0,'Please welcome our newest Officer',$EE81FAA1);
  1241.   end;
  1242.  
  1243.   3000 : SetRank(Killer, 'Major', 'Officer', 5);
  1244.  
  1245.   4500 : SetRank(Killer, 'Colonel', 'Officer', 6);
  1246.  
  1247.   6000 : SetRank(Killer, 'General', 'Officer', 7);
  1248.  
  1249.   10000 : begin
  1250.     SetRank(Killer, 'Knight', 'Noble', 8);
  1251.     WriteConsole(0,'Please welcome our newest Noble',$EE81FAA1);
  1252.   end;
  1253.  
  1254.   20000 : begin
  1255.     SetRank(Killer, 'Baron', 'Elite', 9);
  1256.     WriteConsole(0,'We have an Elite on the field, welcome to the Vet Ranks '+idtoname(Killer)+'!',$EE81FAA1);
  1257.   end;
  1258.  
  1259.   50000 : SetRank(Killer, 'Earl', 'Elite', 10);
  1260.  
  1261.   75000 : SetRank(Killer, 'Duke', 'Dealer of Zombie Death', 11);
  1262.  
  1263.   100000 : begin
  1264.     SetRank(Killer, 'Warlord', 'FSG Veteran', 12);
  1265.     WriteConsole(0,GetPlayerStat(Killer, 'Name')+' Truly is an FSG Veteran',$EE81FAA1);
  1266.   end;}
  1267.   end;
  1268.  
  1269.   if PlayerInfo[Victim].lvl1Learned = T then begin
  1270.     Case Playerinfo[Victim].DefSkill of
  1271.       'kerbam': begin
  1272.         Playerinfo[Victim].randnum := Random(1,100);
  1273.         if Playerinfo[Victim].randnum <= Playerinfo[Victim].lvl1percentage then begin
  1274.           BigBangDeath(Victim,Victim,M79,5);
  1275.           Writeconsole(Victim,'KERBAM!!!',ClBad);
  1276.           writeconsole(0,idtoname(victim)+' just went Kerbam!',ClBad);
  1277.         end;
  1278.       end;
  1279.      
  1280.       'martyrdom': begin
  1281.         Grencount[Victim]:= GetPlayerStat(Victim,'Grenades');
  1282.         Nova(GetPlayerstat(Victim,'x'),GetPlayerstat(Victim,'Y'),20,20,100, Victim,Grenade, Grencount[Victim]);
  1283.       end;
  1284.     end;
  1285.   end;
  1286.  
  1287.   NKS[Killer]:=NKS[Killer]+1;
  1288.   if (NKS[Killer]=NKS[Victim]) and (NKS[Victim]>BKS[Victim]) then BKS[Victim]:=NKS[Victim];
  1289.   NKS[Victim]:=0;
  1290.   Killnum[Killer]:=Killnum[Killer]+1;
  1291.   if shop = true then begin
  1292.     GiveBonus(Killer,BonusID);
  1293.     Cash :=Cash+PlayerInfo[Killer].Killstreak;
  1294.     Playerinfo[Killer].CashEarnt:=PlayerInfo[Killer].killstreak+Playerinfo[Killer].Killstreak;
  1295.     Writeconsole(Victim,'Cash Earnt this streak: +'+inttostr(Playerinfo[Victim].CashEarnt)+' Cash',$00EEFF00);
  1296. If Playerinfo[Victim].CashEarnt <> 0 then Playerinfo[Victim].CashEarnt := 0;
  1297.   end;
  1298.  
  1299.   if deathexp[Killer] = true then begin
  1300.  
  1301.     CreateBullet(GetPlayerStat(i,'x'), GetPlayerStat(i,'y') - 0, 0,-200,100, 10, Killer);
  1302.     Nova(GetPlayerstat(Victim,'X'),Getplayerstat(Victim,'Y'),0,DED*EDM,25, Killer,10,EBN*2);
  1303.     Sleep(1);
  1304.     //WriteLn('Cash Updated');
  1305.     //WriteConsole(0,'Global Player Cash: '+inttostr(Cash),$EE81FAA1);
  1306.     //WriteLn('Cash Displayed');
  1307.   end;
  1308.  
  1309.   if Getplayerstat(Killer,'Name') = 'Mr.Zombie' then for I := 1 to DEXN do begin
  1310.     Nova(GetPlayerstat(Victim,'X'),Getplayerstat(Victim,'Y'),0,DED*I,25, Victim,10,EBNNTT*I);
  1311.     Sleep(1);
  1312.   end;
  1313.  
  1314.   if idtoname(Killer) = 'Mr.Zombie' then begin
  1315.     if Owner[Killer].Name <> '' then Writeconsole(Owner[Killer].PlayerID,'your ally just made a kill',$00EEFF00);
  1316.     KBZombie[Victim] := KBZombie[Victim]+1;
  1317.     if KBZombie[Victim] = 50 then WriteConsole(0,''+idtoname(Victim)+' is getting owned, dats gotta hurt!',$00EEEE00);
  1318.     if (KBZombie[Victim] = 100) AND (holyshit[Victim] = False) then begin
  1319.       holyshit[Victim] := True;
  1320.       Achievement(Victim, 'HOLY SHIT! Hes Still going!', 'holyshit');
  1321.       Writeconsole(0, 'holy shit, '+idtoname(Victim)+' is getting totally owned and is still going! o.0', $00EEEE00);
  1322.     end;
  1323.   end;
  1324.  
  1325.   if FlagCaptured[Victim] = True then FlagCaptured[Victim] := False;
  1326.   if Flaghold[Victim] > 0 then Flaghold[Victim] := 0;
  1327.  
  1328.     PlayerInfo[Killer].Rankdamagemultiplier:=PlayerInfo[Killer].Rankdamagemultiplier+1;
  1329.   if PlayerInfo[Victim].Rankdamagemultiplier > 1 then PlayerInfo[Victim].Rankdamagemultiplier:=1
  1330. end;
  1331.  
  1332. procedure AppOnIdle(Ticks: integer);
  1333. begin
  1334.   Timer:=Timer - 1;
  1335.   if Timer = 0 then begin
  1336.     Writeconsole(0,'Saving all accounts...',$0000FFFF);
  1337.     //Command('/save');
  1338.     for i:= 1 to 32 do if Getplayerstat(i,'Ping') > 0 then begin
  1339.       if SpeedTimer[i] > 0 then Speedtimer[i] := SpeedTimer[i] - 1;
  1340.       iniWrite('Players/'+Accname[i]+'.ini','stats','kills',inttostr(playerinfo[i].kills));
  1341.       iniWrite('Players/'+Accname[i]+'.ini','stats','tupred',inttostr(TUPred[i]));
  1342.       iniWrite('Players/'+Accname[i]+'.ini','stats','barkills',inttostr(barKills[i]));
  1343.       iniWrite('Players/'+Accname[i]+'.ini','stats','ranknum',inttostr(RankNum[i]));
  1344.     end;
  1345.     iniWrite('scripts/Shop/profit.ini','profit','cash',inttostr(Cash));
  1346.     Timer:=300;
  1347.     Writeconsole(0,'Done!',$0000FFFF);
  1348.   end;
  1349.  
  1350.   for i:= 1 to 32 do if (GetPlayerStat(i,'Active') = true) AND (GetPlayerStat(i,'Alive') = true) then begin
  1351.     if GetPlayerStat(i,'Human') = true then begin
  1352.       if GetPlayerStat(i, 'Flagger') = False then FlagCaptured[i]:= False;
  1353.       if FlagCaptured[i] = true then Flaghold[i]:=Flaghold[i]+1;
  1354.       if (Flaghold[i] = 30) AND (catchme[i] = False) then begin
  1355.         catchme[i] := True;
  1356.         Achievement(i,'Catch Me if you can! :-)', 'catchme');
  1357.       end;
  1358.      
  1359.       if (Flaghold[i] = 60) AND (SoloChaser[i] = False) then begin
  1360.         SoloChaser[i]:=True;
  1361.         Achievement(i,'Solo Zombie Flagger Chaser','solochaser');
  1362.       end;
  1363.      
  1364.       if (Flaghold[i] = 120) AND (QuitTeasin[i] = False) then begin
  1365.         QuitTeasin[i]:=True;
  1366.         Achievement(i,'Hey! Quit Teasin!','quitteasin');
  1367.       end;
  1368.      
  1369.       TSec[i]:= TSec[i] + 1;
  1370.       if TSec[i] = 60 then begin
  1371.         TMin[i]:= TMin[i] + 1;
  1372.         TSec[i]:= 0;
  1373.       end;
  1374.      
  1375.       if GetPlayerStat(i,'Flagger') = False then begin
  1376.         Flaghold[i]:=0;
  1377.         FlagCaptured[i]:=F;
  1378.       end;
  1379.      
  1380.     end else begin
  1381.       if TSec[i] > 0 then BTSec[i] := TSec[i];
  1382.       TSec[i] := 0;
  1383.       if TMin[i] > 0 then BTMin[i]:= TMin[i];
  1384.       TMin[i] := 0;
  1385.       CheckTime(i);
  1386.     end;
  1387.   end;
  1388.  
  1389.   if (GetPlayerStat(ID,'human') = true) AND (GetPlayerStat(ID,'Flagger') = true) AND (shop = True) then Cash:=Cash+2;
  1390.   if Timeleft = 1 then begin
  1391.     for i := 1 to 32 do begin
  1392.       if GetPlayerStat(i,'Human') = true then begin
  1393.         Cash:=Cash+Killnum[i];
  1394.         WriteConsole(i,'Match Bonus!',$EE81FAA1);
  1395.         WriteConsole(i,'Congrats, you have earned your team: '+inttostr(Killnum[i])+' bonus cash for kills this match',$EE81FAA1);
  1396.         Tcash:=Tcash+Killnum[i];
  1397.       end;
  1398.     end;
  1399.     WriteConsole(0,'Alpha Team Match Bonus: '+inttostr(Tcash)+' (+'+inttostr(Tcash)+' Cash)!',$EE00FFFF);
  1400.     Tcash:=0;
  1401.   end;
  1402.  
  1403.   For z := 1 To ItemID Do begin
  1404.     if ItemInfo[z].Name = 'Nuke Turret' then begin
  1405.       if (ItemInfo[z].TrigTimer > 0) AND (CheckPlayerDist(ItemOwner[z].PlayerID,ItemInfo[z].x,ItemInfo[z].y,200)) then ItemInfo[z].Trigtimer:=ItemInfo[z].TrigTimer-1;
  1406.       if (ItemInfo[z].TrigTimer > 0) AND (ItemInfo[z].Armed = False) AND (CheckPlayerDist(ItemOwner[z].PlayerID,ItemInfo[z].x,ItemInfo[z].y,200)) then WriteConsole(ItemOwner[z].PlayerID,''+inttostr(ItemInfo[z].TrigTimer)+'...',$EE00FFFF);
  1407.       if (ItemInfo[z].TrigTimer = 0) AND (ItemInfo[z].Armed = False) then begin
  1408.         WriteConsole(ItemOwner[z].PlayerID,'Armed! keep your distance',$EE00FFFF);
  1409.         ItemInfo[z].Armed:=T;
  1410.       end;
  1411.       if ItemInfo[z].TrigTimer > 0 then ItemInfo[z].Trigtimer:=ItemInfo[z].TrigTimer-1;
  1412.       if (ItemInfo[z].Trigtimer = 0) AND (ItemInfo[z].Armed) then for i := 1 to 32 do if (CheckPlayerDist(i,ItemInfo[z].x,Iteminfo[z].y,50)) AND (idtoname(i) = 'Mr.Zombie') then begin
  1413.         WriteLn('Novas should be triggering now');
  1414.         Nova(ItemInfo[z].x,ItemInfo[z].y,0,35,0, ItemOwner[z].PlayerID,10,5);
  1415.         Nova(ItemInfo[z].x,ItemInfo[z].y,0,70,0, ItemOwner[z].PlayerID,10,25);
  1416.         Nova(ItemInfo[z].x,ItemInfo[z].y,0,105,0, ItemOwner[z].PlayerID,10,25);
  1417.         Nova(ItemInfo[z].x,ItemInfo[z].y,0,140,0, ItemOwner[z].PlayerID,10,25);
  1418.         Nova(ItemInfo[z].x,ItemInfo[z].y,0,175,0, ItemOwner[z].PlayerID,10,25);
  1419.         Nova(ItemInfo[z].x,ItemInfo[z].y,0,210,0, ItemOwner[z].PlayerID,10,25);
  1420.         Nova(ItemInfo[z].x,ItemInfo[z].y,0,245,0, ItemOwner[z].PlayerID,10,25);
  1421.         Nova(ItemInfo[z].x,ItemInfo[z].y,0,270,0, ItemOwner[z].PlayerID,10,25);
  1422.         Nova(ItemInfo[z].x,ItemInfo[z].y,0,305,0, ItemOwner[z].PlayerID,10,25);
  1423.         Nova(ItemInfo[z].x,ItemInfo[z].y,0,340,0, ItemOwner[z].PlayerID,10,25);
  1424.         Nova(ItemInfo[z].x,ItemInfo[z].y,0,375,0, ItemOwner[z].PlayerID,10,75);
  1425.         Nova(ItemInfo[z].x,ItemInfo[z].y,0,410,0, ItemOwner[z].PlayerID,10,150);
  1426.         ItemInfo[z].Armed := F;
  1427.         ItemInfo[z].TrigTimer:=30;
  1428.         WriteConsole(ItemOwner[z].PlayerID,'one of your nuke turrets just got triggered', $00EEFF00);
  1429.         WriteConsole(0,'one of '+idtoname(ItemOwner[z].PlayerID)+'s nukes turrets just got triggered', $00EEFF00);
  1430.       end;
  1431.     end;
  1432.     if ItemInfo[z].Name='Massive Flak Gun' then for i := 1 to 32 do if (CheckPlayerDist(i,ItemInfo[z].x,Iteminfo[z].y,600)) AND (GetPlayerStat(i,'Team')<>ItemOwner[z].Team) then Shoot(ItemInfo[z].x,Iteminfo[z].y,GetPlayerStat(i,'x'),GetPlayerstat(i,'y'),500,1000,4,ItemOwner[z].PlayerID);
  1433.     if ItemInfo[z].Name='Auto Turret' then for i := 1 to 32 do if (CheckPlayerDist(i,ItemInfo[z].x,Iteminfo[z].y,600)) AND (GetPlayerStat(i,'Team')<>ItemOwner[z].Team) then Shoot(ItemInfo[z].x,Iteminfo[z].y,GetPlayerStat(i,'x'),GetPlayerstat(i,'y'),5000,1000,1,ItemOwner[z].PlayerID);
  1434.   end;
  1435. end;
  1436.  
  1437.  
  1438. procedure OnFlagGrab(ID, TeamFlag: byte; GrabbedInBase: boolean);
  1439. begin
  1440.   if speedster[ID] = false then SpeedTimer[ID] := 5;
  1441.   Cash:=Cash+5;
  1442.   if NFT[ID] > 0 then begin
  1443.     MovePlayer(ID,GetObjectStat(1,'X'), GetObjectStat(1, 'Y'));
  1444.     WriteConsole(0,'Grab detected, I see you have a flag teleporter!',$EE81FAA1);
  1445.     WriteConsole(0,'Teleporting you now '+IDtoName(ID)+'!',$EE81FAA1);
  1446.     NFT[ID]:=NFT[ID]-1;
  1447.     WriteConsole(ID,'You now have '+inttostr(NFT[ID])+' teleports remaining!',$EE81FAA1);
  1448.   end;
  1449.   if GetPlayerStat(ID, 'human') = true then FlagCaptured[ID] := True;
  1450. end;
  1451.  
  1452. function OnPlayerDamage(Victim, Shooter: byte; Damage: integer): integer;
  1453. begin
  1454.   Playerinfo[Shooter].achievements:=strtoint(ReadINI('Players/'+IDtoname(Shooter)+'.ini','stats','tna','0'));
  1455.   DamagePerc[Shooter]:=(RankNum[Shooter]*RankDamageMult)+Playerinfo[Shooter].achievements;
  1456.  { if (Playerinfo[shooter].Admin=True) and (Getplayerstat(Victim,'alive')=True) then CreateBullet(GetPlayerStat(Victim,'x'), GetPlayerStat(Victim,'y') - 0, 0,0,1, 10, Shooter);}
  1457.   RankDam[Shooter]:=Damage+(Damage*(DamagePerc[Shooter]/100));
  1458.   result:=Damage + (Rankdam[Shooter]*Playerinfo[Shooter].Rankdamagemultiplier);
  1459.   if IDtoname(Shooter) = '[Warlord]Mr.Zombie' then begin
  1460.     DamCalc[Shooter]:=Damage+RankDam[Shooter];
  1461.     //Result:=DamCalc[Shooter]*(1/100);
  1462.   end;
  1463. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement