Pastebin

New pastes are no longer accepted · Stats

Latest Pastes

talk.cpp pay rent

else if (command.length() == 3 && command.compare(0,3,"pay") == 0)
    {
    PacketBuilder builder;
    PacketBuilder reply;

    short id = 1;
    int house, rent;

  for(int i = 0 ; i < static_cast<int>(this->server->world->house_config["Amount"]) ; i++){
  house = static_cast<int>(this->server->world->house_config[util::to_string(i+1) + ".house"]);
  rent = static_cast<int>(this->server->world->house_config[util::to_string(i+1) + ".rent"]);
  if (arguments[0] == "rent")
  {

  if(this->player->character->house == house)
   {

     if (this->player->character->HasItem(id) < rent)
			{
             builder.SetID(PACKET_TALK, PACKET_TELL);
             builder.AddBreakString("LANDLORD");
             builder.AddBreakString(this->player->character->name + "YOU DONT HAVE ENOUGH TO PAY THE RENT (:");
             this->player->client->SendBuilder(builder);
             break;
			}

          if(this->player->character->HasItem(id) >= rent)
          {
           this->player->character->house_usage = 0;
           reply.SetID(PACKET_TALK, PACKET_TELL);
           reply.AddBreakString("LANDLORD");
           reply.AddBreakString(this->player->character->name + "THANK YOU FOR YOUR PROMPT PAYMENT (:");
           this->player->client->SendBuilder(reply);

          if(this->player->character->DelItem(id, rent));
          {
          builder.SetID(PACKET_ITEM, PACKET_KICK);
          builder.AddShort(id);
          builder.AddInt(this->player->character->HasItem(id));
          builder.AddChar(this->player->character->weight);
          builder.AddChar(this->player->character->maxweight);
          this->player->client->SendBuilder(builder);
         }
        }
          this->player->character->Save();
        }
      }
   }
}