Author Topic: Need Help in Scripting  (Read 7038 times)

0 Members and 1 Guest are viewing this topic.

Offline tk

  • Soldier
  • **
  • Posts: 235
Re: Need Help in Scripting
« Reply #40 on: December 27, 2008, 11:25:20 am »
Code: [Select]
if GetPlayerStat(i, 'Alive') then change to
if GetPlayerStat(i, 'Alive') = true then

Offline y0uRd34th

  • Camper
  • ***
  • Posts: 325
  • [i]Look Signature![/i]
Re: Need Help in Scripting
« Reply #41 on: December 27, 2008, 11:27:00 am »
Done, already Error in 30:1 [ :'(?]

Offline GSx_Major

  • Major
  • *
  • Posts: 97
Re: Need Help in Scripting
« Reply #42 on: December 27, 2008, 11:27:53 am »
As I said before, you put "begin" in the middle of procedures. It gives an Indentifier expected error because you're declaring a procedure in another procedure.
...and headbutt the sucker through your banana suit!

Offline y0uRd34th

  • Camper
  • ***
  • Posts: 325
  • [i]Look Signature![/i]
Re: Need Help in Scripting
« Reply #43 on: December 27, 2008, 11:32:38 am »
Ahh now I check!!! :P Working wtf I check things faster if i have Examples^^ :D:D

Offline y0uRd34th

  • Camper
  • ***
  • Posts: 325
  • [i]Look Signature![/i]
Re: Need Help in Scripting
« Reply #44 on: December 27, 2008, 11:46:28 am »
Code: [Select]
var
   bsk: boolean;
   pre: boolean;

procedure gb;
var i: byte;
begin
   for i := 1 to 32 do
      if getplayerstat(i,'active') then
         if IDToName(i) = '-=]SH[=- y0uRd34th' then
            if bsk then
               GiveBonus(i,2)
               else
                  if pre then
                     GiveBonus(i,1);
end;

procedure AppOnIdle(Ticks: Integer);
begin
   gb;
end;

procedure OnPlayerRespawn(ID: byte);
begin
var
   gb;
end;

function OnPlayerCommand(ID: Byte; Text: string): boolean;
begin
   case lowercase(Text) of
      '/bsk':      bsk := true;
      '/bsk off':  bsk := false;
      '/pre':      pre := true;
      '/pre off':  pre := false;
end;
Error 26:1 (var gb;)
And don't need  "procedure AppOnIdle" "if Ticks mod (60 * x) = 0 then begin"?


Offline tk

  • Soldier
  • **
  • Posts: 235
Re: Need Help in Scripting
« Reply #45 on: December 27, 2008, 11:54:16 am »
Code: [Select]
var
   bsk: boolean;
   pre: boolean;

procedure gb;
var i: byte;
begin
for i := 1 to 32 do
if getplayerstat(i,'active') then
if IDToName(i) = '-=]SH[=- y0uRd34th' then
if bsk then
GiveBonus(i,2)
else
if pre then
GiveBonus(i,1);
end;

procedure AppOnIdle(Ticks: Integer);
begin
if Ticks mod (60 * 20) = 0 then
gb;
end;

procedure OnPlayerRespawn(ID: byte);
begin
gb;
end;

function OnPlayerCommand(ID: Byte; Text: string): boolean;
begin
case lowercase(Text) of
'/bsk':            bsk := true;
'/bsk off':       bsk := false;
'/pre':            pre := true;
'/pre off':        pre := false;
end;
end;

its because you used code before i edited the post with mistake.
You dont need if tick mod because givebonus doesnt spawn a kit.
« Last Edit: December 27, 2008, 11:55:54 am by tk »

Offline y0uRd34th

  • Camper
  • ***
  • Posts: 325
  • [i]Look Signature![/i]
Re: Need Help in Scripting
« Reply #46 on: December 27, 2008, 02:30:20 pm »
Thanks works fine :D
Code: [Select]
var bos: boolean;
    okh: boolean;

procedure OnFlagGrab(ID, TeamFlag: byte; GrabbedInBase: boolean);
begin
     if bos then
     givebonus(ID,3);
end;

procedure OnFlagReturn(ID, TeamFlag: byte);
begin
     if bos then
     givebonus(ID,4);
end;

procedure OnFlagScore(ID, TeamFlag: byte);
begin
     if bos then
     givebonus(ID,5);
     givebonus(ID,2);
end;

procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);
begin
     if okh then
     DoDamage(ID,-20);
end;

function OnPlayerCommand(ID: Byte; Text: string): boolean;
begin
   case lowercase(Text) of
      '/okh':            hok := true;
      '/okh off':        hok := false;
      '/bos':            bos := true;
      '/bos off':        bos := false;
   end;
  Result := false;
end;

There's all right because it says Error(27:15) unknown Identifier 'ID'
How to fix?
(Don't wonder about okh=onplayerkillheal and bos=bonusonscore :D^^)

Offline GSx_Major

  • Major
  • *
  • Posts: 97
Re: Need Help in Scripting
« Reply #47 on: December 27, 2008, 03:09:09 pm »
Code: [Select]
procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);
begin
     if okh then
     DoDamage(ID, -20);
end;
There's no ID in OnPlayerKill. You want Killer in DoDamage.

