Author Topic: Script help :-(  (Read 4273 times)

0 Members and 1 Guest are viewing this topic.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Script help :-(
« on: April 05, 2010, 04:23:09 pm »
Hmmmm
http://forums.soldat.pl/index.php?topic=32267.0
this is weapon shop by Corl45
i just want that player are able to buy only the MG2 stat not the other gun !
do i need to modify the var ?
So ... this is suposed to be like that ?
Code: [Select]

var
  pname: string;
  money: array[1..32] of integer;
  statcost: integer;
  giveid:integer;
  give,ammount,player:string;

procedure ActivateServer();
  begin
    statcost        := 2000;
  end;


procedure OnJoinGame(ID, Team: byte);
  begin
    money[ID] := 50;
    writeConsole(ID, 'Your Money is: $' + inttostr(money[ID]), RGB(0,255,255));
    writeConsole(ID, 'This server is running Weapon_Shop by: Corl45' + inttostr(money[ID]), RGB(0,255,255));
    writeConsole(ID, 'Type /shop for shop and /money for your money.' + inttostr(money[ID]), RGB(0,255,255));
  end;

procedure OnPlayerKill(Killer, Victim: byte;Weapon: string);
  begin
    if Killer = Victim then
      begin
         writeConsole(Killer, 'you cant kill yourself for money you silly bear', RGB(0, 255, 255));
      end else
      begin
        money[Killer] := money[Killer]+100;
        writeConsole(Killer, 'You just got $100 your money is now: $' + inttostr(money[Killer]), RGB(0, 255, 255));
      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]) , RGB(0,255,255));
              writeconsole(giveid, 'You recived $' + ammount + ' from: ' + IDToName(ID) + ', Your money is now: $' + inttostr(money[giveid]), RGB(0,255,255));
            end else
              begin
                writeconsole(ID, 'That person does not exist.', RGB(0,255,255));
              end;

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

    end;







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



    if regExpMatch('^/(commands|shop|spawn|help)$', Text) then
      begin
        writeConsole(ID, '-----Weapon Costs------', $0099CC00);
        writeConsole(ID, 'commands:', $0099CC00);
        writeConsole(ID, '/stat-Turret $2000', RGB(255,0,0));
        writeConsole(ID, '-------------END----------------', RGB(255,0,0));
      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 $2000, you have $' + inttostr(money[ID]), RGB(0,255,255));

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



Offline squiddy

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 333
  • Flagger assassin
    • SoldatX
Re: Script help :-(
« Reply #1 on: April 05, 2010, 05:04:20 pm »
It seems to be working fine for me.. Although, you missed an "End;" at the end. How ironic. Try this one.

Code: [Select]
var
  pname: string;
  money: array[1..32] of integer;
  statcost: integer;
  giveid:integer;
  give,ammount,player:string;

procedure ActivateServer();
  begin
    statcost        := 2000;
  end;


procedure OnJoinGame(ID, Team: byte);
  begin
    money[ID] := 50;
    writeConsole(ID, 'Your Money is: $' + inttostr(money[ID]), RGB(0,255,255));
    writeConsole(ID, 'This server is running Weapon_Shop by: Corl45' + inttostr(money[ID]), RGB(0,255,255));
    writeConsole(ID, 'Type /shop for shop and /money for your money.' + inttostr(money[ID]), RGB(0,255,255));
  end;

procedure OnPlayerKill(Killer, Victim: byte;Weapon: string);
  begin
    if Killer = Victim then
      begin
         writeConsole(Killer, 'you cant kill yourself for money you silly bear', RGB(0, 255, 255));
      end else
      begin
        money[Killer] := money[Killer]+100;
        writeConsole(Killer, 'You just got $100 your money is now: $' + inttostr(money[Killer]), RGB(0, 255, 255));
      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]) , RGB(0,255,255));
              writeconsole(giveid, 'You recived $' + ammount + ' from: ' + IDToName(ID) + ', Your money is now: $' + inttostr(money[giveid]), RGB(0,255,255));
            end else
              begin
                writeconsole(ID, 'That person does not exist.', RGB(0,255,255));
              end;

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

    end;







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



    if regExpMatch('^/(commands|shop|spawn|help)$', Text) then
      begin
        writeConsole(ID, '-----Weapon Costs------', $0099CC00);
        writeConsole(ID, 'commands:', $0099CC00);
        writeConsole(ID, '/stat-Turret $2000', RGB(255,0,0));
        writeConsole(ID, '-------------END----------------', RGB(255,0,0));
      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 $2000, you have $' + inttostr(money[ID]), RGB(0,255,255));

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

