Author Topic: Cap Bonus  (Read 4754 times)

0 Members and 2 Guests are viewing this topic.

Offline Bellamy

  • Major(1)
  • Posts: 42
Cap Bonus
« on: July 03, 2008, 01:48:28 am »
Script Name: Cap Bonus
Script Description: For each cap in-game, you get a bonus. (see script for each bonus)
Original Author(s): Bellamy (buffer help from IQ-Unlimited)
Core Version: 2.6.3



Code: [Select]
var
t: integer;
procedure ActivateServer();
begin
t := 0;
end;

procedure OnFlagScore(ID, TeamFlag: byte);
begin
if t = 0 then begin
if GetPlayerStat(ID, 'kills') >= 20 then begin
GiveBonus(ID, 4);
t := 1;
end;
end;
if t = 1 then begin
if GetPlayerStat(ID, 'kills') >= 40 then begin
GiveBonus(ID, 3);
t := 2;
end;
end;
if t = 2 then begin
if GetPlayerStat(ID, 'kills') >= 60 then begin
GiveBonus(ID, 5);
t := 3;
end;
end;
if t = 3 then begin
if GetPlayerStat(ID, 'kills') >= 80 then begin
GiveBonus(ID, 2);
t := 4;
end;
end;
if t = 4 then begin
if GetPlayerStat(ID, 'kills') >= 100 then
GiveBonus(ID, 1)
t := 5;
end;
end;
end;

// GiveBonus(ID: byte; Bonus: integer) -- 1= Predator 2= Berserker 3= Vest 4= Grenades 5= Cluster Nades

Just a simple script I wrote when I was bored. I just wanted to add a little spice to my server.
« Last Edit: July 04, 2008, 01:33:52 am by Bellamy »

Offline xmRipper

  • Soldat Beta Team
  • Flagrunner
  • ******
  • Posts: 742
    • Personal
Re: Cap Bonus
« Reply #1 on: July 03, 2008, 01:59:42 am »
Use your brain. That will not work if you killed anybody.

Tip: Use variables.
« Last Edit: July 03, 2008, 02:01:23 am by xmRipper »
Co-Founder / CTO @ Macellan
Founder Turkish Soldat Community

Offline Neosano

  • Camper
  • ***
  • Posts: 253
  • IIAWAK!
Re: Cap Bonus
« Reply #2 on: July 03, 2008, 04:03:39 am »
what is that?...
KAWAAAAAAAIIIIIIIIII

Offline shantec

  • Soldier
  • **
  • Posts: 140
  • Get ANGREH!!
Re: Cap Bonus
« Reply #3 on: July 03, 2008, 05:39:51 am »
Well, you should use variables!
Its allmost impossible (if not compeletely) to try to do that without vars.
Do wah xm.Ripper said, DOOOOO IITTT!

(if you do one kill and cap, then you have 21 kills, and you wont get any bonuses...)  ::)
Also Known As REIMA


Lol Happles (happy apples)

Offline Bellamy

  • Major(1)
  • Posts: 42
Re: Cap Bonus
« Reply #4 on: July 03, 2008, 10:36:47 am »
Gah, your right. I didn't even think of it that way. '= #' didn't even click with me that it has to be that #.
I don't think straight most of the time. Some of you know that by now. lol

I'll go back and fix it. It'll be on here later.

P.S. - Or I could just make it '# to #'.
« Last Edit: July 03, 2008, 10:39:39 am by Bellamy »

Offline xmRipper

  • Soldat Beta Team
  • Flagrunner
  • ******
  • Posts: 742
    • Personal
Re: Cap Bonus
« Reply #5 on: July 03, 2008, 01:53:47 pm »
Nah. Did you check that script ?
You can not use *Flags* stat right now. That will available be in next version of dedicated server.
Co-Founder / CTO @ Macellan
Founder Turkish Soldat Community

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Cap Bonus
« Reply #6 on: July 03, 2008, 04:38:34 pm »
Change server version to 2.6.4, or modify the script to keep track OnFlagScore i believe the event is called for whenever any1 caps the flag

Offline Bellamy

  • Major(1)
  • Posts: 42
Re: Cap Bonus
« Reply #7 on: July 04, 2008, 12:03:53 am »
Why 2.6.4? There is no 2.6.4....

And I think OnFlagScore keeps each players caps and not as a team.
But I don't know, you may be right.

Offline iDante

  • Veteran
  • *****
  • Posts: 1967
