Official Soldat Forums

Server Talk => Scripting Discussions and Help => Topic started by: mich1103 on April 12, 2010, 06:22:41 pm

Title: Can i put that these two script make one ?
Post by: mich1103 on April 12, 2010, 06:22:41 pm
http://forums.soldat.pl/index.php?topic=37209.0 (this is a topic about a save/load money system)
This is the script that i want to include with the other
Code: [Select]
const
Color = $0099CC; //Color to be used.
psgpowa = 1;
psgtype = 14;
psgrang = 666;
psgspee = 65;
maxpsg = 5;
psgammo = 50; //took the liberty to invent it, since it was missing.

var
  pname: string;
  money: array[1..32] of integer;
  statcost:integer;
  giveid:integer;
  psgcost:integer;
  merccost:integer;
  give,ammount,player:string;
  sgx,sgy:array[1..maxpsg] of single;
  sga,sgo,sgt:array[1..maxpsg] of byte;
  sgd:array[1..maxpsg] of boolean;
  invcost,medcost,nadecost,flamecost,vestcost,serkcost,clustcost,powercost,eaglecost: integer;
  mp5cost,ak47cost,augcost,spascost,rugecost,m79cost,barrcost,minimcost,minigcost, allcost: integer;
 

procedure placesentry(x,y:single;ID,team:byte);
var n,f:byte;
begin
if getplayerstat(ID,'Ground')=true then begin
f:=maxpsg;
for n:=1 to maxpsg do begin
if sgd[n]=true then f:=f-1;
end;
if f=0 then DrawText(ID,'Maximum of '+inttostr(maxpsg)+' sentry guns on map reached.',250,RGB(0,255,0),0.10,150,400) else begin
for n:=1 to maxpsg do begin
if sgd[n]=false then break;
end;
sgx[n]:=x; sgy[n]:=y; sgo[n]:=ID; sgt[n]:=team; sga[n]:=psgammo; sgd[n]:=true;
DrawText(ID,'Sentry gun placed!',250,RGB(0,255,0),0.1,75,350);
end;
end else DrawText(ID,'You are in mid-air!',250,RGB(0,255,0),0.10,220,400);
end;
 
 
 
procedure ActivateServer();
  begin
    statcost        := 15;
    psgcost         := 20;
    merccost        := 10;
    invcost         := 4;
    medcost         := 3;
    nadecost        := 3;
    flamecost       := 7;
    vestcost        := 4;
    serkcost        := 4;
    clustcost       := 4;
    powercost       := 10;
    eaglecost       := 5;
    mp5cost         := 5;
    ak47cost        := 5;
    augcost         := 5;
    spascost        := 6;
    rugecost        := 4;
    m79cost         := 6;
    barrcost        := 6;
    minimcost       := 6;
    minigcost       := 5;
    allcost         := 12;
  end;


procedure OnJoinGame(ID, Team: byte);
  begin
    money[ID] := 1;
    writeConsole(ID, 'Your Money is: $' + inttostr(money[ID]),Color);
    writeConsole(ID, 'Do /shop to see the shop, do /money to see your money !' + inttostr(money[ID]), Color);
  end;

procedure OnPlayerKill(Killer, Victim: byte;Weapon: string);
  begin
    if Killer = Victim then
      begin
         writeConsole(Killer, 'you cant kill yourself for money !', Color);
      end else
      begin
        money[Killer] := money[Killer]+1;
        writeConsole(Killer, 'You just got $1 your money is now: $' + inttostr(money[Killer]), Color);
      end;
  end;




function OnPlayerCommand(ID: Byte; Text: string): boolean;
  begin



  give := GetPiece(LowerCase(Text), ' ', 0);
  ammount := GetPiece(LowerCase(Text), ' ', 1);
  player := GetPiece(Text, ' ', 2);
  if give = '/give' then
    begin
      if money[ID] > strtoint(ammount) then
        begin
          giveid := NameToID(player);

          if giveid > 0 then
            begin
              money[ID] := money[ID] - strtoint(ammount);
              money[giveid] := money[giveid] + strtoint(ammount);
              writeconsole(ID, 'You gave $' + ammount + ' to: ' + IDToName(giveid) + ', Your money is now: $' + inttostr(money[ID]) , Color);
              writeconsole(giveid, 'You recived $' + ammount + ' from: ' + IDToName(ID) + ', Your money is now: $' + inttostr(money[giveid]), Color);
            end else
              begin
                writeconsole(ID, 'That person does not exist.', Color);
              end;

        end else
        begin
          writeconsole(ID, 'You don''t have enough money', Color);
        end;

    end;







    if regExpMatch('^/(money|moneys)$', Text) then
      begin
        writeConsole(ID, 'Your money is: $' + inttostr(money[ID]), Color);
     end;



    if regExpMatch('^/(commands|shop|spawn|help)$', Text) then
      begin
        writeConsole(ID, '#############SHOP#########################', Color);
        writeConsole(ID, '#commands:                               #', Color);
        writeConsole(ID, '#/stat $15 (spawn a turret)              #', Color);
        writeConsole(ID, '#/psg $20 (Spawn a sentry gun)           #', Color);
        writeConsole(ID, '#/merc $10 (Spawn a mercenary)           #', Color);
        writeConsole(ID, '#/inv  $4 (Give you the invisibility)    #', Color);
        writeConsole(ID, '#/med $3 (Give you a medic kit)          #', Color);
        writeConsole(ID, '#/nade $3 (Give to you some nade)        #', Color);
        writeConsole(ID, '#/flame $7 (Give you a flamer)           #', Color);
        writeConsole(ID, '#/vest $4 (Give you a Bullet proof)      #', Color);
        writeConsole(ID, '#/serk $5 (Give you the RAGE !!!)        #', Color);
        writeConsole(ID, '#/clust $4 (Give you some cluster)       #', Color);
        writeConsole(ID, '#/power $10 (Spawn all bonus above you)  #', Color);
        writeConsole(ID, '#/eagle $5 (Give you a Desert Eagle)     #', Color);
        writeConsole(ID, '#/mp5 $5 (Give you a Hk mp5)             #', Color);
        writeConsole(ID, '#/ak47 $5 (Give you a Ak 47)             #', Color);
        writeConsole(ID, '#/aug $5 (Give you a Steyr AUG)          #', Color);
        writeConsole(ID, '#/spas $6 (Give you a spas 12)           #', Color);
        writeConsole(ID, '#/ruge $4 (Give you a Ruger)             #', Color);
        writeConsole(ID, '#/m79 $6 (Give you a m79)                #', Color);
        writeConsole(ID, '#/barr $6 (Give you a Barret)            #', Color);
        writeConsole(ID, '#/minim $6 (Give you a FN minimi)        #', Color);
        writeConsole(ID, '#/minig $5 (Give you a Minigun)          #', Color);
        writeConsole(ID, '#/guns (Spawn all gun above you)         #', Color);
        writeConsole(ID, '#############END##########################', Color);
      end;





