Author Topic: Variable question:  (Read 582 times)

0 Members and 1 Guest are viewing this topic.

Offline AquaByrd

  • Soldier
  • **
  • Posts: 108
  • Lolwut?
Variable question:
« on: February 14, 2009, 01:59:35 pm »
Code: [Select]
Procedure OnFlagScore(ID, TeamFlag: byte);
Var
C: Byte;

Begin
for C 1 to 32 do
if GetPlayerStat(C, 'Active') = false then begin
WriteConsole(ID,'Capping on an empty server will not get you your 20 exp.' $FFFF0C00);
SetScore(ID,GetPlayerStat(ID,'Kills')-20);
end;
if GetPlayerStat(C, 'Active') = true then begin
if GetPlayerStat(ID, 'Team') = GetPlayerStat(C, 'Team') then begin
WriteConsole(ID,'There has to be a player on the enemy team for you to get your 20 exp.', $FFFF0C00);
SetScore(ID,GetPlayerStat(ID,'Kills')-20);
end;
if GetPlayerStat(ID, 'Team') <> GetPlayerStat(C, 'Team') then begin
if GetPlayerStat(ID, 'IP') = GetPlayerStat(C, 'IP') then begin
WriteConsole(ID,'Nice try. Shame I saw it coming huh. No 20 exp for you.', $FFFF0C00);
SetScore(ID,GetPlayerStat(ID,'Kills')-20);
end;
if GetPlayerStat(ID, 'IP') <> GetPlayerStat(C, 'IP') then begin
WriteConsole(ID,'+ 20', $FF72FB03);
end;
end;
end;
End;

Is it possible to make C ignore the scoring player's ID?
My sig was 300 x 120, the maximum size is 300 x 125. Check next time will you.

Offline iDante

  • Veteran
  • *****
  • Posts: 1967
Re: Variable question:
« Reply #1 on: February 14, 2009, 02:23:46 pm »
Uh...
Code: [Select]
if C <> ID then ...
Your code is screwed up majorly. Lines like: "if GetPlayerStat(ID, 'Team') = GetPlayerStat(C, 'Team') then begin" don't actually do anything, and you seem to have made screwed up everything else. I don't even know where to begin.
Try to actually think about the flow of your code before writing huge bunches of it.
Also, start small with just ONE of these things, then see if you can get it to work.

Offline AquaByrd

  • Soldier
  • **
  • Posts: 108
  • Lolwut?
Re: Variable question:
« Reply #2 on: February 14, 2009, 02:33:43 pm »
Fair enough. I've not tried to comiple it yet, but I'll rewrite it.
My sig was 300 x 120, the maximum size is 300 x 125. Check next time will you.

Offline tk

  • Soldier
  • **
  • Posts: 235
Re: Variable question:
« Reply #3 on: February 14, 2009, 02:54:30 pm »
Quote
for C 1 to 32 do
it should be for C := 1 to 32 do

Quote
if GetPlayerStat(C, 'Active') = true then begin
      if GetPlayerStat(ID, 'Team') = GetPlayerStat(C, 'Team') then begin
         WriteConsole(ID,'There has to be a player on the enemy team for you to get your 20 exp.', $FFFF0C00);
         SetScore(ID,GetPlayerStat(ID,'Kills')-20);
      end;
      if GetPlayerStat(ID, 'Team') <> GetPlayerStat(C, 'Team') then begin
         if GetPlayerStat(ID, 'IP') = GetPlayerStat(C, 'IP') then begin
            WriteConsole(ID,'Nice try. Shame I saw it coming huh. No 20 exp for you.', $FFFF0C00);
            SetScore(ID,GetPlayerStat(ID,'Kills')-20);
         end;
         if GetPlayerStat(ID, 'IP') <> GetPlayerStat(C, 'IP') then begin
            WriteConsole(ID,'+ 20', $FF72FB03);
         end;
      end;
   end;
This is out of the loop for c
« Last Edit: February 14, 2009, 02:58:15 pm by tk »