Re: Cap Bonus
« Reply #8 on: July 04, 2008, 12:10:26 am »
he means like... when a player gets a cap, give them the bonus then store that they got the cap, so that next time you can check and modify the bonus.

Offline Bellamy

  • Major(1)
  • Posts: 42
Re: Cap Bonus
« Reply #9 on: July 04, 2008, 12:57:05 am »
Well I'm not so sure if I'm able to do that, as I am an all-out newb to scripting. Meh. I might try it.

And yes, the script up top is now completely jack. I'm working on it folks.. I'm working on it...

EDIT**
I FIXED THE SCRIPT, SO IT SHOULD WORK PERFECT NOW


PLEASE DONT COMPLAIN MOAR  :P
« Last Edit: July 04, 2008, 01:35:08 am by Bellamy »

Offline Neosano

  • Camper
  • ***
  • Posts: 253
  • IIAWAK!
Re: Cap Bonus
« Reply #10 on: July 04, 2008, 07:08:12 am »
No, it shouldn't work now, use arrays
KAWAAAAAAAIIIIIIIIII

Offline danmer

  • Camper
  • ***
  • Posts: 466
  • crabhead
Re: Cap Bonus
« Reply #11 on: July 04, 2008, 07:42:20 am »
[pseudo-dummy-code]

var caps: array[1..32] of byte;


procedure onjoingame // resets caps on join
begin
  caps[ID] := 0;

end;


procedure onflagscore // increasing counter and giving bonuses
begin
  caps[ID] := caps[ID] + 1;

  case caps[ID] of
    1: give small bonus
    2: etc
  end;

end;


procedure onmapchange // resets caps - optional
var i: byte;
begin
  for i := 1 to 32 do
    caps := 0;

end;

[/pseudo-dummy-code]


couldnt be arsed to write it all up as it should be, do it yourself. I hope you get the general idea of how it should work >.<

Offline Bellamy

  • Major(1)
  • Posts: 42
Re: Cap Bonus
« Reply #12 on: July 04, 2008, 06:58:28 pm »
Yeah, I do. I'm just not that good at scripting yet to know how to do that. :P

Offline amb2010

  • Camper
  • ***
  • Posts: 264
  • Fear the dot ...
Re: Cap Bonus
« Reply #13 on: July 04, 2008, 10:55:32 pm »
#1 rule for programming in any language: Make sure it actually works by testing it.

I don't want to be really harsh but this "I'm new to this and I don't know how to do that yet"
Really should stop...The stuff you are missing is the really basic stuff that is covered by most pascal help sections in the first 5-10 parts. You really need to read the basics before making any scripts. Yes practice makes perfect but you can't practice lets say football without knowing the whole game ;)

You need to prepare yourself for scripting and when something doesn't work google it...Ex: "How do I make arrays in pascal" , this will bring it up and give many examples which can probably be used in your soldat script. Although some of the code they give isn't defined in the scriptcore but the basic variable declaring and usage should be the same.
And as the lyrics go in the United State's national anthem: "America, f**k YEAH!".

Offline Bellamy

  • Major(1)
  • Posts: 42
Re: Cap Bonus
« Reply #14 on: July 05, 2008, 01:05:26 pm »
Ok, well, I'll "try harder".

Whiner.

Offline Boblekonvolutt

  • Soldier
  • **
  • Posts: 222
  • "YOU are a CAR."
Re: Cap Bonus
« Reply #15 on: July 05, 2008, 01:52:43 pm »
Doesn't belong in the Scripting Releases forum in the first place, as it isn't a working script...

Offline Bellamy

  • Major(1)
  • Posts: 42
Re: Cap Bonus
« Reply #16 on: July 05, 2008, 05:07:37 pm »
I tested it, it works fine.

Offline Neosano

  • Camper
  • ***
  • Posts: 253
  • IIAWAK!
Re: Cap Bonus
« Reply #17 on: July 05, 2008, 05:33:38 pm »
Which one?
KAWAAAAAAAIIIIIIIIII

Offline Boblekonvolutt

  • Soldier
  • **
  • Posts: 222
  • "YOU are a CAR."
Re: Cap Bonus
« Reply #18 on: July 05, 2008, 06:02:48 pm »
It will work as long as a single player is doing all the caps. But not if two or more people cap...

Offline Bellamy

  • Major(1)
  • Posts: 42
Re: Cap Bonus
« Reply #19 on: July 06, 2008, 01:07:41 am »
So, therefore, it works.