Author Topic: Question Thread  (Read 33396 times)

0 Members and 1 Guest are viewing this topic.

Offline squiddy

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 333
  • Flagger assassin
    • SoldatX
Re: Question Thread
« Reply #140 on: April 14, 2010, 01:43:34 pm »
Swompie, all good, except you dont have to use "if (TimerVar < 6) And (TimerVar > 0)"..

Just go..

Code: [Select]
AppOnIdle();
 Begin
  if TimerVar > 0 Then Begin
   DrawText();
  end else if TimerVar = 0 Then Begin
   DrawText();
  end;
end;

Simple like that, instead of using lots of And's..

Personally, I rather using "Then if"s instead of And's.. It looks way better without the () stuffs..

Oh well, it's just my opinion about it :P Please don't throw any rocks at me :D
www.soldatx.com.br - The brazilian Soldat community.

DarkCrusade

  • Guest
Re: Question Thread
« Reply #141 on: April 14, 2010, 02:22:30 pm »
Never saw such an error before ...

Code: [Select]
10-04-14 21:18:32  [*] Knife Server -> [Error] (232:18): Assignment expected
10-04-14 21:18:32  [*] Compilation Failed.
10-04-14 21:18:32 Shutting down server...

I tried JFKs method and worked a bit on it and it should work but it doesn´t. I really don´t know what´s wrong.

Code: [Select]
procedure AppOnIdle(Ticks: Integer);
var DC,StartTime: Byte;
     EngineerTimer: Integer;
  begin
     for DC := 1 to 32 do
        if EngineerTimer < 6 then begin
        if EngineerTImer < 1 then begin
          EngineerTimer = STARTTIME;
          ForceWeapon(DC,14,14,0);
          DrawText(DC, 'Gun removed', 120,Color,(255,255,255),5,50);
       end else
          DrawText(DC,inttostr(EngineerTimer)+' second left',180,Color,(255,255,255),5,50);
       end;
       EngineerTimer := EngineerTimer - 1;
     end;
end;

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: Question Thread
« Reply #142 on: April 14, 2010, 02:28:07 pm »
Do you have any brain?
Code: [Select]
EngineerTimer = STARTTIME;

DarkCrusade

  • Guest
Re: Question Thread
« Reply #143 on: April 14, 2010, 02:36:14 pm »
The fuck now I have really no idea. The specific line includes "end;" and nothing else. What is this caused by?

Code: [Select]
10-04-14 21:34:09  [*] Knife Server -> [Error] (234:46): Close round expected
10-04-14 21:34:09  [*] Compilation Failed.
10-04-14 21:34:09 Shutting down server...

I have a brain but I am a little bit tired after all ... don´t ask.

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: Question Thread
« Reply #144 on: April 14, 2010, 02:38:53 pm »
Why don't you just paste line 233?

DarkCrusade

  • Guest
Re: Question Thread
« Reply #145 on: April 14, 2010, 02:40:20 pm »
Code: [Select]
DrawText(DC,'Gun removed',120,Color,(255,255,255),5,50);

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: Question Thread
« Reply #146 on: April 14, 2010, 02:44:50 pm »
See? Much better. What's that (255,255,255) meant to be?

DarkCrusade

  • Guest
Re: Question Thread
« Reply #147 on: April 14, 2010, 02:50:48 pm »
I took it from here.

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: Question Thread
« Reply #148 on: April 14, 2010, 02:55:10 pm »
Yours:
Code: [Select]
DrawText(0,'xxx',120,Color,(255,255,255),5,50);Wiki:
Code: [Select]
DrawText(0,'xxx',330,RGB(255,255,255),0.20,40,240);

DarkCrusade

  • Guest
Re: Question Thread
« Reply #149 on: April 14, 2010, 03:03:41 pm »
One fixed, one new, but somewhere else:

Code: [Select]
Procedure OnPlayerKill(Killer,Victim:byte;Weapon:string);               
var HP: Integer;
  begin
    if Klasse[Killer] = 'Mage' then begin
      GiveBonus(Killer, 4);                            
      GetPlayerStat(Killer,'Health');       <<< this is line 267
      if 'Health' <> 0 = false then begin
HP := 150 - 'Health';
DoDamage(Killer,HP);
end;
      end;
end;

And this is the log:

Code: [Select]
10-04-14 22:02:39  [*] Knife Server -> [Error] (267:19): Type mismatch
10-04-14 22:02:39  [*] Compilation Failed.
10-04-14 22:02:39 Shutting down server...

Offline Swompie

  • Camper
  • ***
  • Posts: 390
Re: Question Thread
« Reply #150 on: April 14, 2010, 03:05:03 pm »
Swompie, all good, except you dont have to use "if (TimerVar < 6) And (TimerVar > 0)"..

Just go..

Code: [Select]
AppOnIdle();
 Begin
  if TimerVar > 0 Then Begin
   DrawText();
  end else if TimerVar = 0 Then Begin
   DrawText();
  end;
end;

Simple like that, instead of using lots of And's..

Personally, I rather using "Then if"s instead of And's.. It looks way better without the () stuffs..

Oh well, it's just my opinion about it :P Please don't throw any rocks at me :D
Yeah, actually your're right, thx for this :p I will never learn out :D

DC:
Close Round Excepted -> ( or ) missing
Assignment expected -> :=

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: Question Thread
« Reply #151 on: April 14, 2010, 03:05:59 pm »
GOD! 'Health' <> 0 - Does that make any sense to you?

