variable not getting called...

for some reason this variable isnt getting called.

its declared here:
function chekcash(%client){
         if (%client.cash < 0){
         messageclient(%client, 'MsgClient',"\c5You have no cash...");
	 messageall('MsgAll', "\c5"@%client.namebase@" is failing to pay his taxes... he must be punished at once.");
	 messageall('MsgAll', "~wfx/bonuses/low-level4-popping.wav");
	 %client.istaxed = true;
         }
}

then in defaultgame.cs, in function DefaultGame::onClientKilled();
      if (%clVictim.istaxed == true){
         %money=%clKiller.cash;
         %clKiller.cash=%money+1500;
         %clVictim.cash=100;
	 messageclient(%clKiller, 'MsgClient',"\c5You successfully killed a taxed person: "@%clVictim.nameBase@"! You have been awarded \c1500 coins, \c5 and now have \c2"@%clKiller.cash@" coins!");
	 messageclient(%clVictim, 'MsgClient',"\c5You were successfully killed by: "@%clKiller.nameBase@". Your money has reset to 100, but don't lose it again.");
	 messageall('MsgAll', "\c3"@%clVictim.namebase@", the tax denier, has been slayed by "@ %clKiller.namebase@"!");
         messageAll("", '~wfx/misc/hunters_greed.wav');
	 %clVictim.istaxed = false;
      }

%clVictim has the variable on their client, but it doesnt seem to call this little function here, IE nothing happens when clVictim is killed and clVictim.istaxed == true

what am i doing wrong?

Comments

  • Well since you're using a boolean variable you can just use if (%clVictim.istaxed) {, but that's not really an issue other than keeping it clean (you could combine the sound lines with the ones above as well). Otherwise it looks about right. Made sure you executed it properly and there were no syntax errors?
    Other than that, you may just be missing something on the edge of your view. Stick a few echos in to tell you where it's at and you'll have better luck debugging.
  • no syntax errors. and yeah i think i can try istaxed thing.
  • %clVictim.istaxed) { doesnt work

    it still doesnt do anything.

    let me try and put it in the proper loop, hang on.
  • Don't use a loop for something that runs when a player is killed. That's just a waste. If you read the post, you'll notice I didn't say it was functionally any different from what you had, I said it was cleaner. The snippets you have there will work (assuming the field is set), as long as they don't cut out before getting to the point. This is why I advised you to stick echos in to track the status of the field throughout the functions you expect it to be running through.
  • there it works now, thanks.
Sign In or Register to comment.