Author Topic: Adding Variables upon Bot Death  (Read 1120 times)

Ok so, I've been having some trouble where when a bot dies its suposed to add a variable to the player and display it. Well the trouble is... It just doesn't work. I added some code where it will display "Test" when you kill the bot but it doesn't show. This is an edit of McTwists CityRP so it would help if I could have the name of the variable for money aswell. Here is my code.

Quote
function botstandardarmor::onDeath(%this, %obj, %source, %pos, %damage, %type)
{
  if (%client.isInRP())

  %OrcGold = 3;

  %client.RPData.value += %OrcGold;
}
I added some random stuff to see if it would work but no dice. Thanks!
« Last Edit: September 03, 2013, 06:07:43 PM by xXDeadwolf456Xx »

This should be in Coding Help.

Anyway, first off, are your sure it's BotStandardArmor? Make sure that's the correct datablock being used by the bots. Second of all, I think your if statement is messed up; you have no brackets. Thirdly, %client is not defined.

Fixed it. Got pissed so I just made my own RPG and got it to work. Thanks though, I'll remember that stuff!

Hold up, I got a new error now. Here we go, this is really weird.

Quote
function PlayerStandardArmor::onDeath(%brick, %client)
{

if($Pref::MoneyMod::addMoney)
   {
       %orcGold = 5
      %player ##=## %client.player;
      %player.curMoney += %orcGold;
      serverCmdMoneyInfo(%client);
   }
   else
   {
      messageClient(%client,'',"The server currently has the addMoney event disabled.");
   }

}

= Is an error? It doesn't make any sense to me :/. I triple checked the code and idk what the problem is.

Hold up, I got a new error now. Here we go, this is really weird.

= Is an error? It doesn't make any sense to me :/. I triple checked the code and idk what the problem is.
Errors are often the line above where it says there's an error. You forgot a ; after %orcGold = 5.