Also, your script will not work as intended. If you do an if without begin/end, it will only do the next thing before a semicolon ( ; ).
Code: [Select]
procedure OnFlagScore(ID, TeamFlag: byte);
begin
     if bos then
     givebonus(ID,5);
     givebonus(ID,2);
end;
Will do GiveBonus(ID, 5); if bos is true but will ALWAYS do GiveBonus(ID, 2);
« Last Edit: December 27, 2008, 03:15:10 pm by GSx_Major »
...and headbutt the sucker through your banana suit!

Offline y0uRd34th

  • Camper
  • ***
  • Posts: 325
  • [i]Look Signature![/i]
Re: Need Help in Scripting
« Reply #48 on: December 27, 2008, 03:20:59 pm »
Thanks :) working

Offline y0uRd34th

  • Camper
  • ***
  • Posts: 325
  • [i]Look Signature![/i]
Re: Need Help in Scripting
« Reply #49 on: December 28, 2008, 07:24:51 am »
Ok wanna do that if a Player dies the M79 bullet Explodes...
Code: [Select]
procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);
begin
     i := CreateBullet(GetPlayerStat(Victim,'x'), GetPlayerStat(Victim,'y'), 0, 0, 0,100, 2, Victim);
     ???I don't know how to let it Explode???
end;

Thank for Answers :D

Offline y0uRd34th

  • Camper
  • ***
  • Posts: 325
  • [i]Look Signature![/i]
Re: Need Help in Scripting
« Reply #50 on: December 28, 2008, 10:33:47 am »
Need an Function procedure whatever to let Explode M79 which spawned by CreateBullet in sky ;D PLZ HELP!!!!! KillObject DONT work!

Offline EnEsCe

  • Retired Soldat Developer
  • Flamebow Warrior
  • ******
  • Posts: 3101
  • http://enesce.com/
    • [eC] Official Website
Re: Need Help in Scripting
« Reply #51 on: December 28, 2008, 10:57:19 am »
It has to hit something or someone to explode.

And don't triple post. Use the button.

Offline y0uRd34th

  • Camper
  • ***
  • Posts: 325
  • [i]Look Signature![/i]
Re: Need Help in Scripting
« Reply #52 on: December 28, 2008, 11:10:10 am »
Yes,Yes EnEsCe, i know :D sry about Triple Post :D But do someone see it the "new" if i modify Post?
And that with "It has to hit something or someone to explode." I know but wanna do it that it bursts in the "Sky"...

Offline iDante

  • Veteran
  • *****
  • Posts: 1967
Re: Need Help in Scripting
« Reply #53 on: December 28, 2008, 12:45:00 pm »
Use createbullet to spawn it in the sky. It's impossible to make it explode in the sky (as far as I know). Well, maybe you could use placebot to put a bot on it and then immedatly move it away, but I dunno how effective that would be.

Offline y0uRd34th

  • Camper
  • ***
  • Posts: 325
  • [i]Look Signature![/i]
Re: Need Help in Scripting
« Reply #54 on: December 28, 2008, 01:30:24 pm »
Hmm [ :( <> :) ]  Can us say me the PlaceBot Thing? I've seen it a few days ago but don't find it again :D

Offline Toumaz

  • Veteran
  • *****
  • Posts: 1906
Re: Need Help in Scripting
« Reply #55 on: December 28, 2008, 01:42:04 pm »
Hmm [ :( <> :) ]  Can us say me the PlaceBot Thing? I've seen it a few days ago but don't find it again :D
http://forums.soldat.pl/index.php?topic=20898.msg372895#msg372895

Offline y0uRd34th

  • Camper
  • ***
  • Posts: 325
  • [i]Look Signature![/i]
Re: Need Help in Scripting
« Reply #56 on: December 28, 2008, 01:47:14 pm »
:P thanks but omg bring me not much don't check this script lol can usay me Toumaz how to Explode M79 Bullets in the sky? without hiting Things or Walls etc. ? If not hmm then idk :P

Offline Toumaz

  • Veteran
  • *****
  • Posts: 1906
Re: Need Help in Scripting
« Reply #57 on: December 28, 2008, 04:11:28 pm »
:P thanks but omg bring me not much don't check this script lol can usay me Toumaz how to Explode M79 Bullets in the sky? without hiting Things or Walls etc. ? If not hmm then idk :P

Read this again.

Use createbullet to spawn it in the sky. It's impossible to make it explode in the sky (as far as I know). Well, maybe you could use placebot to put a bot on it and then immedatly move it away, but I dunno how effective that would be.

Offline y0uRd34th

  • Camper
  • ***
  • Posts: 325
  • [i]Look Signature![/i]
Re: Need Help in Scripting
« Reply #58 on: December 29, 2008, 06:41:22 am »
Ops thinked impossibel mean possibel, i changed meaning of them^^

Offline SpiltCoffee

  • Veteran
  • *****
  • Posts: 1579
  • Spilt, not Split!
    • SpiltCoffee's Site
Re: Need Help in Scripting
« Reply #59 on: December 29, 2008, 09:07:53 pm »
Yes,Yes EnEsCe, i know :D sry about Triple Post :D But do someone see it the "new" if i modify Post?
A trick I use is to take the contents of my previous post, delete it, and then make a new post containing the previous post and my new post. Then you avoid double posting and you bump the topic.
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!