Saved a few lines for you.

Hope I helped.
www.soldatx.com.br - The brazilian Soldat community.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script help :-(
« Reply #2 on: April 05, 2010, 05:07:01 pm »
Code: [Select]
10-04-05 18:07:03    Console Log Started
10-04-05 18:07:03 Loaded weapons mod "Default mod v1.5"
10-04-05 18:07:03 Welcome to Soldat 1.5.0
10-04-05 18:07:03  [*] ScriptCore v2.6 loaded! Found 3 scripts...
10-04-05 18:07:03  [*] Compiling loot -> loot.pas...
10-04-05 18:07:03  [*] Compiling rule -> rule.pas...
10-04-05 18:07:03  [*] Compiling Weapon_shop -> Weapon_shop.pas...
10-04-05 18:07:03  [*] Weapon_shop -> [Error] (105:10): Identifier expected
10-04-05 18:07:03  [*] Compilation Failed.
10-04-05 18:07:03 Shutting down server...
10-04-05 18:07:03 Shutting down admin server...
10-04-05 18:07:03 Shutting down ScriptCore...


Offline squiddy

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 333
  • Flagger assassin
    • SoldatX
Re: Script help :-(
« Reply #3 on: April 05, 2010, 05:21:39 pm »
[...] Although, you missed an "End;" at the end. How ironic. Try this one.
[...]

Did you correct the missing End ?

If so, I am so sorry. Have no clue.
www.soldatx.com.br - The brazilian Soldat community.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script help :-(
« Reply #4 on: April 05, 2010, 08:04:39 pm »
Was working but dont work now ive modified some thing !!!
(the color)
(price)
and other thing :P
Code: [Select]
var
  pname: string;
  money: array[1..32] of integer;
  statcost: integer;
  giveid:integer;
  give,ammount,player:string;

procedure ActivateServer();
  begin
    statcost        := 30;
  end;


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

procedure OnPlayerKill(Killer, Victim: byte;Weapon: string);
  begin
    if Killer = Victim then
      begin
         writeConsole(Killer, 'you cant kill yourself for money !', $0099CC00);
      end else
      begin
        money[Killer] := money[Killer]+1;
        writeConsole(Killer, 'You just got $1 your money is now: $' + inttostr(money[Killer]), $0099CC00);
      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]) , $0099CC00);
              writeconsole(giveid, 'You recived $' + ammount + ' from: ' + IDToName(ID) + ', Your money is now: $' + inttostr(money[giveid]), $0099CC00);
            end else
              begin
                writeconsole(ID, 'That person does not exist.', $0099CC00);
              end;

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

    end;







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



    if regExpMatch('^/(commands|shop|spawn|help)$', Text) then
      begin
        writeConsole(ID, '#############SHOP###############', $0099CC00);
        writeConsole(ID, '#commands:                     #', $0099CC00);
        writeConsole(ID, '#/stat-Turret $30              #', $0099CC00);
        writeConsole(ID, '#More will come :P             #', $0099CC00);
        writeConsole(ID, '#############END################', $0099CC00);
      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 $30, you have $' + inttostr(money[ID]), $0099CC00);

        end else begin writeconsole(ID, 'You do not have enough money', RGB(0,255,255)); end;
  end;
end;
The log
Code: [Select]
10-04-05 21:01:22    Console Log Started
10-04-05 21:01:22 Loaded weapons mod "Default mod v1.5"
10-04-05 21:01:22 Welcome to Soldat 1.5.0
10-04-05 21:01:22  [*] ScriptCore v2.6 loaded! Found 3 scripts...
10-04-05 21:01:22  [*] Compiling loot -> loot.pas...
10-04-05 21:01:22  [*] Compiling rule -> rule.pas...
10-04-05 21:01:22  [*] Compiling Weapon_shop -> Weapon_shop.pas...
10-04-05 21:01:22  [*] Weapon_shop -> [Error] (77:78): Identifier expected
10-04-05 21:01:22  [*] Compilation Failed.
10-04-05 21:01:22 Shutting down server...
10-04-05 21:01:22 Shutting down admin server...
10-04-05 21:01:23 Shutting down ScriptCore...

Offline squiddy

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 333
  • Flagger assassin
    • SoldatX