@swompie: I think he understands that after I pointed it out few times(however that'd be assuming that he uses brain...).

DarkCrusade

  • Guest
Re: Question Thread
« Reply #152 on: April 14, 2010, 03:07:48 pm »
@Gizd: That was added 30 seconds before I posted and I didn´t test it yet but you are right. It doesn´t make any sense at all. Though it doesn´t change anything. Same error.

@Swompie: Okay thanks, but what is "Type mismatch" in this case?

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: Question Thread
« Reply #153 on: April 14, 2010, 03:09:49 pm »
Oh I see...
Code: [Select]
      GetPlayerStat(Killer,'Health');Please explain what is that meant to do.

DarkCrusade

  • Guest
Re: Question Thread
« Reply #154 on: April 14, 2010, 03:14:18 pm »
I want to set the players health back to 150 when he kills someone. I used GetPlayerStat(Killer,'Health') to get his current health, then I subtract the current health from 150 and the negative damage (found one little bug that doesn´t change the error when typing this) is dealt to the player.

Offline dnmr

  • Camper
  • ***
  • Posts: 315
  • emotionally handicapped
Re: Question Thread
« Reply #155 on: April 14, 2010, 03:17:43 pm »
@ JFK: are you sure that modulus business with ticks is right? How can you get 5, 4, 3, 2 or 1 when ticks is always a multiple of 60? Oo

Offline squiddy

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 333
  • Flagger assassin
    • SoldatX
Re: Question Thread
« Reply #156 on: April 14, 2010, 06:14:06 pm »
@ JFK: are you sure that modulus business with ticks is right? How can you get 5, 4, 3, 2 or 1 when ticks is always a multiple of 60? Oo

To do something each second, you have to use "If Ticks Mod 60 = 0"..

If you use "If Ticks Mod (60 * 5) = 0", it will execute the function inside it, every FIVE seconds.

At the topic..

DarkCrusade, "Type Mismatch" is when you have an Integer, for instance, and you paste it at a String local.

For instance, assuming "MyInteger has a value of 150".

Code: [Select]
WriteConsole(ID,MyInteger,$FFFFFF);
Would go wrong. You have to do:

Code: [Select]
WriteConsole(ID,IntToStr(MyInteger),$FFFFFF);
IntToStr() converts an Integer into a String value.

StrToInt() converts an String into a Integer value.

I don't see any errors on what you pasted here.

Oh well, hope you have learned the 'lesson' :P

Also, one more thing. If Log says there is an error on line 267, there is an error on line 266. Don't know why, but it's just like that. One line less.
« Last Edit: April 14, 2010, 06:17:45 pm by squiddy »
www.soldatx.com.br - The brazilian Soldat community.

Offline dnmr

  • Camper
  • ***
  • Posts: 315
  • emotionally handicapped
Re: Question Thread
« Reply #157 on: April 14, 2010, 11:21:15 pm »
To do something each second, you have to use "If Ticks Mod 60 = 0"..

If you use "If Ticks Mod (60 * 5) = 0", it will execute the function inside it, every FIVE seconds.
thansk, i thought i was getting old


@ dc:
Code: (pascal) [Select]
GetPlayerStat(Killer,'Health');thefuck is that? getplayerstat is a function, meaning it returns a value. This taken into account, you usually want to save that value into a variable to use it somewhere later on. You're not doing that when you seriously should

Code: (pascal) [Select]
if 'Health' <> 0 = false then beginagain, what the fuck? 'Health' is a string - it's just a piece of text. It can't do anything. And you're trying to compare it to a number. Of-fucking-course it will give you a type mismatch error, you can't compare fruits with people (although sometimes i think you might actually be a papaya or something)

Gizd asked you these questions above, but i guess you didn't understand what he meant. Now if you're uncomfortable even with such things like "variable", i would like to kindly ask you to get the fuck out of here and go read some pascal manuals. Come back when you've learnt something about syntax and stuff. Thanks.

DarkCrusade

  • Guest
Re: Question Thread
« Reply #158 on: April 15, 2010, 01:22:59 am »
Don´t be rude man ... if you don´t have the patience refrain from posting. Anyway, thanks for your advice. Your third quote of my code was fixed one day ago and I already explained what went wrong. Again, don´t be rude just because I am a newbie to Pascal.

I got the script running again. Did some fixes. Found a bug ... the Engineers AppOnIdle function doesn´t work. Here is the part the bug occurs:

Code: [Select]
Procedure AppOnIdle(Ticks: Integer); 
var DC, StartTime: Byte;
begin

for DC := 1 to 32 do
        if GetPlayerStat(DC, 'Active') = true then
          if GetPlayerStat(DC, 'Alive') = true then
            if Klasse[DC] = 'Engineer' then                       
              if GetPlayerStat(DC, 'Primary') <> 11 = false then
                if ticks mod (60 * 7) = 0 then
                ForceWeapon(DC,14,255,0);

end;

If the player is active, alive, an Engineer and his weapon is not a flamer he gets one knife every 7 seconds.
« Last Edit: April 15, 2010, 02:01:00 am by DarkCrusade »

Offline SpiltCoffee

  • Veteran
  • *****
  • Posts: 1579
  • Spilt, not Split!
    • SpiltCoffee's Site
Re: Question Thread
« Reply #159 on: April 15, 2010, 03:34:49 am »
Code: (pascal) [Select]
Procedure AppOnIdle(Ticks: Integer); 
var DC, StartTime: Byte;
begin

for DC := 1 to 32 do
        if GetPlayerStat(DC, 'Active') = true then
          if GetPlayerStat(DC, 'Alive') = true then
            if Klasse[DC] = 'Engineer' then                       
              if GetPlayerStat(DC, 'Primary') <> 11 = false then //rethink this line
                if ticks mod (60 * 7) = 0 then
                ForceWeapon(DC,14,255,0);

end;
You're checking to see if the player's primary is not equal to 11, and then giving them a knife when that entire statement is false. In other words, you force their weapon to be a knife whenever they have a flamer.
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!