if regExpMatch('^/(stationary|stat|turrent)$', Text) then
  begin
      if money[ID] >= statcost then
        begin
          money[ID] := money[ID] - statcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,15);
          writeconsole(ID, 'You bought a Stat Gun for $15, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color);
end;
  end;
  result := false;






if regExpMatch('^/(psg)$', Text) then begin
      if money[ID] >= psgcost then begin
          money[ID] := money[ID] - psgcost;
   placesentry(getplayerstat(ID,'x'),getplayerstat(ID,'y'),ID,getplayerstat(ID,'team'));
          writeconsole(ID, 'You bought a Sentry Gun for $20, you have $' + inttostr(money[ID]), Color);
        end else begin writeconsole(ID, 'You do not have enough money', Color);
    end;
end;




if regExpMatch('^/(merc)$', Text) then
  begin
      if money[ID] >= merccost then
        begin
          money[ID] := money[ID] - merccost;
          Command('/addbot1 mercenary');
          writeconsole(ID, 'Youve engage a mercenary for $10, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color);
end;
  end;

  if regExpMatch('^/(desert eagles|eagle|deagles|deserteagles)$', Text) then
    begin
      if money[ID] >= eaglecost then
        begin
          money[ID] := money[ID] - eaglecost;
          forceWeapon(ID,1,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought deagles for $5, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(hkmp5|mp5|hk)$', Text) then
    begin
      if money[ID] >= mp5cost then
        begin
          money[ID] := money[ID] - mp5cost;
          forceWeapon(ID,2,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a HK MP5 for $5, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(ak47)$', Text) then
    begin
      if money[ID] >= ak47cost then
        begin
          money[ID] := money[ID] - ak47cost;
          forceWeapon(ID,3,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a AK47 for $5, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(steyr|aug)$', Text) then
    begin
      if money[ID] >= augcost then
        begin
          money[ID] := money[ID] - augcost;
          forceWeapon(ID,4,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a Steyr Aug for $5, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(spas 12|spas|spas12)$', Text) then
    begin
      if money[ID] >= spascost then
        begin
          money[ID] := money[ID] - spascost;
          forceWeapon(ID,5,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a SPAS12 for $6, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(ruger|ruge|ruger77)$', Text) then
    begin
      if money[ID] >= rugecost then
        begin
          money[ID] := money[ID] - rugecost;
          forceWeapon(ID,6,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a Ruger for $4, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(m79)$', Text) then
    begin
      if money[ID] >= m79cost then
        begin
          money[ID] := money[ID] - m79cost;
          forceWeapon(ID,7,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a M79 for $6, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(barreta|barr|barrett m82a1|barret|barret m)$', Text) then
    begin
      if money[ID] >= barrcost then
        begin
          money[ID] := money[ID] - barrcost;
          forceWeapon(ID,8,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a Barreta for $6, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(fn minimi|minim|fn)$', Text) then
    begin
      if money[ID] >= minimcost then
        begin
          money[ID] := money[ID] - minimcost;
          forceWeapon(ID,9,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a FN Minimi for $6, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(minigun|minig)$', Text) then
    begin
      if money[ID] >= minigcost then
        begin
          money[ID] := money[ID] - minigcost;
          forceWeapon(ID,10,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a Minigun for $5, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;


  if regExpMatch('^/(medic|med|health|med pack)$', Text) then
    begin
      if money[ID] >= medcost then
        begin
          money[ID] := money[ID] - medcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,16);
          writeconsole(ID, 'You bought a Medkit for $3, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(grenade|nade)$', Text) then
    begin
      if money[ID] >= nadecost then
        begin
          money[ID] := money[ID] - nadecost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,17);
          writeconsole(ID, 'You bought some Greanades for $3, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(cluster|clust|clustergrandes|clusternades|clustnades)$', Text) then
    begin
      if money[ID] >= clustcost then
        begin
          money[ID] := money[ID] - clustcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,22);
          writeconsole(ID, 'You bought some Cluster Greanades for $4, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(armor|vest|bulletproofvest)$', Text) then
    begin
      if money[ID] >= vestcost then
        begin
          money[ID] := money[ID] - vestcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,19);
          writeconsole(ID, 'You bought a Bullet Proof Vest for $4, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;


  if regExpMatch('^/(boxes|power|box)$', Text) then
    begin
      if money[ID] >= powercost then
        begin
          money[ID] := money[ID] - powercost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,16);
          SpawnObject(GetPlayerStat(ID,'x')+30,GetPlayerStat(ID,'y')-20,17);
          SpawnObject(GetPlayerStat(ID,'x')+40,GetPlayerStat(ID,'y')-20,18);
          SpawnObject(GetPlayerStat(ID,'x')+50,GetPlayerStat(ID,'y')-20,19);
          SpawnObject(GetPlayerStat(ID,'x')+60,GetPlayerStat(ID,'y')-20,20);
          SpawnObject(GetPlayerStat(ID,'x')+70,GetPlayerStat(ID,'y')-20,21);
          SpawnObject(GetPlayerStat(ID,'x')+80,GetPlayerStat(ID,'y')-20,22);
          writeconsole(ID, 'You bought all Powerups for $10, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(preditor|inv|invisible)$', Text) then
    begin
      if money[ID] >= invcost then
        begin
          money[ID] := money[ID] - invcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,20);
          writeconsole(ID, 'You bought a Preditor Box for $4, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(flame god|flame|flamegodmode|flame god mode)$', Text) then
    begin
      if money[ID] >= flamecost then
        begin
          money[ID] := money[ID] - flamecost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,18);
          writeconsole(ID, 'You bought a Flame God Box for $7, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(berseker|serk)$', Text) then
    begin
      if money[ID] >= serkcost then
        begin
          money[ID] := money[ID] - serkcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,21);
          writeconsole(ID, 'You bought a Berseker Box for $5, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;



if regExpMatch('^/(gunz|guns|weapons|weaps|weps)$', Text) then
    begin
      if money[ID] >= allcost then
        begin
          money[ID] := money[ID] - allcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,1);
          SpawnObject(GetPlayerStat(ID,'x')+30,GetPlayerStat(ID,'y')-20,2);
          SpawnObject(GetPlayerStat(ID,'x')+40,GetPlayerStat(ID,'y')-20,3);
          SpawnObject(GetPlayerStat(ID,'x')+50,GetPlayerStat(ID,'y')-20,4);
          SpawnObject(GetPlayerStat(ID,'x')+60,GetPlayerStat(ID,'y')-20,5);
          SpawnObject(GetPlayerStat(ID,'x')+70,GetPlayerStat(ID,'y')-20,6);
          SpawnObject(GetPlayerStat(ID,'x')+80,GetPlayerStat(ID,'y')-20,7);
          SpawnObject(GetPlayerStat(ID,'x')-20,GetPlayerStat(ID,'y')-20,8);
          SpawnObject(GetPlayerStat(ID,'x')-30,GetPlayerStat(ID,'y')-20,9);
          SpawnObject(GetPlayerStat(ID,'x')-40,GetPlayerStat(ID,'y')-20,10);
          SpawnObject(GetPlayerStat(ID,'x')-50,GetPlayerStat(ID,'y')-20,11);
          SpawnObject(GetPlayerStat(ID,'x')-60,GetPlayerStat(ID,'y')-20,12);
          SpawnObject(GetPlayerStat(ID,'x')-70,GetPlayerStat(ID,'y')-20,13);
          SpawnObject(GetPlayerStat(ID,'x')-80,GetPlayerStat(ID,'y')-20,14);
          writeconsole(ID, 'You bought all Weapon for $15, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color);
end;

end;
end;

procedure OnMapChange(newmap:string);
var n:byte;
begin
for n:=1 to maxpsg do begin sgd[n]:=false; end;
end;

procedure OnLeaveGame(ID,team:byte;kicked:boolean);
var n:byte;
begin
for n:=1 to maxpsg do begin if sgo[n]=ID then sgd[n]:=false; end;
end;




Procedure AppOnIdle(Ticks: Integer);
 Var N, K: Byte;
  X, Y, Dista: Single;
   Begin
    For N := 1 To maxpsg Do Begin
     if sgd[n] = True Then Begin
      CreateBullet(sgx[n],sgy[n],0,0,0,5,sgo[n]);
       For K := 1 To 32 Do Begin
        GetPlayerXy(K,X,Y);
         if GetPlayerStat(K,'Team') <> sgt[n] Then if GetPlayerStat(K,'Alive') = True Then if RayCast(sgx[n],sgy[n],x,y,dista,psgrang) = True Then if dista <= psgrang Then Begin
          x := ((x-sgx[n]) / dista)*psgspee;
   y := ((y-sgy[n]) / dista)*psgspee;
          CreateBullet(sgx[n],sgy[n],x,y,psgpowa,psgtype,sgo[n]); sga[n]:=sga[n]-1;
         if sga[n] = 0 Then Begin
sgd[n] := false;
   Writeconsole(sgo[n],'One of your sentry guns ran out of ammo.',$0000FF00);
  end;
     Break;
    end;
   end;
  end;
 end;
end;
I can ???

If you not going to help , just say to me how i will try to make it :P
Title: Re: Can i put that these two script make one ?
Post by: DarkCrusade on April 13, 2010, 12:39:59 am
Instead of asking you could have just tried whether it works or not.
Title: Re: Can i put that these two script make one ?
Post by: mich1103 on April 13, 2010, 05:04:38 am
I cant know if it work because the topic about save/load system is not complete there is only some part of script ...

From: April 13, 2010, 05:11:19 am
so if someone can complete the save/load system i will try to take these two script and make a big one !
Title: Re: Can i put that these two script make one ?
Post by: Swompie on April 13, 2010, 08:57:12 am
How should that save-load system work?
When player joins and he was already there once he gets his money back?
Title: Re: Can i put that these two script make one ?
Post by: mich1103 on April 13, 2010, 05:32:14 pm
A thing like that ?
Code: [Select]
procedure OnJoinTeam(ID, Team: byte);
begin
GetMoney(ID: byte): integer;
end;

function GetMoney(ID: byte): integer;
var  money: string;
begin 
money:= ReadFile('scripts/ws/playermoney/' + getplayerstat(ID,'name') + '.txt');
 
  Result:= StrToInt(Copy(money, 0, length(money) - 2));
  end;
 
 

the save/load system should work like that !
When a player join the server a script create a .txt file like Major.txt
on it it should write is money he have when he leave the server
and when he join the server a script will read the Major.txt and regive to him the money back ! :P
Title: Re: Can i put that these two script make one ?
Post by: Stuffy on April 14, 2010, 05:41:21 am
hmm but what is if another player with the name major joins the server? Maybe its the best if you make it via Ip and not via Name.
Title: Re: Can i put that these two script make one ?
Post by: mich1103 on April 14, 2010, 06:09:38 am
Yea right i should put to IP

From: April 14, 2010, 06:11:23 am
But i really need help for this script because i dont know how to procede to write the player info on the .txt
Title: Re: Can i put that these two script make one ?
Post by: Stuffy on April 14, 2010, 06:26:20 am
Well, this should be enought, of course you have to replace the Money-Var with the var you use in your script.

Code: [Select]
procedure OnLeaveGame(ID, Team: byte;Kicked: boolean);

begin

WriteFile('scripts/yourscriptname/' + IdToIp(ID) + '.txt',IntToStr(Money[ID]));

end;

procedure OnJoinGame(ID, Team: byte);

begin

Money[ID] := StrToInt(ReadFile('scripts/yourscriptname/' + IdToIp(ID) + '.txt'));

end;
Title: Re: Can i put that these two script make one ?
Post by: mich1103 on April 14, 2010, 07:02:11 am
Can you include it to my script ?
Title: Re: Can i put that these two script make one ?
Post by: Stuffy on April 14, 2010, 10:40:59 am
Try this:

Code: [Select]
const
Color = $0099CC; //Color to be used.
psgpowa = 1;
psgtype = 14;
psgrang = 666;
psgspee = 65;
maxpsg = 5;
psgammo = 50; //took the liberty to invent it, since it was missing.

var
  pname: string;
  money: array[1..32] of integer;
  statcost:integer;
  giveid:integer;
  psgcost:integer;
  merccost:integer;
  give,ammount,player:string;
  sgx,sgy:array[1..maxpsg] of single;
  sga,sgo,sgt:array[1..maxpsg] of byte;
  sgd:array[1..maxpsg] of boolean;
  invcost,medcost,nadecost,flamecost,vestcost,serkcost,clustcost,powercost,eaglecost: integer;
  mp5cost,ak47cost,augcost,spascost,rugecost,m79cost,barrcost,minimcost,minigcost, allcost: integer;
 

procedure placesentry(x,y:single;ID,team:byte);
var n,f:byte;
begin
if getplayerstat(ID,'Ground')=true then begin
f:=maxpsg;
for n:=1 to maxpsg do begin
if sgd[n]=true then f:=f-1;
end;
if f=0 then DrawText(ID,'Maximum of '+inttostr(maxpsg)+' sentry guns on map reached.',250,RGB(0,255,0),0.10,150,400) else begin
for n:=1 to maxpsg do begin
if sgd[n]=false then break;
end;
sgx[n]:=x; sgy[n]:=y; sgo[n]:=ID; sgt[n]:=team; sga[n]:=psgammo; sgd[n]:=true;
DrawText(ID,'Sentry gun placed!',250,RGB(0,255,0),0.1,75,350);
end;
end else DrawText(ID,'You are in mid-air!',250,RGB(0,255,0),0.10,220,400);
end;
 
 
 
procedure ActivateServer();
  begin
    statcost        := 15;
    psgcost         := 20;
    merccost        := 10;
    invcost         := 4;
    medcost         := 3;
    nadecost        := 3;
    flamecost       := 7;
    vestcost        := 4;
    serkcost        := 4;
    clustcost       := 4;
    powercost       := 10;
    eaglecost       := 5;
    mp5cost         := 5;
    ak47cost        := 5;
    augcost         := 5;
    spascost        := 6;
    rugecost        := 4;
    m79cost         := 6;
    barrcost        := 6;
    minimcost       := 6;
    minigcost       := 5;
    allcost         := 12;
  end;


procedure OnJoinGame(ID, Team: byte);
  begin
    writeConsole(ID, 'Your Money is: $' + inttostr(money[ID]),Color);
    writeConsole(ID, 'Do /shop to see the shop, do /money to see your money !' + inttostr(money[ID]), Color);
if FileExists('scripts/' + ScriptName + '/' + IdToIp(ID) + '.txt') then begin
Money[ID] := StrToInt(ReadFile('scripts/' + ScriptName + '/' + IdToIp(ID) + '.txt'));
end else Money[ID] := 1;
  end;

procedure OnPlayerKill(Killer, Victim: byte;Weapon: string);
  begin
    if Killer = Victim then
      begin
         writeConsole(Killer, 'you cant kill yourself for money !', Color);
      end else
      begin
        money[Killer] := money[Killer]+1;
        writeConsole(Killer, 'You just got $1 your money is now: $' + inttostr(money[Killer]), Color);
      end;
  end;




function OnPlayerCommand(ID: Byte; Text: string): boolean;
  begin



  give := GetPiece(LowerCase(Text), ' ', 0);
  ammount := GetPiece(LowerCase(Text), ' ', 1);
  player := GetPiece(Text, ' ', 2);
  if give = '/give' then
    begin
      if money[ID] > strtoint(ammount) then
        begin
          giveid := NameToID(player);

          if giveid > 0 then
            begin
              money[ID] := money[ID] - strtoint(ammount);
              money[giveid] := money[giveid] + strtoint(ammount);
              writeconsole(ID, 'You gave $' + ammount + ' to: ' + IDToName(giveid) + ', Your money is now: $' + inttostr(money[ID]) , Color);
              writeconsole(giveid, 'You recived $' + ammount + ' from: ' + IDToName(ID) + ', Your money is now: $' + inttostr(money[giveid]), Color);
            end else
              begin
                writeconsole(ID, 'That person does not exist.', Color);
              end;

        end else
        begin
          writeconsole(ID, 'You don''t have enough money', Color);
        end;

    end;







    if regExpMatch('^/(money|moneys)$', Text) then
      begin
        writeConsole(ID, 'Your money is: $' + inttostr(money[ID]), Color);
     end;



    if regExpMatch('^/(commands|shop|spawn|help)$', Text) then
      begin
        writeConsole(ID, '#############SHOP#########################', Color);
        writeConsole(ID, '#commands:                               #', Color);
        writeConsole(ID, '#/stat $15 (spawn a turret)              #', Color);
        writeConsole(ID, '#/psg $20 (Spawn a sentry gun)           #', Color);
        writeConsole(ID, '#/merc $10 (Spawn a mercenary)           #', Color);
        writeConsole(ID, '#/inv  $4 (Give you the invisibility)    #', Color);
        writeConsole(ID, '#/med $3 (Give you a medic kit)          #', Color);
        writeConsole(ID, '#/nade $3 (Give to you some nade)        #', Color);
        writeConsole(ID, '#/flame $7 (Give you a flamer)           #', Color);
        writeConsole(ID, '#/vest $4 (Give you a Bullet proof)      #', Color);
        writeConsole(ID, '#/serk $5 (Give you the RAGE !!!)        #', Color);
        writeConsole(ID, '#/clust $4 (Give you some cluster)       #', Color);
        writeConsole(ID, '#/power $10 (Spawn all bonus above you)  #', Color);
        writeConsole(ID, '#/eagle $5 (Give you a Desert Eagle)     #', Color);
        writeConsole(ID, '#/mp5 $5 (Give you a Hk mp5)             #', Color);
        writeConsole(ID, '#/ak47 $5 (Give you a Ak 47)             #', Color);
        writeConsole(ID, '#/aug $5 (Give you a Steyr AUG)          #', Color);
        writeConsole(ID, '#/spas $6 (Give you a spas 12)           #', Color);
        writeConsole(ID, '#/ruge $4 (Give you a Ruger)             #', Color);
        writeConsole(ID, '#/m79 $6 (Give you a m79)                #', Color);
        writeConsole(ID, '#/barr $6 (Give you a Barret)            #', Color);
        writeConsole(ID, '#/minim $6 (Give you a FN minimi)        #', Color);
        writeConsole(ID, '#/minig $5 (Give you a Minigun)          #', Color);
        writeConsole(ID, '#/guns (Spawn all gun above you)         #', Color);
        writeConsole(ID, '#############END##########################', Color);
      end;





if regExpMatch('^/(stationary|stat|turrent)$', Text) then
  begin
      if money[ID] >= statcost then
        begin
          money[ID] := money[ID] - statcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,15);
          writeconsole(ID, 'You bought a Stat Gun for $15, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color);
      end;
  end;
  result := false;






if regExpMatch('^/(psg)$', Text) then begin
      if money[ID] >= psgcost then begin
          money[ID] := money[ID] - psgcost;
         placesentry(getplayerstat(ID,'x'),getplayerstat(ID,'y'),ID,getplayerstat(ID,'team'));
          writeconsole(ID, 'You bought a Sentry Gun for $20, you have $' + inttostr(money[ID]), Color);
        end else begin writeconsole(ID, 'You do not have enough money', Color);
    end;
end;




if regExpMatch('^/(merc)$', Text) then
  begin
      if money[ID] >= merccost then
        begin
          money[ID] := money[ID] - merccost;
          Command('/addbot1 mercenary');
          writeconsole(ID, 'Youve engage a mercenary for $10, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color);
      end;
  end;

  if regExpMatch('^/(desert eagles|eagle|deagles|deserteagles)$', Text) then
    begin
      if money[ID] >= eaglecost then
        begin
          money[ID] := money[ID] - eaglecost;
          forceWeapon(ID,1,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought deagles for $5, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(hkmp5|mp5|hk)$', Text) then
    begin
      if money[ID] >= mp5cost then
        begin
          money[ID] := money[ID] - mp5cost;
          forceWeapon(ID,2,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a HK MP5 for $5, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(ak47)$', Text) then
    begin
      if money[ID] >= ak47cost then
        begin
          money[ID] := money[ID] - ak47cost;
          forceWeapon(ID,3,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a AK47 for $5, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(steyr|aug)$', Text) then
    begin
      if money[ID] >= augcost then
        begin
          money[ID] := money[ID] - augcost;
          forceWeapon(ID,4,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a Steyr Aug for $5, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(spas 12|spas|spas12)$', Text) then
    begin
      if money[ID] >= spascost then
        begin
          money[ID] := money[ID] - spascost;
          forceWeapon(ID,5,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a SPAS12 for $6, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(ruger|ruge|ruger77)$', Text) then
    begin
      if money[ID] >= rugecost then
        begin
          money[ID] := money[ID] - rugecost;
          forceWeapon(ID,6,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a Ruger for $4, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(m79)$', Text) then
    begin
      if money[ID] >= m79cost then
        begin
          money[ID] := money[ID] - m79cost;
          forceWeapon(ID,7,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a M79 for $6, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(barreta|barr|barrett m82a1|barret|barret m)$', Text) then
    begin
      if money[ID] >= barrcost then
        begin
          money[ID] := money[ID] - barrcost;
          forceWeapon(ID,8,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a Barreta for $6, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(fn minimi|minim|fn)$', Text) then
    begin
      if money[ID] >= minimcost then
        begin
          money[ID] := money[ID] - minimcost;
          forceWeapon(ID,9,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a FN Minimi for $6, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(minigun|minig)$', Text) then
    begin
      if money[ID] >= minigcost then
        begin
          money[ID] := money[ID] - minigcost;
          forceWeapon(ID,10,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a Minigun for $5, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;


  if regExpMatch('^/(medic|med|health|med pack)$', Text) then
    begin
      if money[ID] >= medcost then
        begin
          money[ID] := money[ID] - medcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,16);
          writeconsole(ID, 'You bought a Medkit for $3, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(grenade|nade)$', Text) then
    begin
      if money[ID] >= nadecost then
        begin
          money[ID] := money[ID] - nadecost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,17);
          writeconsole(ID, 'You bought some Greanades for $3, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(cluster|clust|clustergrandes|clusternades|clustnades)$', Text) then
    begin
      if money[ID] >= clustcost then
        begin
          money[ID] := money[ID] - clustcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,22);
          writeconsole(ID, 'You bought some Cluster Greanades for $4, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(armor|vest|bulletproofvest)$', Text) then
    begin
      if money[ID] >= vestcost then
        begin
          money[ID] := money[ID] - vestcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,19);
          writeconsole(ID, 'You bought a Bullet Proof Vest for $4, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;


  if regExpMatch('^/(boxes|power|box)$', Text) then
    begin
      if money[ID] >= powercost then
        begin
          money[ID] := money[ID] - powercost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,16);
          SpawnObject(GetPlayerStat(ID,'x')+30,GetPlayerStat(ID,'y')-20,17);
          SpawnObject(GetPlayerStat(ID,'x')+40,GetPlayerStat(ID,'y')-20,18);
          SpawnObject(GetPlayerStat(ID,'x')+50,GetPlayerStat(ID,'y')-20,19);
          SpawnObject(GetPlayerStat(ID,'x')+60,GetPlayerStat(ID,'y')-20,20);
          SpawnObject(GetPlayerStat(ID,'x')+70,GetPlayerStat(ID,'y')-20,21);
          SpawnObject(GetPlayerStat(ID,'x')+80,GetPlayerStat(ID,'y')-20,22);
          writeconsole(ID, 'You bought all Powerups for $10, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(preditor|inv|invisible)$', Text) then
    begin
      if money[ID] >= invcost then
        begin
          money[ID] := money[ID] - invcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,20);
          writeconsole(ID, 'You bought a Preditor Box for $4, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(flame god|flame|flamegodmode|flame god mode)$', Text) then
    begin
      if money[ID] >= flamecost then
        begin
          money[ID] := money[ID] - flamecost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,18);
          writeconsole(ID, 'You bought a Flame God Box for $7, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(berseker|serk)$', Text) then
    begin
      if money[ID] >= serkcost then
        begin
          money[ID] := money[ID] - serkcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,21);
          writeconsole(ID, 'You bought a Berseker Box for $5, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;



if regExpMatch('^/(gunz|guns|weapons|weaps|weps)$', Text) then
    begin
      if money[ID] >= allcost then
        begin
          money[ID] := money[ID] - allcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,1);
          SpawnObject(GetPlayerStat(ID,'x')+30,GetPlayerStat(ID,'y')-20,2);
          SpawnObject(GetPlayerStat(ID,'x')+40,GetPlayerStat(ID,'y')-20,3);
          SpawnObject(GetPlayerStat(ID,'x')+50,GetPlayerStat(ID,'y')-20,4);
          SpawnObject(GetPlayerStat(ID,'x')+60,GetPlayerStat(ID,'y')-20,5);
          SpawnObject(GetPlayerStat(ID,'x')+70,GetPlayerStat(ID,'y')-20,6);
          SpawnObject(GetPlayerStat(ID,'x')+80,GetPlayerStat(ID,'y')-20,7);
          SpawnObject(GetPlayerStat(ID,'x')-20,GetPlayerStat(ID,'y')-20,8);
          SpawnObject(GetPlayerStat(ID,'x')-30,GetPlayerStat(ID,'y')-20,9);
          SpawnObject(GetPlayerStat(ID,'x')-40,GetPlayerStat(ID,'y')-20,10);
          SpawnObject(GetPlayerStat(ID,'x')-50,GetPlayerStat(ID,'y')-20,11);
          SpawnObject(GetPlayerStat(ID,'x')-60,GetPlayerStat(ID,'y')-20,12);
          SpawnObject(GetPlayerStat(ID,'x')-70,GetPlayerStat(ID,'y')-20,13);
          SpawnObject(GetPlayerStat(ID,'x')-80,GetPlayerStat(ID,'y')-20,14);
          writeconsole(ID, 'You bought all Weapon for $15, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color);
   end;

end;
end;

procedure OnMapChange(newmap:string);
var n:byte;
begin
for n:=1 to maxpsg do begin sgd[n]:=false; end;
end;

procedure OnLeaveGame(ID,team:byte;kicked:boolean);
var n:byte;
begin
for n:=1 to maxpsg do
begin if sgo[n]=ID then sgd[n]:= false;
end;
WriteFile('scripts/' + ScriptName + '/' + IdToIp(ID) + '.txt',IntToStr(Money[ID]));
end;




Procedure AppOnIdle(Ticks: Integer);
 Var N, K: Byte;
  X, Y, Dista: Single;
   Begin
    For N := 1 To maxpsg Do Begin
     if sgd[n] = True Then Begin
      CreateBullet(sgx[n],sgy[n],0,0,0,5,sgo[n]);
       For K := 1 To 32 Do Begin
        GetPlayerXy(K,X,Y);
         if GetPlayerStat(K,'Team') <> sgt[n] Then if GetPlayerStat(K,'Alive') = True Then if RayCast(sgx[n],sgy[n],x,y,dista,psgrang) = True Then if dista <= psgrang Then Begin
          x := ((x-sgx[n]) / dista)*psgspee;
         y := ((y-sgy[n]) / dista)*psgspee;
          CreateBullet(sgx[n],sgy[n],x,y,psgpowa,psgtype,sgo[n]); sga[n]:=sga[n]-1;
         if sga[n] = 0 Then Begin
      sgd[n] := false;
      Writeconsole(sgo[n],'One of your sentry guns ran out of ammo.',$0000FF00);
     end;
     Break;
    end;
   end;
  end;
 end;
end;
Title: Re: Can i put that these two script make one ?
Post by: Gizd on April 14, 2010, 03:03:57 pm
Yes.

edit: Hell yeah, removing post when I respond to it.
Title: Re: Can i put that these two script make one ?
Post by: mich1103 on April 14, 2010, 03:44:02 pm
Another problem  :'(


################################
procedure OnJoinGame(ID, Team: byte);
  begin
    writeConsole(ID, 'Your Money is: $' + inttostr(money[ID]),Color);
    writeConsole(ID, 'Do /shop to see the shop, do /money to see your money !' + inttostr(money[ID]), Color);
   if FileExists('scripts/' + ScriptName + '/' + IdToIp(ID) + '.txt') then begin
   Money[ID] := StrToInt(ReadFile('scripts/' + ScriptName + '/' + IdToIp(ID) + '.txt'));
   end else Money[ID] := 1;
  end;

#####################################

Some people get 1 on join game ...
Title: Re: Can i put that these two script make one ?
Post by: Mercury92 on April 14, 2010, 03:51:57 pm
Then how much should they get on join?
ofc they will get Money = 1 if their IP is not recorded.
Title: Re: Can i put that these two script make one ?
Post by: mich1103 on April 14, 2010, 03:54:14 pm
end else Money[ID] := + 0;
i should put it like that ?
Title: Re: Can i put that these two script make one ?
Post by: Mercury92 on April 14, 2010, 03:58:20 pm
If you want to have money = 0 at the beginning then:
end else Money[ID] := 0;
Title: Re: Can i put that these two script make one ?
Post by: mich1103 on April 14, 2010, 04:03:42 pm
OMG !!!!
i know that but ....i have a auto save/load system based on ip but the fu**ing
end else Money[ID] = 1 ;
put the money to 1
but in my script i have a part that when the player join team that give to him his money back ... and the end else Money[ID] = 1 ; put 1 money to all people
so my script cant load the money ...
Title: Re: Can i put that these two script make one ?
Post by: Mercury92 on April 14, 2010, 04:19:35 pm
First, learn to behave yourself.
Second, you asked help, we told you how and now try to make.
Third, we can't understand your own "English" language. Even Google Translator does better job.

I tried script works well. Of course if player has changed his IP he will have 0 or 1 money at start.
Title: Re: Can i put that these two script make one ?
Post by: mich1103 on April 14, 2010, 04:23:47 pm
|THC| Narga joining game (85.242.190.104:23073)

|THC| Narga has joined alpha team.
he got 7 $
he should have 38$
Title: Re: Can i put that these two script make one ?
Post by: SpiltCoffee on April 15, 2010, 03:26:29 am
It looks like you're somehow using a 5 bit Integer... :S
Title: Re: Can i put that these two script make one ?
Post by: dnmr on April 15, 2010, 04:53:56 am
most likely because of the \r\n or w/e in the end of the file. Trim it with copy() or a custom function
Title: Re: Can i put that these two script make one ?
Post by: mich1103 on April 15, 2010, 05:44:57 am
okkkkkk
but what i do ?
Title: Re: Can i put that these two script make one ?
Post by: dnmr on April 15, 2010, 06:40:33 am
okkkkkk
but what i do ?
http://en.wikipedia.org/wiki/Newline

looks like you have \r\n in the end of your file
to get rid of them, use this function:

http://www.mirrorservice.org/sites/www.gnu-pascal.de/gpc/Copy.html
Title: Re: Can i put that these two script make one ?
Post by: mich1103 on April 15, 2010, 06:55:16 am
I use that ?
 function Copy (S: String; FirstChar: Integer): String;
To copy the money from the folder and give the money to the player ?
Title: Re: Can i put that these two script make one ?
Post by: Stuffy on April 15, 2010, 08:36:41 am
nope he means that theres a "Enter" in your file, and because of that it bugs sometimes. Fix that with Copy.

Code: [Select]
OnJoinGame

var
Content : string;

begin

if FileExists('scripts/' + ScriptName + '/' + IdToIp(ID) + '.txt') then begin
   Content := ReadFile('scripts' + ScriptName + IdToIp(ID));
   Money[ID] := StrToInt(Copy(Content,0,lenght(Content)));
   end else Money[ID] := 1;

end;
end;

That will clean the integer-value. (Thats the way I would do it.)
Title: Re: Can i put that these two script make one ?
Post by: mich1103 on April 16, 2010, 05:16:13 am
Can you include it to my script ?
Title: Re: Can i put that these two script make one ?
Post by: Stuffy on April 16, 2010, 09:18:11 am
Try to do it yourself, if you can think a bit logical you should be able to see where you have to paste this.
Title: Re: Can i put that these two script make one ?
Post by: mich1103 on April 16, 2010, 03:59:16 pm
that will be the last time you will include a part of script to a script !
or you can just say how i can include it !!!
Title: Re: Can i put that these two script make one ?
Post by: Stuffy on April 16, 2010, 04:06:24 pm
Well, here it is.

Code: [Select]
const
Color = $0099CC; //Color to be used.
psgpowa = 1;
psgtype = 14;
psgrang = 666;
psgspee = 65;
maxpsg = 5;
psgammo = 50; //took the liberty to invent it, since it was missing.

var
  pname: string;
  money: array[1..32] of integer;
  statcost:integer;
  giveid:integer;
  psgcost:integer;
  merccost:integer;
  give,ammount,player:string;
  sgx,sgy:array[1..maxpsg] of single;
  sga,sgo,sgt:array[1..maxpsg] of byte;
  sgd:array[1..maxpsg] of boolean;
  invcost,medcost,nadecost,flamecost,vestcost,serkcost,clustcost,powercost,eaglecost: integer;
  mp5cost,ak47cost,augcost,spascost,rugecost,m79cost,barrcost,minimcost,minigcost, allcost: integer;
 

procedure placesentry(x,y:single;ID,team:byte);
var n,f:byte;
begin
if getplayerstat(ID,'Ground')=true then begin
f:=maxpsg;
for n:=1 to maxpsg do begin
if sgd[n]=true then f:=f-1;
end;
if f=0 then DrawText(ID,'Maximum of '+inttostr(maxpsg)+' sentry guns on map reached.',250,RGB(0,255,0),0.10,150,400) else begin
for n:=1 to maxpsg do begin
if sgd[n]=false then break;
end;
sgx[n]:=x; sgy[n]:=y; sgo[n]:=ID; sgt[n]:=team; sga[n]:=psgammo; sgd[n]:=true;
DrawText(ID,'Sentry gun placed!',250,RGB(0,255,0),0.1,75,350);
end;
end else DrawText(ID,'You are in mid-air!',250,RGB(0,255,0),0.10,220,400);
end;
 
 
 
procedure ActivateServer();
  begin
    statcost        := 15;
    psgcost         := 20;
    merccost        := 10;
    invcost         := 4;
    medcost         := 3;
    nadecost        := 3;
    flamecost       := 7;
    vestcost        := 4;
    serkcost        := 4;
    clustcost       := 4;
    powercost       := 10;
    eaglecost       := 5;
    mp5cost         := 5;
    ak47cost        := 5;
    augcost         := 5;
    spascost        := 6;
    rugecost        := 4;
    m79cost         := 6;
    barrcost        := 6;
    minimcost       := 6;
    minigcost       := 5;
    allcost         := 12;
  end;


procedure OnJoinGame(ID, Team: byte);

var
Content : string;

  begin
    writeConsole(ID, 'Your Money is: $' + inttostr(money[ID]),Color);
    writeConsole(ID, 'Do /shop to see the shop, do /money to see your money !' + inttostr(money[ID]), Color);
   
if FileExists('scripts/' + ScriptName + '/' + IdToIp(ID) + '.txt') then begin
   Content := ReadFile('scripts' + ScriptName + IdToIp(ID));
   Money[ID] := StrToInt(Copy(Content,0,lenght(Content)));
   end else Money[ID] := 1;
end;
  end;

procedure OnPlayerKill(Killer, Victim: byte;Weapon: string);
  begin
    if Killer = Victim then
      begin
         writeConsole(Killer, 'you cant kill yourself for money !', Color);
      end else
      begin
        money[Killer] := money[Killer]+1;
        writeConsole(Killer, 'You just got $1 your money is now: $' + inttostr(money[Killer]), Color);
      end;
  end;




function OnPlayerCommand(ID: Byte; Text: string): boolean;
  begin



  give := GetPiece(LowerCase(Text), ' ', 0);
  ammount := GetPiece(LowerCase(Text), ' ', 1);
  player := GetPiece(Text, ' ', 2);
  if give = '/give' then
    begin
      if money[ID] > strtoint(ammount) then
        begin
          giveid := NameToID(player);

          if giveid > 0 then
            begin
              money[ID] := money[ID] - strtoint(ammount);
              money[giveid] := money[giveid] + strtoint(ammount);
              writeconsole(ID, 'You gave $' + ammount + ' to: ' + IDToName(giveid) + ', Your money is now: $' + inttostr(money[ID]) , Color);
              writeconsole(giveid, 'You recived $' + ammount + ' from: ' + IDToName(ID) + ', Your money is now: $' + inttostr(money[giveid]), Color);
            end else
              begin
                writeconsole(ID, 'That person does not exist.', Color);
              end;

        end else
        begin
          writeconsole(ID, 'You don''t have enough money', Color);
        end;

    end;







    if regExpMatch('^/(money|moneys)$', Text) then
      begin
        writeConsole(ID, 'Your money is: $' + inttostr(money[ID]), Color);
     end;



    if regExpMatch('^/(commands|shop|spawn|help)$', Text) then
      begin
        writeConsole(ID, '#############SHOP#########################', Color);
        writeConsole(ID, '#commands:                               #', Color);
        writeConsole(ID, '#/stat $15 (spawn a turret)              #', Color);
        writeConsole(ID, '#/psg $20 (Spawn a sentry gun)           #', Color);
        writeConsole(ID, '#/merc $10 (Spawn a mercenary)           #', Color);
        writeConsole(ID, '#/inv  $4 (Give you the invisibility)    #', Color);
        writeConsole(ID, '#/med $3 (Give you a medic kit)          #', Color);
        writeConsole(ID, '#/nade $3 (Give to you some nade)        #', Color);
        writeConsole(ID, '#/flame $7 (Give you a flamer)           #', Color);
        writeConsole(ID, '#/vest $4 (Give you a Bullet proof)      #', Color);
        writeConsole(ID, '#/serk $5 (Give you the RAGE !!!)        #', Color);
        writeConsole(ID, '#/clust $4 (Give you some cluster)       #', Color);
        writeConsole(ID, '#/power $10 (Spawn all bonus above you)  #', Color);
        writeConsole(ID, '#/eagle $5 (Give you a Desert Eagle)     #', Color);
        writeConsole(ID, '#/mp5 $5 (Give you a Hk mp5)             #', Color);
        writeConsole(ID, '#/ak47 $5 (Give you a Ak 47)             #', Color);
        writeConsole(ID, '#/aug $5 (Give you a Steyr AUG)          #', Color);
        writeConsole(ID, '#/spas $6 (Give you a spas 12)           #', Color);
        writeConsole(ID, '#/ruge $4 (Give you a Ruger)             #', Color);
        writeConsole(ID, '#/m79 $6 (Give you a m79)                #', Color);
        writeConsole(ID, '#/barr $6 (Give you a Barret)            #', Color);
        writeConsole(ID, '#/minim $6 (Give you a FN minimi)        #', Color);
        writeConsole(ID, '#/minig $5 (Give you a Minigun)          #', Color);
        writeConsole(ID, '#/guns (Spawn all gun above you)         #', Color);
        writeConsole(ID, '#############END##########################', Color);
      end;





if regExpMatch('^/(stationary|stat|turrent)$', Text) then
  begin
      if money[ID] >= statcost then
        begin
          money[ID] := money[ID] - statcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,15);
          writeconsole(ID, 'You bought a Stat Gun for $15, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color);
      end;
  end;
  result := false;






if regExpMatch('^/(psg)$', Text) then begin
      if money[ID] >= psgcost then begin
          money[ID] := money[ID] - psgcost;
         placesentry(getplayerstat(ID,'x'),getplayerstat(ID,'y'),ID,getplayerstat(ID,'team'));
          writeconsole(ID, 'You bought a Sentry Gun for $20, you have $' + inttostr(money[ID]), Color);
        end else begin writeconsole(ID, 'You do not have enough money', Color);
    end;
end;




if regExpMatch('^/(merc)$', Text) then
  begin
      if money[ID] >= merccost then
        begin
          money[ID] := money[ID] - merccost;
          Command('/addbot1 mercenary');
          writeconsole(ID, 'Youve engage a mercenary for $10, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color);
      end;
  end;

  if regExpMatch('^/(desert eagles|eagle|deagles|deserteagles)$', Text) then
    begin
      if money[ID] >= eaglecost then
        begin
          money[ID] := money[ID] - eaglecost;
          forceWeapon(ID,1,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought deagles for $5, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(hkmp5|mp5|hk)$', Text) then
    begin
      if money[ID] >= mp5cost then
        begin
          money[ID] := money[ID] - mp5cost;
          forceWeapon(ID,2,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a HK MP5 for $5, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(ak47)$', Text) then
    begin
      if money[ID] >= ak47cost then
        begin
          money[ID] := money[ID] - ak47cost;
          forceWeapon(ID,3,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a AK47 for $5, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(steyr|aug)$', Text) then
    begin
      if money[ID] >= augcost then
        begin
          money[ID] := money[ID] - augcost;
          forceWeapon(ID,4,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a Steyr Aug for $5, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(spas 12|spas|spas12)$', Text) then
    begin
      if money[ID] >= spascost then
        begin
          money[ID] := money[ID] - spascost;
          forceWeapon(ID,5,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a SPAS12 for $6, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(ruger|ruge|ruger77)$', Text) then
    begin
      if money[ID] >= rugecost then
        begin
          money[ID] := money[ID] - rugecost;
          forceWeapon(ID,6,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a Ruger for $4, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(m79)$', Text) then
    begin
      if money[ID] >= m79cost then
        begin
          money[ID] := money[ID] - m79cost;
          forceWeapon(ID,7,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a M79 for $6, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(barreta|barr|barrett m82a1|barret|barret m)$', Text) then
    begin
      if money[ID] >= barrcost then
        begin
          money[ID] := money[ID] - barrcost;
          forceWeapon(ID,8,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a Barreta for $6, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(fn minimi|minim|fn)$', Text) then
    begin
      if money[ID] >= minimcost then
        begin
          money[ID] := money[ID] - minimcost;
          forceWeapon(ID,9,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a FN Minimi for $6, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(minigun|minig)$', Text) then
    begin
      if money[ID] >= minigcost then
        begin
          money[ID] := money[ID] - minigcost;
          forceWeapon(ID,10,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a Minigun for $5, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;


  if regExpMatch('^/(medic|med|health|med pack)$', Text) then
    begin
      if money[ID] >= medcost then
        begin
          money[ID] := money[ID] - medcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,16);
          writeconsole(ID, 'You bought a Medkit for $3, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(grenade|nade)$', Text) then
    begin
      if money[ID] >= nadecost then
        begin
          money[ID] := money[ID] - nadecost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,17);
          writeconsole(ID, 'You bought some Greanades for $3, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(cluster|clust|clustergrandes|clusternades|clustnades)$', Text) then
    begin
      if money[ID] >= clustcost then
        begin
          money[ID] := money[ID] - clustcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,22);
          writeconsole(ID, 'You bought some Cluster Greanades for $4, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(armor|vest|bulletproofvest)$', Text) then
    begin
      if money[ID] >= vestcost then
        begin
          money[ID] := money[ID] - vestcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,19);
          writeconsole(ID, 'You bought a Bullet Proof Vest for $4, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;


  if regExpMatch('^/(boxes|power|box)$', Text) then
    begin
      if money[ID] >= powercost then
        begin
          money[ID] := money[ID] - powercost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,16);
          SpawnObject(GetPlayerStat(ID,'x')+30,GetPlayerStat(ID,'y')-20,17);
          SpawnObject(GetPlayerStat(ID,'x')+40,GetPlayerStat(ID,'y')-20,18);
          SpawnObject(GetPlayerStat(ID,'x')+50,GetPlayerStat(ID,'y')-20,19);
          SpawnObject(GetPlayerStat(ID,'x')+60,GetPlayerStat(ID,'y')-20,20);
          SpawnObject(GetPlayerStat(ID,'x')+70,GetPlayerStat(ID,'y')-20,21);
          SpawnObject(GetPlayerStat(ID,'x')+80,GetPlayerStat(ID,'y')-20,22);
          writeconsole(ID, 'You bought all Powerups for $10, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(preditor|inv|invisible)$', Text) then
    begin
      if money[ID] >= invcost then
        begin
          money[ID] := money[ID] - invcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,20);
          writeconsole(ID, 'You bought a Preditor Box for $4, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(flame god|flame|flamegodmode|flame god mode)$', Text) then
    begin
      if money[ID] >= flamecost then
        begin
          money[ID] := money[ID] - flamecost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,18);
          writeconsole(ID, 'You bought a Flame God Box for $7, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(berseker|serk)$', Text) then
    begin
      if money[ID] >= serkcost then
        begin
          money[ID] := money[ID] - serkcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,21);
          writeconsole(ID, 'You bought a Berseker Box for $5, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;



if regExpMatch('^/(gunz|guns|weapons|weaps|weps)$', Text) then
    begin
      if money[ID] >= allcost then
        begin
          money[ID] := money[ID] - allcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,1);
          SpawnObject(GetPlayerStat(ID,'x')+30,GetPlayerStat(ID,'y')-20,2);
          SpawnObject(GetPlayerStat(ID,'x')+40,GetPlayerStat(ID,'y')-20,3);
          SpawnObject(GetPlayerStat(ID,'x')+50,GetPlayerStat(ID,'y')-20,4);
          SpawnObject(GetPlayerStat(ID,'x')+60,GetPlayerStat(ID,'y')-20,5);
          SpawnObject(GetPlayerStat(ID,'x')+70,GetPlayerStat(ID,'y')-20,6);
          SpawnObject(GetPlayerStat(ID,'x')+80,GetPlayerStat(ID,'y')-20,7);
          SpawnObject(GetPlayerStat(ID,'x')-20,GetPlayerStat(ID,'y')-20,8);
          SpawnObject(GetPlayerStat(ID,'x')-30,GetPlayerStat(ID,'y')-20,9);
          SpawnObject(GetPlayerStat(ID,'x')-40,GetPlayerStat(ID,'y')-20,10);
          SpawnObject(GetPlayerStat(ID,'x')-50,GetPlayerStat(ID,'y')-20,11);
          SpawnObject(GetPlayerStat(ID,'x')-60,GetPlayerStat(ID,'y')-20,12);
          SpawnObject(GetPlayerStat(ID,'x')-70,GetPlayerStat(ID,'y')-20,13);
          SpawnObject(GetPlayerStat(ID,'x')-80,GetPlayerStat(ID,'y')-20,14);
          writeconsole(ID, 'You bought all Weapon for $15, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color);
   end;

end;
end;

procedure OnMapChange(newmap:string);
var n:byte;
begin
for n:=1 to maxpsg do begin sgd[n]:=false; end;
end;

procedure OnLeaveGame(ID,team:byte;kicked:boolean);
var n:byte;
begin
for n:=1 to maxpsg do
begin if sgo[n]=ID then sgd[n]:= false;
end;
WriteFile('scripts/' + ScriptName + '/' + IdToIp(ID) + '.txt',IntToStr(Money[ID]));
end;




Procedure AppOnIdle(Ticks: Integer);
 Var N, K: Byte;
  X, Y, Dista: Single;
   Begin
    For N := 1 To maxpsg Do Begin
     if sgd[n] = True Then Begin
      CreateBullet(sgx[n],sgy[n],0,0,0,5,sgo[n]);
       For K := 1 To 32 Do Begin
        GetPlayerXy(K,X,Y);
         if GetPlayerStat(K,'Team') <> sgt[n] Then if GetPlayerStat(K,'Alive') = True Then if RayCast(sgx[n],sgy[n],x,y,dista,psgrang) = True Then if dista <= psgrang Then Begin
          x := ((x-sgx[n]) / dista)*psgspee;
         y := ((y-sgy[n]) / dista)*psgspee;
          CreateBullet(sgx[n],sgy[n],x,y,psgpowa,psgtype,sgo[n]); sga[n]:=sga[n]-1;
         if sga[n] = 0 Then Begin
      sgd[n] := false;
      Writeconsole(sgo[n],'One of your sentry guns ran out of ammo.',$0000FF00);
     end;
     Break;
    end;
   end;
  end;
 end;
end;
Title: Re: Can i put that these two script make one ?
Post by: mich1103 on April 16, 2010, 09:06:43 pm
Error
10-04-16 22:05:55 
Title: Re: Can i put that these two script make one ?
Post by: Stuffy on April 17, 2010, 02:17:13 am
my fault, made a mistake there. It has to be "length" and I wrote lenght.

Code: [Select]
const
Color = $0099CC; //Color to be used.
psgpowa = 1;
psgtype = 14;
psgrang = 666;
psgspee = 65;
maxpsg = 5;
psgammo = 50; //took the liberty to invent it, since it was missing.

var
  pname: string;
  money: array[1..32] of integer;
  statcost:integer;
  giveid:integer;
  psgcost:integer;
  merccost:integer;
  give,ammount,player:string;
  sgx,sgy:array[1..maxpsg] of single;
  sga,sgo,sgt:array[1..maxpsg] of byte;
  sgd:array[1..maxpsg] of boolean;
  invcost,medcost,nadecost,flamecost,vestcost,serkcost,clustcost,powercost,eaglecost: integer;
  mp5cost,ak47cost,augcost,spascost,rugecost,m79cost,barrcost,minimcost,minigcost, allcost: integer;
 

procedure placesentry(x,y:single;ID,team:byte);
var n,f:byte;
begin
if getplayerstat(ID,'Ground')=true then begin
f:=maxpsg;
for n:=1 to maxpsg do begin
if sgd[n]=true then f:=f-1;
end;
if f=0 then DrawText(ID,'Maximum of '+inttostr(maxpsg)+' sentry guns on map reached.',250,RGB(0,255,0),0.10,150,400) else begin
for n:=1 to maxpsg do begin
if sgd[n]=false then break;
end;
sgx[n]:=x; sgy[n]:=y; sgo[n]:=ID; sgt[n]:=team; sga[n]:=psgammo; sgd[n]:=true;
DrawText(ID,'Sentry gun placed!',250,RGB(0,255,0),0.1,75,350);
end;
end else DrawText(ID,'You are in mid-air!',250,RGB(0,255,0),0.10,220,400);
end;
 
 
 
procedure ActivateServer();
  begin
    statcost        := 15;
    psgcost         := 20;
    merccost        := 10;
    invcost         := 4;
    medcost         := 3;
    nadecost        := 3;
    flamecost       := 7;
    vestcost        := 4;
    serkcost        := 4;
    clustcost       := 4;
    powercost       := 10;
    eaglecost       := 5;
    mp5cost         := 5;
    ak47cost        := 5;
    augcost         := 5;
    spascost        := 6;
    rugecost        := 4;
    m79cost         := 6;
    barrcost        := 6;
    minimcost       := 6;
    minigcost       := 5;
    allcost         := 12;
  end;


procedure OnJoinGame(ID, Team: byte);

var
   Content : string;

  begin
    writeConsole(ID, 'Your Money is: $' + inttostr(money[ID]),Color);
    writeConsole(ID, 'Do /shop to see the shop, do /money to see your money !' + inttostr(money[ID]), Color);
   
if FileExists('scripts/' + ScriptName + '/' + IdToIp(ID) + '.txt') then begin
   Content := ReadFile('scripts' + ScriptName + IdToIp(ID));
   Money[ID] := StrToInt(Copy(Content,0,length(Content)));
   end else Money[ID] := 1;
   end;
  end;

procedure OnPlayerKill(Killer, Victim: byte;Weapon: string);
  begin
    if Killer = Victim then
      begin
         writeConsole(Killer, 'you cant kill yourself for money !', Color);
      end else
      begin
        money[Killer] := money[Killer]+1;
        writeConsole(Killer, 'You just got $1 your money is now: $' + inttostr(money[Killer]), Color);
      end;
  end;




function OnPlayerCommand(ID: Byte; Text: string): boolean;
  begin



  give := GetPiece(LowerCase(Text), ' ', 0);
  ammount := GetPiece(LowerCase(Text), ' ', 1);
  player := GetPiece(Text, ' ', 2);
  if give = '/give' then
    begin
      if money[ID] > strtoint(ammount) then
        begin
          giveid := NameToID(player);

          if giveid > 0 then
            begin
              money[ID] := money[ID] - strtoint(ammount);
              money[giveid] := money[giveid] + strtoint(ammount);
              writeconsole(ID, 'You gave $' + ammount + ' to: ' + IDToName(giveid) + ', Your money is now: $' + inttostr(money[ID]) , Color);
              writeconsole(giveid, 'You recived $' + ammount + ' from: ' + IDToName(ID) + ', Your money is now: $' + inttostr(money[giveid]), Color);
            end else
              begin
                writeconsole(ID, 'That person does not exist.', Color);
              end;

        end else
        begin
          writeconsole(ID, 'You don''t have enough money', Color);
        end;

    end;







    if regExpMatch('^/(money|moneys)$', Text) then
      begin
        writeConsole(ID, 'Your money is: $' + inttostr(money[ID]), Color);
     end;



    if regExpMatch('^/(commands|shop|spawn|help)$', Text) then
      begin
        writeConsole(ID, '#############SHOP#########################', Color);
        writeConsole(ID, '#commands:                               #', Color);
        writeConsole(ID, '#/stat $15 (spawn a turret)              #', Color);
        writeConsole(ID, '#/psg $20 (Spawn a sentry gun)           #', Color);
        writeConsole(ID, '#/merc $10 (Spawn a mercenary)           #', Color);
        writeConsole(ID, '#/inv  $4 (Give you the invisibility)    #', Color);
        writeConsole(ID, '#/med $3 (Give you a medic kit)          #', Color);
        writeConsole(ID, '#/nade $3 (Give to you some nade)        #', Color);
        writeConsole(ID, '#/flame $7 (Give you a flamer)           #', Color);
        writeConsole(ID, '#/vest $4 (Give you a Bullet proof)      #', Color);
        writeConsole(ID, '#/serk $5 (Give you the RAGE !!!)        #', Color);
        writeConsole(ID, '#/clust $4 (Give you some cluster)       #', Color);
        writeConsole(ID, '#/power $10 (Spawn all bonus above you)  #', Color);
        writeConsole(ID, '#/eagle $5 (Give you a Desert Eagle)     #', Color);
        writeConsole(ID, '#/mp5 $5 (Give you a Hk mp5)             #', Color);
        writeConsole(ID, '#/ak47 $5 (Give you a Ak 47)             #', Color);
        writeConsole(ID, '#/aug $5 (Give you a Steyr AUG)          #', Color);
        writeConsole(ID, '#/spas $6 (Give you a spas 12)           #', Color);
        writeConsole(ID, '#/ruge $4 (Give you a Ruger)             #', Color);
        writeConsole(ID, '#/m79 $6 (Give you a m79)                #', Color);
        writeConsole(ID, '#/barr $6 (Give you a Barret)            #', Color);
        writeConsole(ID, '#/minim $6 (Give you a FN minimi)        #', Color);
        writeConsole(ID, '#/minig $5 (Give you a Minigun)          #', Color);
        writeConsole(ID, '#/guns (Spawn all gun above you)         #', Color);
        writeConsole(ID, '#############END##########################', Color);
      end;





if regExpMatch('^/(stationary|stat|turrent)$', Text) then
  begin
      if money[ID] >= statcost then
        begin
          money[ID] := money[ID] - statcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,15);
          writeconsole(ID, 'You bought a Stat Gun for $15, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color);
      end;
  end;
  result := false;






if regExpMatch('^/(psg)$', Text) then begin
      if money[ID] >= psgcost then begin
          money[ID] := money[ID] - psgcost;
         placesentry(getplayerstat(ID,'x'),getplayerstat(ID,'y'),ID,getplayerstat(ID,'team'));
          writeconsole(ID, 'You bought a Sentry Gun for $20, you have $' + inttostr(money[ID]), Color);
        end else begin writeconsole(ID, 'You do not have enough money', Color);
    end;
end;




if regExpMatch('^/(merc)$', Text) then
  begin
      if money[ID] >= merccost then
        begin
          money[ID] := money[ID] - merccost;
          Command('/addbot1 mercenary');
          writeconsole(ID, 'Youve engage a mercenary for $10, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color);
      end;
  end;

  if regExpMatch('^/(desert eagles|eagle|deagles|deserteagles)$', Text) then
    begin
      if money[ID] >= eaglecost then
        begin
          money[ID] := money[ID] - eaglecost;
          forceWeapon(ID,1,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought deagles for $5, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(hkmp5|mp5|hk)$', Text) then
    begin
      if money[ID] >= mp5cost then
        begin
          money[ID] := money[ID] - mp5cost;
          forceWeapon(ID,2,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a HK MP5 for $5, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(ak47)$', Text) then
    begin
      if money[ID] >= ak47cost then
        begin
          money[ID] := money[ID] - ak47cost;
          forceWeapon(ID,3,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a AK47 for $5, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(steyr|aug)$', Text) then
    begin
      if money[ID] >= augcost then
        begin
          money[ID] := money[ID] - augcost;
          forceWeapon(ID,4,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a Steyr Aug for $5, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(spas 12|spas|spas12)$', Text) then
    begin
      if money[ID] >= spascost then
        begin
          money[ID] := money[ID] - spascost;
          forceWeapon(ID,5,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a SPAS12 for $6, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(ruger|ruge|ruger77)$', Text) then
    begin
      if money[ID] >= rugecost then
        begin
          money[ID] := money[ID] - rugecost;
          forceWeapon(ID,6,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a Ruger for $4, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(m79)$', Text) then
    begin
      if money[ID] >= m79cost then
        begin
          money[ID] := money[ID] - m79cost;
          forceWeapon(ID,7,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a M79 for $6, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(barreta|barr|barrett m82a1|barret|barret m)$', Text) then
    begin
      if money[ID] >= barrcost then
        begin
          money[ID] := money[ID] - barrcost;
          forceWeapon(ID,8,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a Barreta for $6, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(fn minimi|minim|fn)$', Text) then
    begin
      if money[ID] >= minimcost then
        begin
          money[ID] := money[ID] - minimcost;
          forceWeapon(ID,9,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a FN Minimi for $6, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(minigun|minig)$', Text) then
    begin
      if money[ID] >= minigcost then
        begin
          money[ID] := money[ID] - minigcost;
          forceWeapon(ID,10,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a Minigun for $5, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;


  if regExpMatch('^/(medic|med|health|med pack)$', Text) then
    begin
      if money[ID] >= medcost then
        begin
          money[ID] := money[ID] - medcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,16);
          writeconsole(ID, 'You bought a Medkit for $3, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(grenade|nade)$', Text) then
    begin
      if money[ID] >= nadecost then
        begin
          money[ID] := money[ID] - nadecost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,17);
          writeconsole(ID, 'You bought some Greanades for $3, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(cluster|clust|clustergrandes|clusternades|clustnades)$', Text) then
    begin
      if money[ID] >= clustcost then
        begin
          money[ID] := money[ID] - clustcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,22);
          writeconsole(ID, 'You bought some Cluster Greanades for $4, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(armor|vest|bulletproofvest)$', Text) then
    begin
      if money[ID] >= vestcost then
        begin
          money[ID] := money[ID] - vestcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,19);
          writeconsole(ID, 'You bought a Bullet Proof Vest for $4, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;


  if regExpMatch('^/(boxes|power|box)$', Text) then
    begin
      if money[ID] >= powercost then
        begin
          money[ID] := money[ID] - powercost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,16);
          SpawnObject(GetPlayerStat(ID,'x')+30,GetPlayerStat(ID,'y')-20,17);
          SpawnObject(GetPlayerStat(ID,'x')+40,GetPlayerStat(ID,'y')-20,18);
          SpawnObject(GetPlayerStat(ID,'x')+50,GetPlayerStat(ID,'y')-20,19);
          SpawnObject(GetPlayerStat(ID,'x')+60,GetPlayerStat(ID,'y')-20,20);
          SpawnObject(GetPlayerStat(ID,'x')+70,GetPlayerStat(ID,'y')-20,21);
          SpawnObject(GetPlayerStat(ID,'x')+80,GetPlayerStat(ID,'y')-20,22);
          writeconsole(ID, 'You bought all Powerups for $10, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(preditor|inv|invisible)$', Text) then
    begin
      if money[ID] >= invcost then
        begin
          money[ID] := money[ID] - invcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,20);
          writeconsole(ID, 'You bought a Preditor Box for $4, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(flame god|flame|flamegodmode|flame god mode)$', Text) then
    begin
      if money[ID] >= flamecost then
        begin
          money[ID] := money[ID] - flamecost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,18);
          writeconsole(ID, 'You bought a Flame God Box for $7, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(berseker|serk)$', Text) then
    begin
      if money[ID] >= serkcost then
        begin
          money[ID] := money[ID] - serkcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,21);
          writeconsole(ID, 'You bought a Berseker Box for $5, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;



if regExpMatch('^/(gunz|guns|weapons|weaps|weps)$', Text) then
    begin
      if money[ID] >= allcost then
        begin
          money[ID] := money[ID] - allcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,1);
          SpawnObject(GetPlayerStat(ID,'x')+30,GetPlayerStat(ID,'y')-20,2);
          SpawnObject(GetPlayerStat(ID,'x')+40,GetPlayerStat(ID,'y')-20,3);
          SpawnObject(GetPlayerStat(ID,'x')+50,GetPlayerStat(ID,'y')-20,4);
          SpawnObject(GetPlayerStat(ID,'x')+60,GetPlayerStat(ID,'y')-20,5);
          SpawnObject(GetPlayerStat(ID,'x')+70,GetPlayerStat(ID,'y')-20,6);
          SpawnObject(GetPlayerStat(ID,'x')+80,GetPlayerStat(ID,'y')-20,7);
          SpawnObject(GetPlayerStat(ID,'x')-20,GetPlayerStat(ID,'y')-20,8);
          SpawnObject(GetPlayerStat(ID,'x')-30,GetPlayerStat(ID,'y')-20,9);
          SpawnObject(GetPlayerStat(ID,'x')-40,GetPlayerStat(ID,'y')-20,10);
          SpawnObject(GetPlayerStat(ID,'x')-50,GetPlayerStat(ID,'y')-20,11);
          SpawnObject(GetPlayerStat(ID,'x')-60,GetPlayerStat(ID,'y')-20,12);
          SpawnObject(GetPlayerStat(ID,'x')-70,GetPlayerStat(ID,'y')-20,13);
          SpawnObject(GetPlayerStat(ID,'x')-80,GetPlayerStat(ID,'y')-20,14);
          writeconsole(ID, 'You bought all Weapon for $15, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color);
   end;

end;
end;

procedure OnMapChange(newmap:string);
var n:byte;
begin
for n:=1 to maxpsg do begin sgd[n]:=false; end;
end;

procedure OnLeaveGame(ID,team:byte;kicked:boolean);
var n:byte;
begin
for n:=1 to maxpsg do
begin if sgo[n]=ID then sgd[n]:= false;
end;
WriteFile('scripts/' + ScriptName + '/' + IdToIp(ID) + '.txt',IntToStr(Money[ID]));
end;




Procedure AppOnIdle(Ticks: Integer);
 Var N, K: Byte;
  X, Y, Dista: Single;
   Begin
    For N := 1 To maxpsg Do Begin
     if sgd[n] = True Then Begin
      CreateBullet(sgx[n],sgy[n],0,0,0,5,sgo[n]);
       For K := 1 To 32 Do Begin
        GetPlayerXy(K,X,Y);
         if GetPlayerStat(K,'Team') <> sgt[n] Then if GetPlayerStat(K,'Alive') = True Then if RayCast(sgx[n],sgy[n],x,y,dista,psgrang) = True Then if dista <= psgrang Then Begin
          x := ((x-sgx[n]) / dista)*psgspee;
         y := ((y-sgy[n]) / dista)*psgspee;
          CreateBullet(sgx[n],sgy[n],x,y,psgpowa,psgtype,sgo[n]); sga[n]:=sga[n]-1;
         if sga[n] = 0 Then Begin
      sgd[n] := false;
      Writeconsole(sgo[n],'One of your sentry guns ran out of ammo.',$0000FF00);
     end;
     Break;
    end;
   end;
  end;
 end;
end;
Title: Re: Can i put that these two script make one ?
Post by: mich1103 on April 17, 2010, 04:48:16 am
Hmmm you put a end; of more after OnJoinTeam ,i've fixed it


When a player join the game another time he dont got his money ,he got 0
Title: Re: Can i put that these two script make one ?
Post by: Swompie on April 17, 2010, 04:53:32 am
Maybe his IP changed........
Title: Re: Can i put that these two script make one ?
Post by: mich1103 on April 17, 2010, 06:13:58 am
This error again

 
Title: Re: Can i put that these two script make one ?
Post by: SpiltCoffee on April 17, 2010, 07:07:00 am
That might be happening if the file for that player contains no data for some reason.
Title: Re: Can i put that these two script make one ?
Post by: mich1103 on April 17, 2010, 09:55:02 am
But alot of people have said to ask swompie for help because this server and my server turn around the same thing ! So if you can help me swompi i will probably kiss you through the computer !
Title: Re: Can i put that these two script make one ?
Post by: dnmr on April 17, 2010, 12:25:39 pm
dont break the screen, lol
Title: Re: Can i put that these two script make one ?
Post by: mich1103 on April 17, 2010, 02:17:19 pm
Anyway this is the error when a player join the game !
•[Error] shop -> (OnJoinGame): '' is not a valid integer value

Code: [Select]
const
Color = $0099CC; //Color to be used.
psgpowa = 1;
psgtype = 14;
psgrang = 666;
psgspee = 75;
maxpsg = 5;
psgammo = 60; //took the liberty to invent it, since it was missing.

var
  pname: string;
  money: array[1..32] of integer;
  statcost:integer;
  giveid:integer;
  psgcost:integer;
  merccost:integer;
  give,ammount,player:string;
  sgx,sgy:array[1..maxpsg] of single;
  sga,sgo,sgt:array[1..maxpsg] of byte;
  sgd:array[1..maxpsg] of boolean;
  invcost,medcost,nadecost,flamecost,vestcost,serkcost,clustcost,powercost,eaglecost: integer;
  mp5cost,ak47cost,augcost,spascost,rugecost,m79cost,barrcost,minimcost,minigcost, allcost: integer;
 

procedure placesentry(x,y:single;ID,team:byte);
var n,f:byte;
begin
if getplayerstat(ID,'Ground')=true then begin
f:=maxpsg;
for n:=1 to maxpsg do begin
if sgd[n]=true then f:=f-1;
end;
if f=0 then DrawText(ID,'Maximum of '+inttostr(maxpsg)+' sentry guns on map reached.',250,RGB(0,255,0),0.10,150,400) else begin
for n:=1 to maxpsg do begin
if sgd[n]=false then break;
end;
sgx[n]:=x; sgy[n]:=y; sgo[n]:=ID; sgt[n]:=team; sga[n]:=psgammo; sgd[n]:=true;
DrawText(ID,'Sentry gun placed!',250,RGB(0,255,0),0.1,75,350);
end;
end else DrawText(ID,'You are in mid-air!',250,RGB(0,255,0),0.10,220,400);
end;
 
 
 
procedure ActivateServer();
  begin
    statcost        := 25;
    psgcost         := 30;
    merccost        := 20;
    invcost         := 6;
    medcost         := 5;
    nadecost        := 5;
    flamecost       := 10;
    vestcost        := 5;
    serkcost        := 6;
    clustcost       := 5;
    powercost       := 17;
    eaglecost       := 7;
    mp5cost         := 8;
    ak47cost        := 9;
    augcost         := 8;
    spascost        := 9;
    rugecost        := 7;
    m79cost         := 9;
    barrcost        := 11;
    minimcost       := 8;
    minigcost       := 8;
    allcost         := 20;
  end;


procedure OnJoinGame(ID, Team: byte);

var
   Content : string;

  begin
    writeConsole(ID, 'Your Money is: $' + inttostr(money[ID]),Color);
    writeConsole(ID, 'Do /shop to see the shop, do /money to see your money !' + inttostr(money[ID]), Color);
   
if FileExists('scripts/' + ScriptName + '/' + IdToIp(ID) + '.txt') then begin
   Content := ReadFile('scripts' + ScriptName + IdToIp(ID));
   Money[ID] := StrToInt(Copy(Content,0,length(Content)));
   end else Money[ID] := 1;
   end;





procedure OnPlayerKill(Killer, Victim: byte;Weapon: string);
  begin
    if Killer = Victim then
      begin
         writeConsole(Killer, 'you cant kill yourself for money !', Color);
      end else
      begin
        money[Killer] := money[Killer]+1;
        writeConsole(Killer, 'You just got $1 your money is now: $' + inttostr(money[Killer]), Color);
      end;
  end;




function OnPlayerCommand(ID: Byte; Text: string): boolean;
  begin



  give := GetPiece(LowerCase(Text), ' ', 0);
  ammount := GetPiece(LowerCase(Text), ' ', 1);
  player := GetPiece(Text, ' ', 2);
  if give = '/give' then
    begin
      if money[ID] > strtoint(ammount) then
        begin
          giveid := NameToID(player);

          if giveid > 0 then
            begin
              money[ID] := money[ID] - strtoint(ammount);
              money[giveid] := money[giveid] + strtoint(ammount);
              writeconsole(ID, 'You gave $' + ammount + ' to: ' + IDToName(giveid) + ', Your money is now: $' + inttostr(money[ID]) , Color);
              writeconsole(giveid, 'You recived $' + ammount + ' from: ' + IDToName(ID) + ', Your money is now: $' + inttostr(money[giveid]), Color);
            end else
              begin
                writeconsole(ID, 'That person does not exist.', Color);
              end;

        end else
        begin
          writeconsole(ID, 'You don''t have enough money', Color);
        end;

    end;







    if regExpMatch('^/(money|moneys)$', Text) then
      begin
        writeConsole(ID, 'Your money is: $' + inttostr(money[ID]), Color);
     end;



    if regExpMatch('^/(commands|shop|spawn|help)$', Text) then
      begin
        writeConsole(ID, '#############SHOP#########################', Color);
        writeConsole(ID, '#commands:                               #', Color);
        writeConsole(ID, '#/stat $25 (spawn a turret)              #', Color);
        writeConsole(ID, '#/psg $30 (Spawn a sentry gun)           #', Color);
        writeConsole(ID, '#/merc $20 (Spawn a mercenary)           #', Color);
        writeConsole(ID, '#/inv  $6 (Give you the invisibility)    #', Color);
        writeConsole(ID, '#/med $5 (Give you a medic kit)          #', Color);
        writeConsole(ID, '#/nade $5 (Give to you some nade)        #', Color);
        writeConsole(ID, '#/flame $10 (Give you a flamer)          #', Color);
        writeConsole(ID, '#/vest $5 (Give you a Bullet proof)      #', Color);
        writeConsole(ID, '#/serk $6 (Give you the RAGE !!!)        #', Color);
        writeConsole(ID, '#/clust $5 (Give you some cluster)       #', Color);
        writeConsole(ID, '#/power $17 (Spawn all bonus above you)  #', Color);
        writeConsole(ID, '#/eagle $7 (Give you a Desert Eagle)     #', Color);
        writeConsole(ID, '#/mp5 $8 (Give you a Hk mp5)             #', Color);
        writeConsole(ID, '#/ak47 $9 (Give you a Ak 47)             #', Color);
        writeConsole(ID, '#/aug $8 (Give you a Steyr AUG)          #', Color);
        writeConsole(ID, '#/spas $9 (Give you a spas 12)           #', Color);
        writeConsole(ID, '#/ruge $7 (Give you a Ruger)             #', Color);
        writeConsole(ID, '#/m79 $9 (Give you a m79)                #', Color);
        writeConsole(ID, '#/barr $11 (Give you a Barret)           #', Color);
        writeConsole(ID, '#/minim $8 (Give you a FN minimi)        #', Color);
        writeConsole(ID, '#/minig $8 (Give you a Minigun)          #', Color);
        writeConsole(ID, '#/guns 20(Spawn all gun above you)       #', Color);
        writeConsole(ID, '#############END##########################', Color);
      end;





if regExpMatch('^/(stationary|stat|turrent)$', Text) then
  begin
      if money[ID] >= statcost then
        begin
          money[ID] := money[ID] - statcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,15);
          writeconsole(ID, 'You bought a Stat Gun for $25, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color);
      end;
  end;
  result := false;






if regExpMatch('^/(psg)$', Text) then begin
      if money[ID] >= psgcost then begin
          money[ID] := money[ID] - psgcost;
         placesentry(getplayerstat(ID,'x'),getplayerstat(ID,'y'),ID,getplayerstat(ID,'team'));
          writeconsole(ID, 'You bought a Sentry Gun for $30, you have $' + inttostr(money[ID]), Color);
        end else begin writeconsole(ID, 'You do not have enough money', Color);
    end;
end;




if regExpMatch('^/(merc)$', Text) then
  begin
      if money[ID] >= merccost then
        begin
          money[ID] := money[ID] - merccost;
          Command('/addbot1 mercenary');
          writeconsole(ID, 'Youve engage a mercenary for $20, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color);
      end;
  end;

  if regExpMatch('^/(desert eagles|eagle|deagles|deserteagles)$', Text) then
    begin
      if money[ID] >= eaglecost then
        begin
          money[ID] := money[ID] - eaglecost;
          forceWeapon(ID,1,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought deagles for $7, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(hkmp5|mp5|hk)$', Text) then
    begin
      if money[ID] >= mp5cost then
        begin
          money[ID] := money[ID] - mp5cost;
          forceWeapon(ID,2,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a HK MP5 for $8, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(ak47)$', Text) then
    begin
      if money[ID] >= ak47cost then
        begin
          money[ID] := money[ID] - ak47cost;
          forceWeapon(ID,3,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a AK47 for $9, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(steyr|aug)$', Text) then
    begin
      if money[ID] >= augcost then
        begin
          money[ID] := money[ID] - augcost;
          forceWeapon(ID,4,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a Steyr Aug for $8, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(spas 12|spas|spas12)$', Text) then
    begin
      if money[ID] >= spascost then
        begin
          money[ID] := money[ID] - spascost;
          forceWeapon(ID,5,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a SPAS12 for $9, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(ruger|ruge|ruger77)$', Text) then
    begin
      if money[ID] >= rugecost then
        begin
          money[ID] := money[ID] - rugecost;
          forceWeapon(ID,6,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a Ruger for $7, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(m79)$', Text) then
    begin
      if money[ID] >= m79cost then
        begin
          money[ID] := money[ID] - m79cost;
          forceWeapon(ID,7,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a M79 for $9, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(barreta|barr|barrett m82a1|barret|barret m)$', Text) then
    begin
      if money[ID] >= barrcost then
        begin
          money[ID] := money[ID] - barrcost;
          forceWeapon(ID,8,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a Barreta for $11, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(fn minimi|minim|fn)$', Text) then
    begin
      if money[ID] >= minimcost then
        begin
          money[ID] := money[ID] - minimcost;
          forceWeapon(ID,9,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a FN Minimi for $8, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(minigun|minig)$', Text) then
    begin
      if money[ID] >= minigcost then
        begin
          money[ID] := money[ID] - minigcost;
          forceWeapon(ID,10,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a Minigun for $8, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;


  if regExpMatch('^/(medic|med|health|med pack)$', Text) then
    begin
      if money[ID] >= medcost then
        begin
          money[ID] := money[ID] - medcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,16);
          writeconsole(ID, 'You bought a Medkit for $5, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(grenade|nade)$', Text) then
    begin
      if money[ID] >= nadecost then
        begin
          money[ID] := money[ID] - nadecost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,17);
          writeconsole(ID, 'You bought some Grenades for $5, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(cluster|clust|clustergrandes|clusternades|clustnades)$', Text) then
    begin
      if money[ID] >= clustcost then
        begin
          money[ID] := money[ID] - clustcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,22);
          writeconsole(ID, 'You bought some Cluster Greanades for $5, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(armor|vest|bulletproofvest)$', Text) then
    begin
      if money[ID] >= vestcost then
        begin
          money[ID] := money[ID] - vestcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,19);
          writeconsole(ID, 'You bought a Bullet Proof Vest for $5, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;


  if regExpMatch('^/(boxes|power|box)$', Text) then
    begin
      if money[ID] >= powercost then
        begin
          money[ID] := money[ID] - powercost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,16);
          SpawnObject(GetPlayerStat(ID,'x')+30,GetPlayerStat(ID,'y')-20,17);
          SpawnObject(GetPlayerStat(ID,'x')+40,GetPlayerStat(ID,'y')-20,18);
          SpawnObject(GetPlayerStat(ID,'x')+50,GetPlayerStat(ID,'y')-20,19);
          SpawnObject(GetPlayerStat(ID,'x')+60,GetPlayerStat(ID,'y')-20,20);
          SpawnObject(GetPlayerStat(ID,'x')+70,GetPlayerStat(ID,'y')-20,21);
          SpawnObject(GetPlayerStat(ID,'x')+80,GetPlayerStat(ID,'y')-20,22);
          writeconsole(ID, 'You bought all Powerups for $17, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(preditor|inv|invisible)$', Text) then
    begin
      if money[ID] >= invcost then
        begin
          money[ID] := money[ID] - invcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,20);
          writeconsole(ID, 'You bought a Preditor Box for $6, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(flame god|flame|flamegodmode|flame god mode)$', Text) then
    begin
      if money[ID] >= flamecost then
        begin
          money[ID] := money[ID] - flamecost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,18);
          writeconsole(ID, 'You bought a Flame God Box for $10, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(berseker|serk)$', Text) then
    begin
      if money[ID] >= serkcost then
        begin
          money[ID] := money[ID] - serkcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,21);
          writeconsole(ID, 'You bought a Berseker Box for $6, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;



if regExpMatch('^/(gunz|guns|weapons|weaps|weps)$', Text) then
    begin
      if money[ID] >= allcost then
        begin
          money[ID] := money[ID] - allcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,1);
          SpawnObject(GetPlayerStat(ID,'x')+30,GetPlayerStat(ID,'y')-20,2);
          SpawnObject(GetPlayerStat(ID,'x')+40,GetPlayerStat(ID,'y')-20,3);
          SpawnObject(GetPlayerStat(ID,'x')+50,GetPlayerStat(ID,'y')-20,4);
          SpawnObject(GetPlayerStat(ID,'x')+60,GetPlayerStat(ID,'y')-20,5);
          SpawnObject(GetPlayerStat(ID,'x')+70,GetPlayerStat(ID,'y')-20,6);
          SpawnObject(GetPlayerStat(ID,'x')+80,GetPlayerStat(ID,'y')-20,7);
          SpawnObject(GetPlayerStat(ID,'x')-20,GetPlayerStat(ID,'y')-20,8);
          SpawnObject(GetPlayerStat(ID,'x')-30,GetPlayerStat(ID,'y')-20,9);
          SpawnObject(GetPlayerStat(ID,'x')-40,GetPlayerStat(ID,'y')-20,10);
          SpawnObject(GetPlayerStat(ID,'x')-50,GetPlayerStat(ID,'y')-20,11);
          SpawnObject(GetPlayerStat(ID,'x')-60,GetPlayerStat(ID,'y')-20,12);
          SpawnObject(GetPlayerStat(ID,'x')-70,GetPlayerStat(ID,'y')-20,13);
          SpawnObject(GetPlayerStat(ID,'x')-80,GetPlayerStat(ID,'y')-20,14);
          writeconsole(ID, 'You bought all Weapon for $20, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color);
   end;

end;
end;

procedure OnMapChange(newmap:string);
var n:byte;
begin
for n:=1 to maxpsg do begin sgd[n]:=false; end;
end;

procedure OnLeaveGame(ID,team:byte;kicked:boolean);
var n:byte;
begin
for n:=1 to maxpsg do
begin if sgo[n]=ID then sgd[n]:= false;
end;
WriteFile('scripts/' + ScriptName + '/' + IdToIp(ID) + '.txt',IntToStr(Money[ID]));
end;




Procedure AppOnIdle(Ticks: Integer);
 Var N, K: Byte;
  X, Y, Dista: Single;
   Begin
    For N := 1 To maxpsg Do Begin
     if sgd[n] = True Then Begin
      CreateBullet(sgx[n],sgy[n],0,0,0,5,sgo[n]);
       For K := 1 To 32 Do Begin
        GetPlayerXy(K,X,Y);
         if GetPlayerStat(K,'Team') <> sgt[n] Then if GetPlayerStat(K,'Alive') = True Then if RayCast(sgx[n],sgy[n],x,y,dista,psgrang) = True Then if dista <= psgrang Then Begin
          x := ((x-sgx[n]) / dista)*psgspee;
         y := ((y-sgy[n]) / dista)*psgspee;
          CreateBullet(sgx[n],sgy[n],x,y,psgpowa,psgtype,sgo[n]); sga[n]:=sga[n]-1;
         if sga[n] = 0 Then Begin
      sgd[n] := false;
      Writeconsole(sgo[n],'One of your sentry guns ran out of ammo.',$0000FF00);
     end;
     Break;
    end;
   end;
  end;
 end;
end;

procedure OnPlayerSpeak(ID:Byte;Text:String);
begin
if (Text='!money')
      then begin
        writeConsole(ID, 'Your money is: $' + inttostr(money[ID]), Color);
     end;



if(Text='!shop')
      then begin
        writeConsole(ID, '#############SHOP#########################', Color);
        writeConsole(ID, '#commands:                               #', Color);
        writeConsole(ID, '#/stat $25 (spawn a turret)              #', Color);
        writeConsole(ID, '#/psg $30 (Spawn a sentry gun)           #', Color);
        writeConsole(ID, '#/merc $20 (Spawn a mercenary)           #', Color);
        writeConsole(ID, '#/inv  $6 (Give you the invisibility)    #', Color);
        writeConsole(ID, '#/med $5 (Give you a medic kit)          #', Color);
        writeConsole(ID, '#/nade $5 (Give to you some nade)        #', Color);
        writeConsole(ID, '#/flame $10 (Give you a flamer)          #', Color);
        writeConsole(ID, '#/vest $5 (Give you a Bullet proof)      #', Color);
        writeConsole(ID, '#/serk $6 (Give you the RAGE !!!)        #', Color);
        writeConsole(ID, '#/clust $5 (Give you some cluster)       #', Color);
        writeConsole(ID, '#/power $17 (Spawn all bonus above you)  #', Color);
        writeConsole(ID, '#/eagle $7 (Give you a Desert Eagle)     #', Color);
        writeConsole(ID, '#/mp5 $8 (Give you a Hk mp5)             #', Color);
        writeConsole(ID, '#/ak47 $9 (Give you a Ak 47)             #', Color);
        writeConsole(ID, '#/aug $8 (Give you a Steyr AUG)          #', Color);
        writeConsole(ID, '#/spas $9 (Give you a spas 12)           #', Color);
        writeConsole(ID, '#/ruge $7 (Give you a Ruger)             #', Color);
        writeConsole(ID, '#/m79 $9 (Give you a m79)                #', Color);
        writeConsole(ID, '#/barr $11 (Give you a Barret)           #', Color);
        writeConsole(ID, '#/minim $8 (Give you a FN minimi)        #', Color);
        writeConsole(ID, '#/minig $8 (Give you a Minigun)          #', Color);
        writeConsole(ID, '#/guns 20(Spawn all gun above you)       #', Color);
        writeConsole(ID, '#############END##########################', Color);
      end;
  end;


Title: Re: Can i put that these two script make one ?
Post by: Gizd on April 18, 2010, 03:50:56 am
Code: [Select]
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.
Wall of text so you have to dig to answer like I had to "Reply" button.

Problem is here:
Code: [Select]
   Money[ID] := StrToInt(Copy(Content,0,length(Content)));What's the point of Copy(Content,0,length(Content)) anyway? It's equal to Content.
Title: Re: Can i put that these two script make one ?
Post by: mich1103 on April 18, 2010, 04:49:21 am
So i replace this part by what ?
Title: Re: Can i put that these two script make one ?
Post by: Gizd on April 18, 2010, 05:18:02 am
So i replace this part by what ?
I don't know. Use brain.
Title: Re: Can i put that these two script make one ?
Post by: mich1103 on April 18, 2010, 05:19:50 am
I just want to say that we have try all thing, i think ...

From: April 18, 2010, 05:20:53 am
But can we do it with WriteINI ?
Title: Re: Can i put that these two script make one ?
Post by: dnmr on April 18, 2010, 05:21:45 am
I just want to say that we have try all thing, i think ...

From: April 18, 2010, 05:20:53 am
But can we do it with WriteINI ?
no, you need to do it with UseBrain()
Title: Re: Can i put that these two script make one ?
Post by: mich1103 on April 18, 2010, 05:26:20 am
dont try to get me like the /facepalm command :-\
If you was me wath should you do ?
Title: Re: Can i put that these two script make one ?
Post by: dnmr on April 18, 2010, 05:37:42 am
i would make a standalone application in a different programming language to handle MySQL requests, and make it communicate with the server via the admin interface to store data in a database. But for you, it would probably be best to start out with these two functions:

ReadINI (http://devs.soldat.pl/wiki/index.php?title=ReadINI) and WriteINI (http://forums.soldat.pl/index.php?topic=17651.0)
If you're having problems understanding what INI files are, http://en.wikipedia.org/wiki/INI_file


Edit: replace xsplit with explode by Curt (i think) for more cookies. The script is somewhere on this forum, use your eyes
Title: Re: Can i put that these two script make one ?
Post by: mich1103 on April 18, 2010, 06:01:23 am
I dont understand the Aka split and explode !!!
Title: Re: Can i put that these two script make one ?
Post by: dnmr on April 18, 2010, 06:03:36 am
I dont understand the Aka split and explode !!!
what exactly do you not understand about them?
Title: Re: Can i put that these two script make one ?
Post by: mich1103 on April 18, 2010, 06:06:55 am
First, i need to use WriteINI and ReadINI ?
Second, Aka split and explode is what a script ?
Title: Re: Can i put that these two script make one ?
Post by: dnmr on April 18, 2010, 06:46:02 am
(http://www.totalleh.com/beta452.gif)


i give up
Title: Re: Can i put that these two script make one ?
Post by: mich1103 on April 18, 2010, 06:50:00 am
I just want to know WTF is aka split and explode
Title: Re: Can i put that these two script make one ?
Post by: dnmr on April 18, 2010, 06:53:50 am
use the god dam search function

http://forums.soldat.pl/index.php?topic=35698.0
Title: Re: Can i put that these two script make one ?
Post by: mich1103 on April 18, 2010, 07:07:27 am
Ok so ... This function is supposed to do what ?
Title: Re: Can i put that these two script make one ?
Post by: dnmr on April 18, 2010, 07:44:16 am
Ok so ... This function is supposed to do what ?
split a string into an array of strings. For example you can feed it a sentense and make it split it in words (using space as the delimiter), or feed it a file which has #13#10 as line breaks and the function will split it in lines
Title: Re: Can i put that these two script make one ?
Post by: mich1103 on April 18, 2010, 08:52:07 am
Can u help me with this script ?
1-Im not native enlgish so i dont understand all ...
2-i clearly dont understand the split ...
Title: Re: Can i put that these two script make one ?
Post by: DorkeyDear on April 18, 2010, 11:40:18 am
aka means "also know as"
split is a function
explode is a function
they do the same thing
they can make a string such as 'this is a test' turn into an array ['this', 'is', 'a', 'test']
Title: Re: Can i put that these two script make one ?
Post by: mich1103 on April 18, 2010, 12:09:16 pm
I give up...  :'(  :'(  :(  >:( 
anyway i have another question ...
How to put a drawtext all the time ?

From: April 18, 2010, 12:12:08 pm
Another problem ...
Error
Code: [Select]
10-04-18 13:07:56  [*] asd -> [Error] (76:1): 'BEGIN' expected
The script
Code: [Select]
const
Color = $FF00FF00; //Color to be used.
psgpowa = 1;
psgtype = 14;
psgrang = 666;
psgspee = 75;
maxpsg = 5;
psgammo = 60; //took the liberty to invent it, since it was missing.

var
  pname: string;
  money: array[1..32] of integer;
  statcost:integer;
  giveid:integer;
  psgcost:integer;
  merccost:integer;
  asd : string; 
  give,ammount,player:string;
  sgx,sgy:array[1..maxpsg] of single;
  sga,sgo,sgt:array[1..maxpsg] of byte;
  sgd:array[1..maxpsg] of boolean;
  invcost,medcost,nadecost,flamecost,vestcost,serkcost,clustcost,powercost,eaglecost: integer;
  mp5cost,ak47cost,augcost,spascost,rugecost,m79cost,barrcost,minimcost,minigcost, allcost: integer;
 

procedure placesentry(x,y:single;ID,team:byte);
var n,f:byte;
begin
if getplayerstat(ID,'Ground')=true then begin
f:=maxpsg;
for n:=1 to maxpsg do begin
if sgd[n]=true then f:=f-1;
end;
if f=0 then DrawText(ID,'Maximum of '+inttostr(maxpsg)+' sentry guns on map reached.',250,RGB(0,255,0),0.10,150,400) else begin
for n:=1 to maxpsg do begin
if sgd[n]=false then break;
end;
sgx[n]:=x; sgy[n]:=y; sgo[n]:=ID; sgt[n]:=team; sga[n]:=psgammo; sgd[n]:=true;
DrawText(ID,'Sentry gun placed!',250,RGB(0,255,0),0.1,75,350);
end;
end else DrawText(ID,'You are in mid-air!',250,RGB(0,255,0),0.10,220,400);
end;
 
 
 
procedure ActivateServer();
  begin
    statcost        := 25;
    psgcost         := 30;
    merccost        := 20;
    invcost         := 6;
    medcost         := 5;
    nadecost        := 5;
    flamecost       := 10;
    vestcost        := 5;
    serkcost        := 6;
    clustcost       := 5;
    powercost       := 17;
    eaglecost       := 7;
    mp5cost         := 8;
    ak47cost        := 9;
    augcost         := 8;
    spascost        := 9;
    rugecost        := 7;
    m79cost         := 9;
    barrcost        := 11;
    minimcost       := 8;
    minigcost       := 8;
    allcost         := 20;
  end;




procedureOnJoinGame(ID, Team: byte);   
begin 
   writeConsole(ID, 'Your Money is: $' + inttostr(money[ID]),Color);
    writeConsole(ID, 'Do /shop to see the shop, do /money to see your money !' + inttostr(money[ID]), Color);
  ifFileExists('scripts/shop/'+ GetPlayerStat(ID,'name') + '.txt') then begin 
asd := ReadFile('scripts/shop/'+ GetPlayerStat(ID,'name') + '.txt'); 
  money[ID] := StrToInt(Copy(asd,0,length(asd)-2)); 
 endelsemoney[ID] := 0 
end; 
end;







procedure OnPlayerKill(Killer, Victim: byte;Weapon: string);
  begin
    if Killer = Victim then
      begin
         writeConsole(Killer, 'you cant kill yourself for money !', Color);
      end else
      begin
        money[Killer] := money[Killer]+1;
        writeConsole(Killer, 'You just got $1 your money is now: $' + inttostr(money[Killer]), Color);
      end;
  end;




function OnPlayerCommand(ID: Byte; Text: string): boolean;
  begin



  give := GetPiece(LowerCase(Text), ' ', 0);
  ammount := GetPiece(LowerCase(Text), ' ', 1);
  player := GetPiece(Text, ' ', 2);
  if give = '/give' then
    begin
      if money[ID] > strtoint(ammount) then
        begin
          giveid := NameToID(player);

          if giveid > 0 then
            begin
              money[ID] := money[ID] - strtoint(ammount);
              money[giveid] := money[giveid] + strtoint(ammount);
              writeconsole(ID, 'You gave $' + ammount + ' to: ' + IDToName(giveid) + ', Your money is now: $' + inttostr(money[ID]) , Color);
              writeconsole(giveid, 'You recived $' + ammount + ' from: ' + IDToName(ID) + ', Your money is now: $' + inttostr(money[giveid]), Color);
            end else
              begin
                writeconsole(ID, 'That person does not exist.', Color);
              end;

        end else
        begin
          writeconsole(ID, 'You don''t have enough money', Color);
        end;

    end;







    if regExpMatch('^/(money|moneys)$', Text) then
      begin
        writeConsole(ID, 'Your money is: $' + inttostr(money[ID]), Color);
     end;



    if regExpMatch('^/(commands|shop|spawn|help)$', Text) then
      begin
        writeConsole(ID, '#############SHOP#########################', Color);
        writeConsole(ID, '#commands:                               #', Color);
        writeConsole(ID, '#/stat $25 (spawn a turret)              #', Color);
        writeConsole(ID, '#/psg $30 (Spawn a sentry gun)           #', Color);
        writeConsole(ID, '#/merc $20 (Spawn a mercenary)           #', Color);
        writeConsole(ID, '#/inv  $6 (Give you the invisibility)    #', Color);
        writeConsole(ID, '#/med $5 (Give you a medic kit)          #', Color);
        writeConsole(ID, '#/nade $5 (Give to you some nade)        #', Color);
        writeConsole(ID, '#/flame $10 (Give you a flamer)          #', Color);
        writeConsole(ID, '#/vest $5 (Give you a Bullet proof)      #', Color);
        writeConsole(ID, '#/serk $6 (Give you the RAGE !!!)        #', Color);
        writeConsole(ID, '#/clust $5 (Give you some cluster)       #', Color);
        writeConsole(ID, '#/power $17 (Spawn all bonus above you)  #', Color);
        writeConsole(ID, '#/eagle $7 (Give you a Desert Eagle)     #', Color);
        writeConsole(ID, '#/mp5 $8 (Give you a Hk mp5)             #', Color);
        writeConsole(ID, '#/ak47 $9 (Give you a Ak 47)             #', Color);
        writeConsole(ID, '#/aug $8 (Give you a Steyr AUG)          #', Color);
        writeConsole(ID, '#/spas $9 (Give you a spas 12)           #', Color);
        writeConsole(ID, '#/ruge $7 (Give you a Ruger)             #', Color);
        writeConsole(ID, '#/m79 $9 (Give you a m79)                #', Color);
        writeConsole(ID, '#/barr $11 (Give you a Barret)           #', Color);
        writeConsole(ID, '#/minim $8 (Give you a FN minimi)        #', Color);
        writeConsole(ID, '#/minig $8 (Give you a Minigun)          #', Color);
        writeConsole(ID, '#/guns 20(Spawn all gun above you)       #', Color);
        writeConsole(ID, '#############END##########################', Color);
      end;





if regExpMatch('^/(stationary|stat|turrent)$', Text) then
  begin
      if money[ID] >= statcost then
        begin
          money[ID] := money[ID] - statcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,15);
          writeconsole(ID, 'You bought a Stat Gun for $25, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color);
      end;
  end;
  result := false;






if regExpMatch('^/(psg)$', Text) then begin
      if money[ID] >= psgcost then begin
          money[ID] := money[ID] - psgcost;
         placesentry(getplayerstat(ID,'x'),getplayerstat(ID,'y'),ID,getplayerstat(ID,'team'));
          writeconsole(ID, 'You bought a Sentry Gun for $30, you have $' + inttostr(money[ID]), Color);
        end else begin writeconsole(ID, 'You do not have enough money', Color);
    end;
end;




if regExpMatch('^/(merc)$', Text) then
  begin
      if money[ID] >= merccost then
        begin
          money[ID] := money[ID] - merccost;
          Command('/addbot1 mercenary');
          writeconsole(ID, 'Youve engage a mercenary for $20, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color);
      end;
  end;

  if regExpMatch('^/(desert eagles|eagle|deagles|deserteagles)$', Text) then
    begin
      if money[ID] >= eaglecost then
        begin
          money[ID] := money[ID] - eaglecost;
          forceWeapon(ID,1,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought deagles for $7, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(hkmp5|mp5|hk)$', Text) then
    begin
      if money[ID] >= mp5cost then
        begin
          money[ID] := money[ID] - mp5cost;
          forceWeapon(ID,2,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a HK MP5 for $8, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(ak47)$', Text) then
    begin
      if money[ID] >= ak47cost then
        begin
          money[ID] := money[ID] - ak47cost;
          forceWeapon(ID,3,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a AK47 for $9, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(steyr|aug)$', Text) then
    begin
      if money[ID] >= augcost then
        begin
          money[ID] := money[ID] - augcost;
          forceWeapon(ID,4,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a Steyr Aug for $8, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(spas 12|spas|spas12)$', Text) then
    begin
      if money[ID] >= spascost then
        begin
          money[ID] := money[ID] - spascost;
          forceWeapon(ID,5,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a SPAS12 for $9, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(ruger|ruge|ruger77)$', Text) then
    begin
      if money[ID] >= rugecost then
        begin
          money[ID] := money[ID] - rugecost;
          forceWeapon(ID,6,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a Ruger for $7, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(m79)$', Text) then
    begin
      if money[ID] >= m79cost then
        begin
          money[ID] := money[ID] - m79cost;
          forceWeapon(ID,7,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a M79 for $9, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(barreta|barr|barrett m82a1|barret|barret m)$', Text) then
    begin
      if money[ID] >= barrcost then
        begin
          money[ID] := money[ID] - barrcost;
          forceWeapon(ID,8,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a Barreta for $11, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(fn minimi|minim|fn)$', Text) then
    begin
      if money[ID] >= minimcost then
        begin
          money[ID] := money[ID] - minimcost;
          forceWeapon(ID,9,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a FN Minimi for $8, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(minigun|minig)$', Text) then
    begin
      if money[ID] >= minigcost then
        begin
          money[ID] := money[ID] - minigcost;
          forceWeapon(ID,10,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a Minigun for $8, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;


  if regExpMatch('^/(medic|med|health|med pack)$', Text) then
    begin
      if money[ID] >= medcost then
        begin
          money[ID] := money[ID] - medcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,16);
          writeconsole(ID, 'You bought a Medkit for $5, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(grenade|nade)$', Text) then
    begin
      if money[ID] >= nadecost then
        begin
          money[ID] := money[ID] - nadecost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,17);
          writeconsole(ID, 'You bought some Grenades for $5, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(cluster|clust|clustergrandes|clusternades|clustnades)$', Text) then
    begin
      if money[ID] >= clustcost then
        begin
          money[ID] := money[ID] - clustcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,22);
          writeconsole(ID, 'You bought some Cluster Greanades for $5, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(armor|vest|bulletproofvest)$', Text) then
    begin
      if money[ID] >= vestcost then
        begin
          money[ID] := money[ID] - vestcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,19);
          writeconsole(ID, 'You bought a Bullet Proof Vest for $5, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;


  if regExpMatch('^/(boxes|power|box)$', Text) then
    begin
      if money[ID] >= powercost then
        begin
          money[ID] := money[ID] - powercost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,16);
          SpawnObject(GetPlayerStat(ID,'x')+30,GetPlayerStat(ID,'y')-20,17);
          SpawnObject(GetPlayerStat(ID,'x')+40,GetPlayerStat(ID,'y')-20,18);
          SpawnObject(GetPlayerStat(ID,'x')+50,GetPlayerStat(ID,'y')-20,19);
          SpawnObject(GetPlayerStat(ID,'x')+60,GetPlayerStat(ID,'y')-20,20);
          SpawnObject(GetPlayerStat(ID,'x')+70,GetPlayerStat(ID,'y')-20,21);
          SpawnObject(GetPlayerStat(ID,'x')+80,GetPlayerStat(ID,'y')-20,22);
          writeconsole(ID, 'You bought all Powerups for $17, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(preditor|inv|invisible)$', Text) then
    begin
      if money[ID] >= invcost then
        begin
          money[ID] := money[ID] - invcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,20);
          writeconsole(ID, 'You bought a Preditor Box for $6, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(flame god|flame|flamegodmode|flame god mode)$', Text) then
    begin
      if money[ID] >= flamecost then
        begin
          money[ID] := money[ID] - flamecost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,18);
          writeconsole(ID, 'You bought a Flame God Box for $10, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(berseker|serk)$', Text) then
    begin
      if money[ID] >= serkcost then
        begin
          money[ID] := money[ID] - serkcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,21);
          writeconsole(ID, 'You bought a Berseker Box for $6, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;



if regExpMatch('^/(gunz|guns|weapons|weaps|weps)$', Text) then
    begin
      if money[ID] >= allcost then
        begin
          money[ID] := money[ID] - allcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,1);
          SpawnObject(GetPlayerStat(ID,'x')+30,GetPlayerStat(ID,'y')-20,2);
          SpawnObject(GetPlayerStat(ID,'x')+40,GetPlayerStat(ID,'y')-20,3);
          SpawnObject(GetPlayerStat(ID,'x')+50,GetPlayerStat(ID,'y')-20,4);
          SpawnObject(GetPlayerStat(ID,'x')+60,GetPlayerStat(ID,'y')-20,5);
          SpawnObject(GetPlayerStat(ID,'x')+70,GetPlayerStat(ID,'y')-20,6);
          SpawnObject(GetPlayerStat(ID,'x')+80,GetPlayerStat(ID,'y')-20,7);
          SpawnObject(GetPlayerStat(ID,'x')-20,GetPlayerStat(ID,'y')-20,8);
          SpawnObject(GetPlayerStat(ID,'x')-30,GetPlayerStat(ID,'y')-20,9);
          SpawnObject(GetPlayerStat(ID,'x')-40,GetPlayerStat(ID,'y')-20,10);
          SpawnObject(GetPlayerStat(ID,'x')-50,GetPlayerStat(ID,'y')-20,11);
          SpawnObject(GetPlayerStat(ID,'x')-60,GetPlayerStat(ID,'y')-20,12);
          SpawnObject(GetPlayerStat(ID,'x')-70,GetPlayerStat(ID,'y')-20,13);
          SpawnObject(GetPlayerStat(ID,'x')-80,GetPlayerStat(ID,'y')-20,14);
          writeconsole(ID, 'You bought all Weapon for $20, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color);
   end;

end;
end;

procedure OnMapChange(newmap:string);
var n:byte;
begin
for n:=1 to maxpsg do begin sgd[n]:=false; end;
end;

procedure OnLeaveGame(ID,team:byte;kicked:boolean);
var n:byte;
begin
for n:=1 to maxpsg do
begin if sgo[n]=ID then sgd[n]:= false;
end;
WriteFile('scripts/shop/'+ GetPlayerStat(ID,'name') + '.txt',IntToStr(money[ID])); 
end;




Procedure AppOnIdle(Ticks: Integer);
 Var N, K: Byte;
  X, Y, Dista: Single;
   Begin
    For N := 1 To maxpsg Do Begin
     if sgd[n] = True Then Begin
      CreateBullet(sgx[n],sgy[n],0,0,0,5,sgo[n]);
       For K := 1 To 32 Do Begin
        GetPlayerXy(K,X,Y);
         if GetPlayerStat(K,'Team') <> sgt[n] Then if GetPlayerStat(K,'Alive') = True Then if RayCast(sgx[n],sgy[n],x,y,dista,psgrang) = True Then if dista <= psgrang Then Begin
          x := ((x-sgx[n]) / dista)*psgspee;
         y := ((y-sgy[n]) / dista)*psgspee;
          CreateBullet(sgx[n],sgy[n],x,y,psgpowa,psgtype,sgo[n]); sga[n]:=sga[n]-1;
         if sga[n] = 0 Then Begin
      sgd[n] := false;
      Writeconsole(sgo[n],'One of your sentry guns ran out of ammo.',$0000FF00);
     end;
     Break;
    end;
   end;
  end;
 end;
end;

procedure OnPlayerSpeak(ID:Byte;Text:String);
begin
if (Text='!money')
      then begin
        writeConsole(ID, 'Your money is: $' + inttostr(money[ID]), Color);
     end;



if(Text='!shop')
      then begin
        writeConsole(ID, '#############SHOP#########################', Color);
        writeConsole(ID, '#commands:                               #', Color);
        writeConsole(ID, '#/stat $25 (spawn a turret)              #', Color);
        writeConsole(ID, '#/psg $30 (Spawn a sentry gun)           #', Color);
        writeConsole(ID, '#/merc $20 (Spawn a mercenary)           #', Color);
        writeConsole(ID, '#/inv  $6 (Give you the invisibility)    #', Color);
        writeConsole(ID, '#/med $5 (Give you a medic kit)          #', Color);
        writeConsole(ID, '#/nade $5 (Give to you some nade)        #', Color);
        writeConsole(ID, '#/flame $10 (Give you a flamer)          #', Color);
        writeConsole(ID, '#/vest $5 (Give you a Bullet proof)      #', Color);
        writeConsole(ID, '#/serk $6 (Give you the RAGE !!!)        #', Color);
        writeConsole(ID, '#/clust $5 (Give you some cluster)       #', Color);
        writeConsole(ID, '#/power $17 (Spawn all bonus above you)  #', Color);
        writeConsole(ID, '#/eagle $7 (Give you a Desert Eagle)     #', Color);
        writeConsole(ID, '#/mp5 $8 (Give you a Hk mp5)             #', Color);
        writeConsole(ID, '#/ak47 $9 (Give you a Ak 47)             #', Color);
        writeConsole(ID, '#/aug $8 (Give you a Steyr AUG)          #', Color);
        writeConsole(ID, '#/spas $9 (Give you a spas 12)           #', Color);
        writeConsole(ID, '#/ruge $7 (Give you a Ruger)             #', Color);
        writeConsole(ID, '#/m79 $9 (Give you a m79)                #', Color);
        writeConsole(ID, '#/barr $11 (Give you a Barret)           #', Color);
        writeConsole(ID, '#/minim $8 (Give you a FN minimi)        #', Color);
        writeConsole(ID, '#/minig $8 (Give you a Minigun)          #', Color);
        writeConsole(ID, '#/guns 20(Spawn all gun above you)       #', Color);
        writeConsole(ID, '#############END##########################', Color);
      end;
  end;

Title: Re: Can i put that these two script make one ?
Post by: DarkCrusade on April 18, 2010, 12:50:15 pm
You need to delete one end;

Just count begins and ends and you´ll be fine in the future.
Title: Re: Can i put that these two script make one ?
Post by: mich1103 on April 18, 2010, 12:59:06 pm
Which end; i delete ?

From: April 18, 2010, 01:22:52 pm
I have a deal !
i give a server host if someone help me with the sava/load script !
Title: Re: Can i put that these two script make one ?
Post by: DarkCrusade on April 18, 2010, 01:29:36 pm
I won´t count till line 75 and delete the next end that I see
Title: Re: Can i put that these two script make one ?
Post by: mich1103 on April 18, 2010, 02:16:05 pm
YEAHHHHHHHHHHHHHHHHHHHHH!
Sorry but now im so happy !!!
Thanks all !
I find the way to do my save/load system and thats work !!!
So i procede with that

OnJoinTeam
Code: [Select]
procedure OnJoinGame(ID, Team: byte);

var
   asd : string;

  begin
    writeConsole(ID, 'Your Money is: $' + inttostr(money[ID]),Color);
    writeConsole(ID, 'Do /shop to see the shop, do /money to see your money !' + inttostr(money[ID]), Color);
if FileExists('scripts/shop/'+ GetPlayerStat(ID,'name') + '.txt') then begin 
asd := ReadFile('scripts/shop/'+ GetPlayerStat(ID,'name') + '.txt'); 
  money[ID] := StrToInt(Copy(asd,0,length(asd)-2)); 
 end else money[ID] := 0 
end; 

OnLeaveGame
Code: [Select]
WriteFile('scripts/shop/'+ GetPlayerStat(ID,'name') + '.txt',IntToStr(money[ID])); 
But now i have a problem !!!
Some people have some invelid character like /\| and other ...
how i include this part of script with my script that i have now ?

The part of script
Code: [Select]
function FilterFilename(const filename: string):string;
var
   i,len: byte;
   c: string;
begin
   len := length(filename);
   result := '';
   for i := 1 to len do begin
      c := copy(filename,i,1);
      if (c=chr(92)) or (c='/') or (c=':') or (c='*') or (c='?') or (c='"') or (c='<') or (c='>') or (c='|') then
         result := result + '_'
      else
         result := result + c;
      end;
   result := LowerCase(result);
end;
Title: Re: Can i put that these two script make one ?
Post by: Gizd on April 19, 2010, 09:27:49 am
STOP F****** PASTING WHOLE F***** CODE INTO THE F***** POST PLEASE

Use damn logic, that func makes string good for a filename, so instead of IDToName(ID) you put FilterFilename(IDToName(ID))
YES, you need to paste that code into your script. Imagine that someone wants you to make a cake and gives you nothing to make it of, that's how script without that feels.