Author Topic: Script help !!!  (Read 4965 times)

0 Members and 1 Guest are viewing this topic.

Offline squiddy

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 333
  • Flagger assassin
    • SoldatX
Re: Script help !!!
« Reply #20 on: April 25, 2010, 10:10:01 am »
This should work.. Haven't tested it.

Code: (pascal) [Select]
//Script help to Mich
//By Squiddy ~
//Thanks to HackTank for MaintainWeapons();

Const
 Color = $FEDEBA; //Color to be used.
 
Var
 Classe: Array[1..32] of String;
 
Procedure MaintainWeapons(ID, WepNum: Byte);
 Var Wep: Byte;
  Begin
  Wep := GetPlayerStat(ID,'Primary');
 if Wep <> WepNum Then ForceWeapon(ID,WepNum,GetPlayerStat(ID,'Secondary'),0);
end;

Procedure OnPlayerKill(Killer, Victim: Byte; Weapon: String);
 Begin
  if Classe[Killer] = 'Mechanic' Then Begin
  GiveBonus(Killer,5);
 end;
end;

Procedure OnPlayerRespawn(ID: Byte);
 Begin
  if Classe[ID] = 'Mechanic' Then MaintainWeapons(ID, 11);
 if Classe[ID] = 'Assassins' Then MaintainWeapons(ID, 14);
end;

Procedure OnWeaponChange(ID, PrimaryNum, SecondaryNum: Byte);
 Begin
  if Classe[ID] = 'Mechanic' Then MaintainWeapons(ID, 11);
 if Classe[ID] = 'Assassins' Then MaintainWeapons(ID, 14);
end;

Procedure OnPlayerSpeak(ID: Byte; Text: String);
 Begin
  if LowerCase(Text) = '!mechanic' Then if Classe[ID] = 'None' Then Begin
   Classe[ID] := 'Mechanic';
  WriteConsole(ID,'You are now a mechanic!',Color);
 end;
 
  if LowerCase(Text) = '!assassins' Then if Classe[ID] = 'None' Then Begin
   Classe[ID] := 'Assassins';
  WriteConsole(ID,'You are now an Assassin!',Color);
 end;
end;

Procedure AppOnIdle(Ticks: Integer);
 Var S: Byte;
  Begin
   For S := 1 To 32 Do if GetPlayerStat(S,'Active') = True Then Begin
    if Classe[S] = 'Mechanic' Then Begin
   MaintainWeapons(S,11);
  end;
 
 if Classe[S] = 'Assassins' Then Begin
  if Ticks Mod (60 * 15) = 0 Then Begin GiveBonus(S,1);
   end if Ticks Mod 60 = 0 Then Begin MaintainWeapons(S,14);
   end;
  end;
 end;
end;

Procedure OnJoinGame(ID, Team: Byte);
 Begin
 Classe[ID] := 'None';
end;
« Last Edit: April 25, 2010, 10:12:31 am 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 #21 on: April 25, 2010, 02:03:07 pm »
Your script work but ...
1-when i do !mechanic i cant change my classe for !assassins
2-when i do !assassins i cant change my classe for !mechanic
3-can you include the swompie script with yours to make a big one ?
4-i can be all the other classe at the same time i am a !assassins or a
!mechanic

Offline squiddy

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 333
  • Flagger assassin
    • SoldatX
Re: Script help !!!
« Reply #22 on: April 25, 2010, 05:52:47 pm »
Your script work but ...
1-when i do !mechanic i cant change my classe for !assassins
2-when i do !assassins i cant change my classe for !mechanic

Simply delete that "if Classe[ID] = 'None' Then ...' stuff on PlayerSpeak. I just thought that you could only change your class if you had none.

Quote
3-can you include the swompie script with yours to make a big one ?

Nope. I actually have a life, sorry :P

Try to do it yourself :)

Quote
4-i can be all the other classe at the same time i am a !assassins or a !mechanic

I didn't really get that. Either you are one, or another.
www.soldatx.com.br - The brazilian Soldat community.

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Script help !!!
« Reply #23 on: April 27, 2010, 07:21:19 am »
In regards to tabs: I find tabs are better since it gives the viewer the option of the indentation size, whether it is visually 2 spaces, or 4, its up to the user (or program used rather). That is why I switched to tabs instead of 2 spaces, as I have been doing before.

Offline squiddy

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 333
  • Flagger assassin
    • SoldatX
Re: Script help !!!
« Reply #24 on: April 27, 2010, 12:56:17 pm »
[...]
That is why I switched to tabs instead of 2 spaces, as I have been doing before.

My Scripts are always One-Space Based.
.Just
..Like
...This
..See
.What
I mean ?
www.soldatx.com.br - The brazilian Soldat community.

Offline Hacktank

  • Camper
  • ***
  • Posts: 462
  • Soldat Scripter
    • HTZRPG
Re: Script help !!!
« Reply #25 on: April 28, 2010, 12:36:10 am »
Tabs ftw...


Offline SpiltCoffee

  • Veteran
  • *****
  • Posts: 1579
  • Spilt, not Split!
    • SpiltCoffee's Site
Re: Script help !!!
« Reply #26 on: April 28, 2010, 07:35:54 am »
http://edn.embarcadero.com/article/10280#4.3
It's officially recommended to use two spaces. :D

If not for that, do it because it's easier to read (I don't think Pascal's verboseness works well with tabs, to be honest).
« Last Edit: April 28, 2010, 07:38:34 am by SpiltCoffee »
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 Swompie

  • Camper
  • ***
  • Posts: 390
Re: Script help !!!
« Reply #27 on: April 28, 2010, 09:37:07 am »
Tabs ftw...
Well, for your coding style yes (actually it's pretty weird, anyone says it ::))

http://edn.embarcadero.com/article/10280#4.3
It's officially recommended to use two spaces. :D

If not for that, do it because it's easier to read (I don't think Pascal's verboseness works well with tabs, to be honest).
<3