Re: Script help :-(
« Reply #5 on: April 05, 2010, 08:13:44 pm »
You've put "$0099CC00"..

The original format is "$FFFFFF"

Holds 6 "F"s.. You put 8..

Try using this.. I haven't tested it, I don't know if it will work.

Use a Const for all your colors.

In the top of the script, go:

Code: [Select]
Const
Color = $FFFFFF;
(White Color)

It's better than typing everytime the same number.

Well, try this one:

Code: [Select]
const
Color = $0099CC; //Color to be used.


var
  pname: string;
  money: array[1..32] of integer;
  statcost: integer;
  giveid:integer;
  give,ammount,player:string;

procedure ActivateServer();
  begin
    statcost        := 30;
  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-Turret $30              #', Color);
        writeConsole(ID, '#More will come :P             #', 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 $30, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color);
end;
  end;
end;
www.soldatx.com.br - The brazilian Soldat community.

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Script help :-(
« Reply #6 on: April 05, 2010, 08:37:49 pm »
@squiddy - its $AARRGGBB so 8 makes sense. i forget if alpha is enabled for WriteConsole. i know at one point it was for DrawText but latter removed (i think; long time ago i messed with it).

Offline dnmr

  • Camper
  • ***
  • Posts: 315
  • emotionally handicapped
Re: Script help :-(
« Reply #7 on: April 06, 2010, 01:25:46 am »
@squiddy - its $AARRGGBB so 8 makes sense. i forget if alpha is enabled for WriteConsole. i know at one point it was for DrawText but latter removed (i think; long time ago i messed with it).
well, our patient here clearly used 00 for opacity, which makes the text invisible. I hope he understands that one day.

Offline squiddy

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 333
  • Flagger assassin
    • SoldatX
Re: Script help :-(
« Reply #8 on: April 06, 2010, 04:26:26 am »
Quote
Those two answers above

Well, I've always used $FEDEBA; because Fedeba is a funny word :P

I always use 6 Fs.. Never tried on 8.
www.soldatx.com.br - The brazilian Soldat community.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script help :-(
« Reply #9 on: April 06, 2010, 05:31:33 am »
Thats work thanks !!!
now i know that i need to change the var
and that i can put const  to make my script more simple !
I learn more at each day !
 
But now i want to include the sentry gun in the shop i can ?
i want that the player are able to buy sentry gun !
Code: [Select]
// Portable Sentry Gun Script
// by Super Vegeta
// super_vegeta@wp.pl
// www.svgames.prv.pl
// v.1.0 - 16.11.2008

const psgammo = 50;    //psg ammo
const psgpowa = 1;      //psg power
const psgtype = 14;      //psg bullet type
const psgrang = 666;    //psg range
const psgspee = 50;     //psg bullet speed
const maxpsg = 5;      //max psgs on map

var sgx,sgy:array[1..maxpsg] of single;
var sga,sgo,sgt:array[1..maxpsg] of byte;
var sgd:array[1..maxpsg] of boolean;

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; var 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]) and (getplayerstat(k,'alive')=true) and (raycast(sgx[n],sgy[n],x,y,dista,psgrang)=true) and (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 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;

function OnPlayerCommand(ID:byte;text:string):boolean;
begin
text:=lowercase(text);
if text='/psg' then placesentry(getplayerstat(ID,'x'),getplayerstat(ID,'y'),ID,getplayerstat(ID,'team'));
result:=false;
end;
« Last Edit: April 06, 2010, 06:14:06 am by mich1103 »

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Script help :-(
« Reply #10 on: April 06, 2010, 07:14:05 am »
Yeah.. I never really understood why 6 worked, but my best guess (too lazy to test) was because alpha was simply disabled and was $FF no matter what the first 2 hex values were for the things I ever tried 6 with, but I always use 8 just in case.

Offline SpiltCoffee

  • Veteran
  • *****
  • Posts: 1579
  • Spilt, not Split!
    • SpiltCoffee's Site
Re: Script help :-(
« Reply #11 on: April 06, 2010, 08:27:28 am »
Color = UInt32 (usually)
UInt32  = Unsigned 32 bit Integer (range: 0 - 4294967295)
4294967295 (decimal) = $FFFFFFFF (hex)

Moral of the story: Always use 8. It just makes sense!
When life hands you High Fructose Corn Syrup, Citric Acid, Ascorbic Acid, Maltodextrin, Sodium Acid Pyrophosphate,
Magnesium Oxide, Calcium Fumarate, Yellow 5, Tocopherol and Less Than 2% Natural Flavour... make Lemonade!

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script help :-(
« Reply #12 on: April 06, 2010, 09:42:23 am »
Anyone now why thats dont work ?
Code: [Select]
const
Color = $0099CC; //Color to be used.


var
  pname: string;
  money: array[1..32] of integer;
  statcost:integer;
  helpcost:integer;
  giveid:integer;
  give,ammount,player:string;

procedure ActivateServer();
  begin
    statcost        := 30;
    helpcost        := 20;
  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-Turret $30(spawn a turret)   #', Color);
        writeConsole(ID, '#/merc-helper $20(Spawn a mercenary)#', Color);
        writeConsole(ID, '#More will come :P                  #', 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 $30, you have $' + inttostr(money[ID]), Color);

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





if regExpMatch('^/(help|merc|mercenary)$', Text) then
  begin
      if money[ID] >= helpcost then
        begin
          money[ID] := money[ID] - helpcost;
          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;
end;





Code: [Select]
10-04-06 10:40:43    Console Log Started
10-04-06 10:40:43 Loaded weapons mod "Default mod v1.5"
10-04-06 10:40:43 Welcome to Soldat 1.5.0
10-04-06 10:40:43  [*] ScriptCore v2.6 loaded! Found 3 scripts...
10-04-06 10:40:43  [*] Compiling loot -> loot.pas...
10-04-06 10:40:43  [*] Compiling rule -> rule.pas...
10-04-06 10:40:43  [*] Compiling Weapon_shop -> Weapon_shop.pas...
10-04-06 10:40:43  [*] Weapon_shop -> [Hint] (43:10): Variable 'Result' never used
10-04-06 10:40:43  [*] Weapon_shop -> [Error] (119:1): 'BEGIN' expected
10-04-06 10:40:43  [*] Compilation Failed.
10-04-06 10:40:43 Shutting down server...
10-04-06 10:40:43 Shutting down admin server...
10-04-06 10:40:43 Shutting down ScriptCore...

Offline squiddy

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 333
  • Flagger assassin
    • SoldatX
Re: Script help :-(
« Reply #13 on: April 06, 2010, 12:00:26 pm »
You have an extra "end;" at the end. Delete it and it should be fine.

Btw, you don't have to create a Const for each constant of yours.

For instance: DONT DO THIS:
Code: [Select]
const psgpowa = 1;      //psg power
const psgtype = 14;      //psg bullet type
const psgrang = 666;    //psg range
const psgspee = 50;     //psg bullet speed
const maxpsg = 5;      //max psgs on map

DO THIS:
Code: [Select]
const
psgpowa = 1;
psgtype = 14;
psgrang = 666;
psgspee = 50;
maxpsg = 5;

Any more questions, feel free to ask.
www.soldatx.com.br - The brazilian Soldat community.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script help :-(
« Reply #14 on: April 06, 2010, 12:14:19 pm »
Code: [Select]
const
Color = $0099CC; //Color to be used.
psgpowa = 1;
psgtype = 14;
psgrang = 666;
psgspee = 50;
maxpsg = 5;

var
  pname: string;
  money: array[1..32] of integer;
  statcost:integer;
  giveid:integer;
  psgcost: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;

procedure ActivateServer();
  begin
    statcost        := 30;
    psgcost        := 35;
  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-Turret $30(spawn a turret)   #', Color);
        writeConsole(ID, '#/psg $35(Spawn a sentry gun)       #', Color);
        writeConsole(ID, '#More will come :P                  #', 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 $30, you have $' + inttostr(money[ID]), Color);

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





if regExpMatch('^/(psg)$', Text) then
  begin
      if money[ID] >= psgcost then
        begin
          money[ID] := money[ID] - psgcost;
          Command('/addbot1 mercenary')
          writeconsole(ID, 'You bought a Sentry Gun for $35, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color);
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; var 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]) and (getplayerstat(k,'alive')=true) and (raycast(sgx[n],sgy[n],x,y,dista,psgrang)=true) and (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 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;

function OnPlayerCommand(ID:byte;text:string):boolean;
begin
text:=lowercase(text);
if text='/psg' then placesentry(getplayerstat(ID,'x'),getplayerstat(ID,'y'),ID,getplayerstat(ID,'team'));
result:=false;
end;

Dont work more ...


Code: [Select]
10-04-06 13:13:40    Console Log Started
10-04-06 13:13:40 Loaded weapons mod "Default mod v1.5"
10-04-06 13:13:40 Welcome to Soldat 1.5.0
10-04-06 13:13:40  [*] ScriptCore v2.6 loaded! Found 3 scripts...
10-04-06 13:13:40  [*] Compiling loot -> loot.pas...
10-04-06 13:13:40  [*] Compiling rule -> rule.pas...
10-04-06 13:13:40  [*] Compiling Weapon_shop -> Weapon_shop.pas...
10-04-06 13:13:40  [*] Weapon_shop -> [Hint] (50:10): Variable 'Result' never used
10-04-06 13:13:40  [*] Weapon_shop -> [Error] (126:1): 'BEGIN' expected
10-04-06 13:13:40  [*] Compilation Failed.
10-04-06 13:13:40 Shutting down server...
10-04-06 13:13:40 Shutting down admin server...
10-04-06 13:13:40 Shutting down ScriptCore...

Offline freestyler

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 326
Re: Script help :-(
« Reply #15 on: April 06, 2010, 12:48:57 pm »
Download Notepad++ and make use of its syntax folding - it'll help you solve begin/end problems.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script help :-(
« Reply #16 on: April 06, 2010, 12:50:12 pm »
wath i download in this site :/

Offline squiddy

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 333
  • Flagger assassin
    • SoldatX
Re: Script help :-(
« Reply #17 on: April 06, 2010, 01:03:15 pm »
Okay, I think I made it work.

The rest of the script is up to you.

Although, don't EVER forget one thing:

The build of a script is like this:

- Author Stuff (Made by: Mich)
- Consts (psgpowa, psgtype...)
- Types (you haven't used any)
- Vars (pname, money..)
- Custom funcs (placesentry, functions you created)
- Built-in funcs (onplayercommand, functions that already exist)

If you change the order, it will cause script crashes.

Placesentry(); was at the very end, and you had two OnPlayerCommands.

Make sure to not make the same mistake again, in the future :]

This should work:

Code: [Select]
const
Color = $0099CC; //Color to be used.
psgpowa = 1;
psgtype = 14;
psgrang = 666;
psgspee = 50;
maxpsg = 5;
psgammo = 10; //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;
  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;

 

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        := 30;
    psgcost        := 35;
  end;


procedure OnJoinGame(ID, Team: byte);
  begin
    money[ID] := 35;
    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-Turret $30(spawn a turret)   #', Color);
        writeConsole(ID, '#/psg $35(Spawn a sentry gun)       #', Color);
        writeConsole(ID, '#More will come :P                  #', 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 $30, 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 $35, 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]) and (getplayerstat(k,'alive')=true) and (raycast(sgx[n],sgy[n],x,y,dista,psgrang)=true) and (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;
« Last Edit: April 06, 2010, 01:05:10 pm by squiddy »
www.soldatx.com.br - The brazilian Soldat community.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script help :-(
« Reply #18 on: April 06, 2010, 01:08:16 pm »
Code: [Select]
10-04-06 14:07:58    Console Log Started
10-04-06 14:07:58 Loaded weapons mod "Default mod v1.5"
10-04-06 14:07:58 Welcome to Soldat 1.5.0
10-04-06 14:07:58  [*] ScriptCore v2.6 loaded! Found 3 scripts...
10-04-06 14:07:58  [*] Compiling loot -> loot.pas...
10-04-06 14:07:58  [*] Compiling rule -> rule.pas...
10-04-06 14:07:58  [*] Compiling Weapon_shop -> Weapon_shop.pas...
10-04-06 14:07:58  [*] Weapon_shop -> [Error] (175:9): Identifier expected
10-04-06 14:07:58  [*] Weapon_shop -> [Error] (175:10): colon (':') expected
10-04-06 14:07:58  [*] Compilation Failed.
10-04-06 14:07:58 Shutting down server...
10-04-06 14:07:58 Shutting down admin server...
10-04-06 14:07:58 Shutting down ScriptCore...


 :(  :'(  :-\

Offline squiddy

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 333
  • Flagger assassin
    • SoldatX
Re: Script help :-(
« Reply #19 on: April 06, 2010, 01:16:32 pm »
I forgot to erase one "," at the line 174.

Try to make your script the "readable" as its possible. It's just terrible to see every line starting in the same column and with no capital letters.

Replace the full AppOnIdle(); for this:

Code: [Select]
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;
www.soldatx.com.br - The brazilian Soldat community.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script help :-(
« Reply #20 on: April 06, 2010, 01:56:47 pm »
Hmmm wath is wrong with wath i added ?
Code: [Select]
10-04-06 14:53:16    Console Log Started
10-04-06 14:53:16 Loaded weapons mod "Default mod v1.5"
10-04-06 14:53:16 Welcome to Soldat 1.5.0
10-04-06 14:53:16  [*] ScriptCore v2.6 loaded! Found 3 scripts...
10-04-06 14:53:16  [*] Compiling loot -> loot.pas...
10-04-06 14:53:16  [*] Compiling rule -> rule.pas...
10-04-06 14:53:16  [*] Compiling Weapon_shop -> Weapon_shop.pas...
10-04-06 14:53:16  [*] Weapon_shop -> [Error] (165:1): 'BEGIN' expected
10-04-06 14:53:16  [*] Compilation Failed.
10-04-06 14:53:16 Shutting down server...
10-04-06 14:53:16 Shutting down admin server...
10-04-06 14:53:16 Shutting down ScriptCore...

Code: [Select]
const
Color = $0099CC; //Color to be used.
psgpowa = 1;
psgtype = 14;
psgrang = 666;
psgspee = 50;
maxpsg = 5;
psgammo = 10; //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;

 

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        := 30;
    psgcost         := 30;
    merccost        := 20;
  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-Turret $30(spawn a turret)   #', Color);
        writeConsole(ID, '#/psg $30 (Spawn a sentry gun)      #', Color);
        writeConsole(ID, '#/merc $20 (spawn a mercenary)      #', Color);
        writeConsole(ID, '#More will come :P                  #', 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 $30, 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 $35, you have $' + inttostr(money[ID]), Color);
        end else begin writeconsole(ID, 'You do not have enough money', Color);
    end;
end;
end;



if regExpMatch('^/(merc)$', Text) then
  begin
      if money[ID] >= merccost then
        begin
          money[ID] := money[ID] - merccost;
          Command('/addbot2 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;
 


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;

Offline squiddy

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 333
  • Flagger assassin
    • SoldatX
Re: Script help :-(
« Reply #21 on: April 06, 2010, 02:10:59 pm »
You ended OnPlayerCommand(); Function, and then added "if RegExpMatch()" stuff..

Here you go:

Code: [Select]
const
Color = $0099CC; //Color to be used.
psgpowa = 1;
psgtype = 14;
psgrang = 666;
psgspee = 50;
maxpsg = 5;
psgammo = 10; //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;

 

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        := 30;
    psgcost         := 30;
    merccost        := 20;
  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-Turret $30(spawn a turret)   #', Color);
        writeConsole(ID, '#/psg $30 (Spawn a sentry gun)      #', Color);
        writeConsole(ID, '#/merc $20 (spawn a mercenary)      #', Color);
        writeConsole(ID, '#More will come :P                  #', 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 $30, 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 $35, 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('/addbot2 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;
  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;
www.soldatx.com.br - The brazilian Soldat community.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script help :-(
« Reply #22 on: April 06, 2010, 02:27:00 pm »
Thanks man :P
but can you put that when the mercenary go on bravo team that kick him ?
« Last Edit: April 06, 2010, 02:29:44 pm by mich1103 »

Offline squiddy

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 333
  • Flagger assassin
    • SoldatX
Re: Script help :-(
« Reply #23 on: April 06, 2010, 02:32:22 pm »
but can you put that when the mercenary go on bravo team that kick him ?

Is Mercenary a bot ? If so, you mean, to check if it's team is bravo, then if it is, kick him ?

I didn't understand exactly :P
www.soldatx.com.br - The brazilian Soldat community.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script help :-(
« Reply #24 on: April 06, 2010, 02:42:23 pm »
I use GetPlayerStat ?

Offline Swompie

  • Camper
  • ***
  • Posts: 390
Re: Script help :-(
« Reply #25 on: April 06, 2010, 02:50:12 pm »
Bots dont switch team...

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script help :-(
« Reply #26 on: April 06, 2010, 03:04:32 pm »
I can do it like that ?
Code: [Select]
procedure OnJoinTeam(ID, Team: byte);
begin
if team = 2
then begin
if GetPlayerStat(ID,'name') = Mercenary = true
then Command('/kick Mercenary');
WriteConsole(ID,'Youre Mercenary has perished !',$EE81FAA1);
end;
end;


Offline squiddy

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 333
  • Flagger assassin
    • SoldatX
Re: Script help :-(
« Reply #27 on: April 06, 2010, 03:10:19 pm »
I can do it like that ?
[...]

If you wanna check if a BOT is on an certain team, use this:

Code: [Select]
Procedure OnJoinTeam(ID, Team: Byte);
 Begin
  if GetPlayerStat(ID,'Human') = False Then if GetPlayerStat(ID,'Team') = 2 Then Begin
  KickPlayer(ID);
 end;
end;
www.soldatx.com.br - The brazilian Soldat community.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script help :-(
« Reply #28 on: April 06, 2010, 03:13:54 pm »
Like that ?
Code: [Select]
Procedure OnJoinTeam(ID, Team: Byte);
 Begin
  if GetPlayerStat(ID,'Human') = False Then if GetPlayerStat(ID,'Team') = 2 Then Begin
  Command('/kick '+inttostr(NameToID('Mercenary')));
 end;
end;

Offline squiddy

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 333
  • Flagger assassin
    • SoldatX
Re: Script help :-(
« Reply #29 on: April 06, 2010, 03:36:34 pm »
Like that ?
Code: [Select]
[...]
  Command('/kick '+inttostr(NameToID('Mercenary')));
 [...]

KickPlayer(); > Command('/kick');

You don't need the "NameToID" thing. Just go KickPlayer(ID);

Code: [Select]
Procedure OnJoinTeam(ID, Team: Byte);
 Begin
  if GetPlayerStat(ID,'Human') = False Then if GetPlayerStat(ID,'Team') = 2 Then Begin
  KickPlayer(ID);
 end;
end;
www.soldatx.com.br - The brazilian Soldat community.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script help :-(
« Reply #30 on: April 07, 2010, 04:27:23 pm »

Code: [Select]
-04-07 17:25:17    Console Log Started
10-04-07 17:25:17 Loaded weapons mod "Default mod v1.5"
10-04-07 17:25:17 Welcome to Soldat 1.5.0
10-04-07 17:25:17  [*] ScriptCore v2.6 loaded! Found 3 scripts...
10-04-07 17:25:17  [*] Compiling loot -> loot.pas...
10-04-07 17:25:17  [*] Compiling rule -> rule.pas...
10-04-07 17:25:17  [*] Compiling ws -> Weapon_shop.pas...
10-04-07 17:25:17  [*] ws -> [Error] (455:1): Identifier expected
10-04-07 17:25:17  [*] Compilation Failed.
10-04-07 17:25:17 Shutting down server...
10-04-07 17:25:17 Shutting down admin server...
10-04-07 17:25:17 Shutting down ScriptCore...

Ive added alot of thing !!!
Code: [Select]
const
Color = $0099CC; //Color to be used.
psgpowa = 1;
psgtype = 14;
psgrang = 666;
psgspee = 50;
maxpsg = 5;
psgammo = 10; //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 $30, 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 $35, 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 $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;




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;



Offline squiddy

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 333
  • Flagger assassin
    • SoldatX
Re: Script help :-(
« Reply #31 on: April 07, 2010, 05:21:14 pm »
Missing one "end;" at the end of the OnPlayerCommand function, and another one at the end of the script.

Dude, use NotePad++, and I guarantee you all your problems with ENDs will be over.
« Last Edit: April 07, 2010, 05:23:01 pm by squiddy »
www.soldatx.com.br - The brazilian Soldat community.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script help :-(
« Reply #32 on: April 07, 2010, 05:55:44 pm »
Can you give me the script im confused now !?!

Offline squiddy

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 333
  • Flagger assassin
    • SoldatX
Re: Script help :-(
« Reply #33 on: April 07, 2010, 08:02:06 pm »
Can you give me the script im confused now !?!

This should work. Haven't tested it.

Code: [Select]
const
Color = $0099CC; //Color to be used.
psgpowa = 1;
psgtype = 14;
psgrang = 666;
psgspee = 50;
maxpsg = 5;
psgammo = 10; //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 $30, 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 $35, 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 $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;
www.soldatx.com.br - The brazilian Soldat community.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script help :-(
« Reply #34 on: April 13, 2010, 07:50:29 pm »
When i replace that
Code: [Select]
   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;
By that

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



  procedure OnPlayerSpeak(ID:Byte;Text:String);
begin
if(Text='!shop')
      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;
  end;



I got an error ...
Code: [Select]
10-04-13 20:50:04    Console Log Started
10-04-13 20:50:05 Loaded weapons mod "Default mod v1.5"
10-04-13 20:50:05 Welcome to Soldat 1.5.0
10-04-13 20:50:05  [*] ScriptCore v2.6 loaded! Found 4 scripts...
10-04-13 20:50:05  [*] Compiling loot -> loot.pas...
10-04-13 20:50:05  [*] Compiling resurrect -> core.pas...
10-04-13 20:50:05  [*] Compiling rule -> rule.pas...
10-04-13 20:50:05  [*] rule -> [Error] (133:1): Identifier expected
10-04-13 20:50:05  [*] Compiling ws -> Weapon_shop.pas...
10-04-13 20:50:05  [*] Compilation Failed.
10-04-13 20:50:05 Shutting down server...
10-04-13 20:50:05 Shutting down admin server...
10-04-13 20:50:05 Shutting down ScriptCore...


Offline squiddy

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 333
  • Flagger assassin
    • SoldatX
Re: Script help :-(
« Reply #35 on: April 13, 2010, 08:03:52 pm »
You have two "OnPlayerSpeak"s in the same Script.

Get them together.

Like this:

Code: [Select]
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 $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;
  end;

www.soldatx.com.br - The brazilian Soldat community.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script help :-(
« Reply #36 on: April 13, 2010, 08:10:36 pm »
same error

Code: [Select]
const
Color = $0099CC; //Color to be used.
psgpowa = 2;
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;







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 $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;
  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;
Code: [Select]
10-04-13 21:08:09    Console Log Started
10-04-13 21:08:09 Loaded weapons mod "Default mod v1.5"
10-04-13 21:08:09 Welcome to Soldat 1.5.0
10-04-13 21:08:09  [*] ScriptCore v2.6 loaded! Found 4 scripts...
10-04-13 21:08:09  [*] Compiling loot -> loot.pas...
10-04-13 21:08:09  [*] Compiling resurrect -> core.pas...
10-04-13 21:08:09  [*] Compiling rule -> rule.pas...
10-04-13 21:08:09  [*] rule -> [Error] (133:1): Identifier expected
10-04-13 21:08:09  [*] Compiling ws -> Weapon_shop.pas...
10-04-13 21:08:09  [*] Compilation Failed.
10-04-13 21:08:09 Shutting down server...
10-04-13 21:08:09 Shutting down admin server...
10-04-13 21:08:09 Shutting down ScriptCore...

Offline squiddy

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 333
  • Flagger assassin
    • SoldatX
Re: Script help :-(
« Reply #37 on: April 13, 2010, 08:24:46 pm »
You forgot an "End;" at the end of the OnPlayerCommand() Function.

Try to replace it for this:

Code: [Select]
const
Color = $0099CC; //Color to be used.
psgpowa = 2;
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;

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 $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;
www.soldatx.com.br - The brazilian Soldat community.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script help :-(
« Reply #38 on: April 13, 2010, 08:27:00 pm »
Code: [Select]
10-04-13 21:26:18    Console Log Started
10-04-13 21:26:18 Loaded weapons mod "Default mod v1.5"
10-04-13 21:26:18 Welcome to Soldat 1.5.0
10-04-13 21:26:18  [*] ScriptCore v2.6 loaded! Found 4 scripts...
10-04-13 21:26:18  [*] Compiling loot -> loot.pas...
10-04-13 21:26:18  [*] Compiling resurrect -> core.pas...
10-04-13 21:26:18  [*] Compiling rule -> rule.pas...
10-04-13 21:26:18  [*] rule -> [Hint] (95:10): Variable 'Result' never used
10-04-13 21:26:18  [*] rule -> [Error] (187:3): Unknown identifier 'result'
10-04-13 21:26:18  [*] Compiling ws -> Weapon_shop.pas...
10-04-13 21:26:18  [*] Compilation Failed.
10-04-13 21:26:18 Shutting down server...
10-04-13 21:26:18 Shutting down admin server...
10-04-13 21:26:18 Shutting down ScriptCore...


Offline squiddy

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 333
  • Flagger assassin
    • SoldatX
Re: Script help :-(
« Reply #39 on: April 13, 2010, 08:45:16 pm »
Delete some random "result" you got inside the OnPlayerSpeak() Procedure.

It's probably at some RegExpMatch() Stuff you made.

Just delete it, and it should be fine.
www.soldatx.com.br - The brazilian Soldat community.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script help :-(
« Reply #40 on: April 14, 2010, 04:53:59 am »
Got it ty